游戏比例公用方法修正

master
zhengyongxing 4 years ago
parent 34b12ad382
commit 97c33c8e1b

@ -58,66 +58,119 @@ class CompanyGameRatioModel extends Model
$game_radio_data = $game_ratio[$v['relation_game_id']];
$game_key = 0;
$game_key = [];
$last_time_ratio = [];
foreach ($game_radio_data as $key => $value) {
if (!isset($value['ratio'])) {
$game_key = $key;
$last_time_ratio = $value;
break;
$game_key[] = $key;
$last_time_ratio[] = $value;
}
}
// $last_time_ratio = end($game_ratio[$v['relation_game_id']]);
if($v['end_time'] == 0 || ($v['end_time'] >= $last_time_ratio['endtime'])){
//全段
if($v['begin_time'] <= $last_time_ratio['begintime']){
foreach($last_time_ratio as $key => $value) {
$tgr[$game_key]['ratio'] = !$is_inside?$v['ratio']:0;
$tgr[$game_key]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[];
if($v['end_time'] == 0 || ($v['end_time'] >= $value['endtime'])){
//全段
if($v['begin_time'] <= $value['begintime']){
continue;
}else{
//上分段
$tgr[$game_key[$key]]['ratio'] = !$is_inside?$v['ratio']:0;
$tgr[$game_key[$key]]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[];
$tgr[$game_key]['endtime'] = $v['begin_time']-1;
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$last_time_ratio['endtime'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
continue;
}elseif($v['end_time'] >= $value['begintime']){
//上分段
continue;
}
}
if($v['end_time'] < $last_time_ratio['endtime']){
if($last_time_ratio['begintime'] < $v['begin_time']){
$tgr[$game_key[$key]]['endtime'] = $v['begin_time']-1;
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$value['endtime'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
continue;
}
}
if($v['end_time'] < $value['endtime'] && $v['end_time'] != 0){
if($value['begintime'] < $v['begin_time']){
//中段
$tgr[$game_key[$key]]['endtime'] = $v['begin_time']-1;
//中段
$tgr[$game_key]['endtime'] = $v['begin_time']-1;
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$v['end_time'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$v['end_time'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$value['endtime']];
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
continue;
}
continue;
}
if($last_time_ratio['begintime'] > $v['begin_time']){
//下分段
if($value['begintime'] > $v['begin_time']){
//下分段
$tgr[$game_key]['begintime'] = $v['end_time']-0+1;
$tgr[$game_key[$key]]['begintime'] = $v['end_time']-0+1;
// $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
$tgr[] = ['begintime'=>$last_time_ratio['begintime'],"endtime"=>$v['end_time']-0,"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
continue;
}
$tgr[] = ['begintime'=>$value['begintime'],"endtime"=>$v['end_time']-0,"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
continue;
}
if($last_time_ratio['begintime'] = $v['begin_time']){
if($value['begintime'] = $v['begin_time']){
$tgr[$game_key]['endtime'] = $v['end_time'];
$tgr[$game_key]['ratio'] = !$is_inside?$v['ratio']:0;
$tgr[$game_key]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[];
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
$tgr[$game_key[$key]]['endtime'] = $v['end_time'];
$tgr[$game_key[$key]]['ratio'] = !$is_inside?$v['ratio']:0;
$tgr[$game_key[$key]]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[];
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$value['endtime']];
}
}
}
}
}
// if($v['end_time'] == 0 || ($v['end_time'] >= $last_time_ratio['endtime'])){
// //全段
// if($v['begin_time'] <= $last_time_ratio['begintime']){
//
// $tgr[$game_key]['ratio'] = !$is_inside?$v['ratio']:0;
// $tgr[$game_key]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[];
//
// continue;
// }else{
// //上分段
//
// $tgr[$game_key]['endtime'] = $v['begin_time']-1;
// $tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$last_time_ratio['endtime'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
//
// continue;
// }
// }
// if($v['end_time'] < $last_time_ratio['endtime']){
// if($last_time_ratio['begintime'] < $v['begin_time']){
//
// //中段
// $tgr[$game_key]['endtime'] = $v['begin_time']-1;
//
// $tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$v['end_time'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
//
// $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
//
// continue;
// }
//
// if($last_time_ratio['begintime'] > $v['begin_time']){
// //下分段
//
// $tgr[$game_key]['begintime'] = $v['end_time']-0+1;
//// $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
// $tgr[] = ['begintime'=>$last_time_ratio['begintime'],"endtime"=>$v['end_time']-0,"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
// continue;
// }
//
// if($last_time_ratio['begintime'] = $v['begin_time']){
//
// $tgr[$game_key]['endtime'] = $v['end_time'];
// $tgr[$game_key]['ratio'] = !$is_inside?$v['ratio']:0;
// $tgr[$game_key]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[];
// $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
//
// }
//
// }
}
$return_data = [];

Loading…
Cancel
Save