diff --git a/Application/Admin/Controller/SubSpendController.class.php b/Application/Admin/Controller/SubSpendController.class.php index 1ad95e6de..9f4cdb744 100644 --- a/Application/Admin/Controller/SubSpendController.class.php +++ b/Application/Admin/Controller/SubSpendController.class.php @@ -160,16 +160,26 @@ class SubSpendController extends ThinkController $this->OpAuthList= getModuleControllerAuth(); } - $this->assign('menubtn',$this->menuAuth()); + $this->assign('menubtn',$this->menuAuth($is_sub_data)); $this->display(); } - protected function menuAuth() + protected function menuAuth($is_sub_data = false) { - $mentBtn = [ - "addStatement"=>"参与结算", - "removeStatement"=>"移出结算", - ]; + $is_can_add = D("CmdTasks")->isCanAddTask("SubSpendSet"); + if($is_can_add){ + $mentBtn = [ + "addSubSpendSet"=>"固定订单", + "updateSubSpend"=>"重固订单" + ]; + }else{ + $mentBtn = []; + } + if($is_sub_data){ + $mentBtn['changeSubSpend'] = "订单换绑"; + $mentBtn['addStatement'] = "参与结算"; + $mentBtn['removeStatement'] = "移出结算"; + } $resarr = []; foreach ($mentBtn as $k => $v) { if(IS_ROOT){ @@ -183,6 +193,32 @@ class SubSpendController extends ThinkController return $resarr; } + public function addSubSpendSet(){ + if(!isset($_REQUEST['time'])) $this->error("参数错误"); + $time = $_REQUEST['time']; + $params = "php ".SUBSITE_INDEX." SubSpendSet/setSubSpend/time/{$time}"; + $r = D("CmdTasks")->addTask("SubSpendSet",$params); + if($r){ + $this->ajaxReturn(["status"=>1,"info"=>"固化数据任务登记成功,请等待两三分钟后查看结果"]); + }else{ + $this->ajaxReturn(["status"=>0,"info"=>"固化数据任务登记错误"]); + } + } + + public function updateSubSpend(){ + if(!isset($_REQUEST['begin']) || !isset($_REQUEST['end'])) $this->error("参数错误"); + $begin = $_REQUEST['begin']; + $end = $_REQUEST['end']; + + $params = "php ".SUBSITE_INDEX." SubSpendSet/recountSubSpend/begin/{$begin}/end/{$end}"; + $r = D("CmdTasks")->addTask("SubSpendSet",$params); + if($r){ + $this->ajaxReturn(["status"=>1,"info"=>"重算任务登记成功,请等待两三分钟后查看结果"]); + }else{ + $this->ajaxReturn(["status"=>0,"info"=>"重算任务登记错误"]); + } + } + public function addStatement() { if(!isset($_REQUEST['ids'])) $this->error("参数错误"); diff --git a/Application/Admin/Controller/SubSpendSetController.class.php b/Application/Admin/Controller/SubSpendSetController.class.php index f81ddbe20..ea24935e1 100644 --- a/Application/Admin/Controller/SubSpendSetController.class.php +++ b/Application/Admin/Controller/SubSpendSetController.class.php @@ -104,6 +104,4 @@ class SubSpendSetController extends Controller { return $this->SubKvModel->where("`key` = 'sub_spend_syn_time'")->save(['value'=>$this->SynTime]); } - - } diff --git a/Application/Admin/View/SubSpend/lists.html b/Application/Admin/View/SubSpend/lists.html index 9471afbe4..c37277fc8 100644 --- a/Application/Admin/View/SubSpend/lists.html +++ b/Application/Admin/View/SubSpend/lists.html @@ -408,6 +408,50 @@ 已添加添加至常用设置 + + + @@ -428,10 +472,154 @@ $(".select_gallery").select2(); +