@ -23,7 +23,9 @@ class CompanyGameRatioModel extends Model
if($company_belong === false){
$company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
}
$is_inside = M("PromoteCompany","tab_")->field("is_inside")->where("id='{$company_id}'")->find()['is_inside'];
$mwhere = [
"company_belong"=>$company_belong,
"relation_game_id"=>["in",$game_ids]
@ -55,13 +57,13 @@ class CompanyGameRatioModel extends Model
if($v['end_time'] == 0 || ($v['end_time'] >= $last_time_ratio['endtime'])){
//全段
if($v['begin_time'] < = $last_time_ratio['begintime']){
$tgr[count($tgr)-1]['ratio'] = $v['ratio'];
$tgr[count($tgr)-1]['turnover_ratio'] = $v['turnover_ratio'];
$tgr[count($tgr)-1]['ratio'] = !$is_inside? $v['ratio']:0 ;
$tgr[count($tgr)-1]['turnover_ratio'] = !$is_inside? $v['turnover_ratio']:[ ];
continue;
}else{
//上分段
$tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$last_time_ratio['endtime'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$last_time_ratio['endtime'],"ratio"=>!$is_inside? $v['ratio']:0 ,"turnover_ratio"=>!$is_inside? $v['turnover_ratio']:[ ]];
continue;
}
}
@ -70,7 +72,7 @@ class CompanyGameRatioModel extends Model
//中段
$tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$v['end_time'],"ratio"=>$v['ratio'],"turnover_ratio"=>$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"=>$last_time_ratio['endtime']];
continue;
@ -78,13 +80,13 @@ class CompanyGameRatioModel extends Model
if($last_time_ratio['begintime'] > $v['begin_time']){
//下分段
$tgr[count($tgr)-1]['endtime'] = $v['end_time'];
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
$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']:[ ]];
continue;
}
if($last_time_ratio['begintime'] = $v['begin_time']){
$tgr[count($tgr)-1]['endtime'] = $v['end_time'];
$tgr[count($tgr)-1]['ratio'] = $v['ratio'];
$tgr[count($tgr)-1]['turnover_ratio'] = $v['turnover_ratio'];
$tgr[count($tgr)-1]['ratio'] = !$is_inside? $v['ratio']:0 ;
$tgr[count($tgr)-1]['turnover_ratio'] = !$is_inside? $v['turnover_ratio']:[ ];
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
}
@ -95,8 +97,8 @@ class CompanyGameRatioModel extends Model
foreach($list as $i => & $ratio){
if(!isset($ratio['ratio'])){
if(isset($modul_ratio[$k]['ratio'])){
$ratio['ratio'] = $modul_ratio[$k]['ratio'];
$ratio['turnover_ratio'] = $modul_ratio[$k]['turnover_ratio'];
$ratio['ratio'] = !$is_inside? $modul_ratio[$k]['ratio']:0 ;
$ratio['turnover_ratio'] = !$is_inside? $modul_ratio[$k]['turnover_ratio']:null ;
}else{
$ratio['ratio'] = 0;
$ratio['turnover_ratio'] =null;