diff --git a/Application/Admin/Controller/CompanyGameRatioController.class.php b/Application/Admin/Controller/CompanyGameRatioController.class.php index a33b551ad..ff55d7e66 100644 --- a/Application/Admin/Controller/CompanyGameRatioController.class.php +++ b/Application/Admin/Controller/CompanyGameRatioController.class.php @@ -423,7 +423,7 @@ class CompanyGameRatioController extends AdminController $v['verify_log']['admin_user']=$this->admininfo["username"]; $v['verify_log']['admin_time']=date("Y-m-d H:i:s"); $v['verify_log'] = json_encode($v['verify_log']); - $v['status']=2; + $v['status']=1; $company_game_ratio_log->save($v); //保存到其他表 //查找是否存在 @@ -459,7 +459,7 @@ class CompanyGameRatioController extends AdminController if (!$company_id || !$relation_game_id) { $this->error("公司与游戏的参数错误."); } - +// dump($end_time);dump($begin_time);die(); $check_data = M("company_game_ratio","tab_") ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$begin_time,'end_time'=>$end_time]) ->find(); @@ -479,46 +479,46 @@ class CompanyGameRatioController extends AdminController ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id]) ->select(); - - foreach($data as $key => $value) { if ($value['begin_time'] > $begin_time) { + if (!$end_time) { + M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) + ->delete(); + continue; + } + if ($value['begin_time'] >= $end_time && $value['end_time']!=0) { continue; } if ($end_time > $value['begin_time'] && ($end_time < $value['end_time']||$value['end_time']==0)) { -// $value['begin_time'] = $end_time; -// M("company_game_ratio","tab_")->save($value); M("company_game_ratio","tab_") ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) ->save(['begin_time'=>$end_time+1]); } else if ($end_time > $value['begin_time'] && ($end_time >= $value['end_time']&&$value['end_time']!=0)) { -// $value['begin_time'] = $begin_time; -// $value['end_time'] = $end_time; -// M("company_game_ratio","tab_")->save($value); M("company_game_ratio","tab_") ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) ->save(['begin_time'=>$begin_time,'end_time'=>$end_time]); } } else if ($value['begin_time'] <= $begin_time) { - + if (!$end_time) { + M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) + ->save(['end_time'=>$begin_time-1]); + continue; + } if ($begin_time >= $value['end_time']&& $value['end_time']!=0) { continue; } if ($begin_time > $value['begin_time'] && ($end_time >= $value['end_time'] && $value['end_time']!=0)) { -// $value['end_time'] = $begin_time; -// M("company_game_ratio","tab_")->save($value); M("company_game_ratio","tab_") ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) ->save(['end_time'=>$begin_time-1]); } else if ($begin_time > $value['begin_time'] && ($end_time < $value['end_time']||$value['end_time']==0)) { -// $value['end_time'] = $begin_time; -// M("company_game_ratio","tab_")->save($value); -// dump(2);die(); M("company_game_ratio","tab_") ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) ->save(['end_time'=>$begin_time-1]); @@ -536,9 +536,6 @@ class CompanyGameRatioController extends AdminController ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) ->save(['end_time'=>$begin_time-1]); } else if ($end_time == $value['end_time']&&$begin_time == $value['begin_time']) { - -// $value['begin_time'] = $begin_time; -// $value['end_time'] = $end_time; M("company_game_ratio","tab_") ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) ->save(['begin_time'=>$begin_time,'end_time'=>$end_time]);