From 7178181ebbefa2cffae986d93eecb39744bd190c Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Wed, 31 Mar 2021 15:56:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=89=93=E6=AC=BE=E7=B3=BB?= =?UTF-8?q?=E7=BB=9Fbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessAffairsAwardController.class.php | 11 +++-- .../Controller/TimingController.class.php | 31 ++++++++++---- .../businessAffairsList.html | 42 ++++++++++++++++++- 3 files changed, 70 insertions(+), 14 deletions(-) diff --git a/Application/Admin/Controller/BusinessAffairsAwardController.class.php b/Application/Admin/Controller/BusinessAffairsAwardController.class.php index 7355612b3..d86f1b3a2 100644 --- a/Application/Admin/Controller/BusinessAffairsAwardController.class.php +++ b/Application/Admin/Controller/BusinessAffairsAwardController.class.php @@ -232,10 +232,13 @@ class BusinessAffairsAwardController extends ThinkController if(IS_ROOT){ $this->assign('verify_check',true); + $this->assign('caculate_check',true); }else { $exportRule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_verify_check"); + $caculate_check = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_caculate_check"); $this->assign('verify_check', $this->checkRule($exportRule, array('in', '1,2'))); + $this->assign('caculate_check', $this->checkRule($caculate_check, array('in', '1,2'))); } $page = set_pagination($count, $row,$params); @@ -272,12 +275,14 @@ class BusinessAffairsAwardController extends ThinkController $this->ajaxReturn(['status'=>0,'info'=>'数据错误']); } + } + public function reCaculate() + { + exec("source /etc/profile;cd " . ROOTTT . ";php " . SUBSITE_INDEX . " timing/setbusinessAffairsAward > /dev/null &"); - - - + $this->ajaxReturn(['status' => 1]); } } diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 1dd2437e1..9080bc505 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -1563,14 +1563,22 @@ class TimingController extends AdminController { echo date("Y-m-d H:i:s")."----------------------商务奖金计算----------------------\n"; - list($becomeTimeList,$becomeTimeCount) = $this->getAffairList(date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'))); - dump($becomeTimeList); - dump($becomeTimeCount);die(); - $time1 = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); - $time2 = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-02')); - $time3 = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-03')); + if (!$_REQUEST['time']) { + $time = time(); + } else { + $time = strtotime($_REQUEST['time']); + + $time = strtotime(date('Y-m',strtotime(date('Y',$time).'-'.(date('m',$time)+1).'-01'))); + + } + + list($becomeTimeList,$becomeTimeCount) = $this->getAffairList(date('Y-m',strtotime(date('Y',$time).'-'.(date('m',$time)-1).'-01'))); + + $time1 = date('Y-m',strtotime(date('Y',$time).'-'.(date('m',$time)-1).'-01')); + $time2 = date('Y-m',strtotime(date('Y',$time).'-'.(date('m',$time)-2).'-01')); + $time3 = date('Y-m',strtotime(date('Y',$time).'-'.(date('m',$time)-3).'-01')); $lasttime = [$time2,$time3]; @@ -1602,6 +1610,8 @@ class TimingController extends AdminController { ->field("sum(pay_amount) pay_amount") ->where(['time'=>$time1]) ->find()['pay_amount']; + //判断是不是初次 + $is_hav = M("business_affairs_award_pool","tab_")->where("time = {$time2}")->find(); foreach ($data as $key => $value){ @@ -1611,11 +1621,14 @@ class TimingController extends AdminController { $value['quarter_bonus_pool'] = $this->businessAffairRatio($value['pay_amount']); - for($i = (($value['month']%3)?(($value['month']%3)-1):2); $i == 0; $i--) { - $value['quarter_bonus_pool'] += - $this->businessAffairRatio($handleData[$value['year'].'-'.(($value['month']-$i)>0?($value['month']-$i):($value['month']-$i+12)).$value['game_belong_id'].$value['relation_game_id']]['pay_amount']); + if ($is_hav) { + for($i = (($value['month']%3)?(($value['month']%3)-1):2); $i > 0; $i--) { + $value['quarter_bonus_pool'] += + $this->businessAffairRatio($handleData[$value['year'].'-'.(($value['month']-$i)>0?($value['month']-$i):($value['month']-$i+12)).$value['game_belong_id'].$value['relation_game_id']]['pay_amount']); + } } + unset($value['year']); unset($value['month']); diff --git a/Application/Admin/View/BusinessAffairsAward/businessAffairsList.html b/Application/Admin/View/BusinessAffairsAward/businessAffairsList.html index 3ba33659b..fd67f55b6 100644 --- a/Application/Admin/View/BusinessAffairsAward/businessAffairsList.html +++ b/Application/Admin/View/BusinessAffairsAward/businessAffairsList.html @@ -102,8 +102,8 @@ @@ -111,6 +111,15 @@
+
+
+ + + 重算 + + +
+
@@ -241,6 +250,35 @@ $(function(){ + $('.recaculate').click(function(){ + var url = $(this).attr('url'); + layer.confirm('是否确认重算商务汇总!', { + title:'重算汇总?', + icon:0, + btn: ['重算','取消'] //按钮 + }, function(){ + $.ajax({ + type: "POST", + url: url, + dataType: 'json', + async: false, + success:function(data){ + if(data.status == 1) { + layer.msg("重新计算需要时间,请等待5分钟后再查看"); + setTimeout(function(){ + window.location.reload(); + },1500); + } else { + layer.msg(data.info); + } + + }, + }); + }, function(){ + layer.close(); + }); + + }); $(".verify").on("click",function(){