From 27c95792ffb23f1fbe70a3f3d47dbc3084edeb54 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Thu, 29 Oct 2020 18:08:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E5=9B=A2=E6=8E=A8=E5=B9=BF=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarketPercentageController.class.php | 51 ++++++++++++++++--- .../editcompanybelonggame.html | 3 +- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index 2d7ed2861..84a9f9417 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -1514,6 +1514,13 @@ class MarketPercentageController extends ThinkController $time_end = 99999999999; } + $last_month = strtotime(date('Y-m-t',strtotime("-1 month"))); + + if ($data['begin_time'] < $last_month) { + $this->ajaxReturn(['msg'=>"已经结算过的时间不能添加","status"=>0]); + } + + $belong_game = M("company_belong_game","tab_") ->where("((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end}))") ->select(); @@ -1540,7 +1547,7 @@ class MarketPercentageController extends ThinkController if (IS_POST) { $data = $_POST; - if (!$data['begin_time']) { + if (!$data['begin_time'] && !$data['is_start']) { $this->ajaxReturn(['msg'=>"起始时间必填","status"=>0]); } @@ -1564,6 +1571,7 @@ class MarketPercentageController extends ThinkController $time_start = strtotime($data['begin_time']); + if($data['end_time']) { $time_end = strtotime($data['end_time']); } else { @@ -1573,6 +1581,28 @@ class MarketPercentageController extends ThinkController $data['begin_time'] = strtotime($data['begin_time']); $data['end_time'] = strtotime($data['end_time']); + $company_belong_game_data = M("company_belong_game","tab_")->where(['id'=>$id])->find(); + + if ($data['is_start']) { + $time_start = $company_belong_game_data['begin_time']; + } + + $last_month = strtotime(date('Y-m-t',strtotime("-1 month"))); + + if ($company_belong_game_data['end_time'] > $last_month && $data['end_time'] < $last_month) + { + $time_end = $last_month; + $data['end_time'] = $last_month; +// $this->ajaxReturn(['msg'=>"过去已结算过的比例不能修改","status"=>0]); + } + + + if ($data['begin_time'] < $last_month && $data['end_time'] <= $last_month) { + $this->ajaxReturn(['msg'=>"已经结算过的时间不能修改","status"=>0]); + } elseif ($data['begin_time'] < $last_month && $data['end_time'] > $last_month) { + unset($data['begin_time']); + } + $belong_game = M("company_belong_game","tab_") ->where("((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end})) and id != {$id}") ->select(); @@ -1596,12 +1626,8 @@ class MarketPercentageController extends ThinkController // $data['game_ids'] = json_encode(explode(',',$data['game_ids'])); $game_ids = explode(',',$data['game_ids']); - - $data['game_ids'] = explode(',',$data['game_ids']); - - foreach($game_ids as $key => $value) { if ($value == "\"") { @@ -1613,6 +1639,10 @@ class MarketPercentageController extends ThinkController } + $data['is_start'] = 0; + if($data['begin_time']assign("data",$data); $this->display(); } @@ -1654,6 +1682,15 @@ class MarketPercentageController extends ThinkController $this->ajaxReturn(['msg'=>"参数传递错误","status"=>0]); } + + $data = M("company_belong_game","tab_") + ->where(['id'=>$id]) + ->find(); + + if (date("m",$data['begin_time']) < date("m",time())) { + $this->ajaxReturn(['msg'=>"过去已结算过的比例不能删除","status"=>0]); + } + $is_del = M("company_belong_game","tab_") ->where(['id'=>$id]) ->delete(); diff --git a/Application/Admin/View/MarketPercentage/editcompanybelonggame.html b/Application/Admin/View/MarketPercentage/editcompanybelonggame.html index 718e36536..99380c9fc 100644 --- a/Application/Admin/View/MarketPercentage/editcompanybelonggame.html +++ b/Application/Admin/View/MarketPercentage/editcompanybelonggame.html @@ -107,7 +107,8 @@ *生效期限:
- - + disabled>- +