From 4f70b8906325cce4be549b481ce7e97c1af7e007 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 21 Aug 2020 11:24:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=B3=BB=E7=BB=9F=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/CmdTasksController.class.php | 10 +++++----- .../FinancialSummarySetController.class.php | 16 ++-------------- Application/Admin/Model/CmdTasksModel.class.php | 8 +++----- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/Application/Admin/Controller/CmdTasksController.class.php b/Application/Admin/Controller/CmdTasksController.class.php index f8ab13fdc..e29cab07c 100644 --- a/Application/Admin/Controller/CmdTasksController.class.php +++ b/Application/Admin/Controller/CmdTasksController.class.php @@ -2,6 +2,7 @@ namespace Admin\Controller; use Think\Controller; +use Think\Exception; /** * 系统任务接口 @@ -16,12 +17,11 @@ class CmdTasksController extends Controller { if(!$params){ echo('暂无任务'); } - $taskid = $params['id']; - $cmd = $params['params']; - $cmd = str_replace('{$taskid}',$taskid,$cmd); try { - exec($cmd); - } catch (\Exception $e) { + exec($params['params'], $resArr, $status); + $result = json_encode($resArr,JSON_UNESCAPED_UNICODE); + D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 2, 'end_time' => time(), 'result' => $result]); + } catch (Exception $e) { D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 3, 'end_time' => time(), 'result' => $e->getMessage()]); } } diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php index eb3894b23..739dc1299 100644 --- a/Application/Admin/Controller/FinancialSummarySetController.class.php +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -1,5 +1,6 @@ GameSupersignModel = M("GameSupersign",'tab_'); $this->CoinPayOrderModel = M("CoinPayOrder",'tab_');//会长充值平台币表 $this->TestOrderModel = M("TestOrder",'tab_');//测试订单录入 - - $taskid = I("taskid"); - if(!empty($taskid)){ - $this->taskid = $taskid; - } - } /** * 更新某月数据 @@ -63,9 +58,6 @@ class FinancialSummarySetController extends \Think\Controller $this->reCount(); $this->setFinancialSummary(); - if($this->taskid){ - D("CmdTasks")->updateTask(['id'=>$this->taskid,'status'=>2,'end_time' => time(), 'result' =>$this->result]); - } } /** * 强制重新聚合 @@ -95,11 +87,7 @@ class FinancialSummarySetController extends \Think\Controller //判断是否已经聚合 $countRes = $this->FinancialSummaryModel->field("IFNULL(COUNT(*),0) count")->where("count_year = '{$this->year}' and count_month= '{$this->month}'")->find()['count']; if($countRes > 0){ - if($this->taskid){ - throw new \Exception("error:Repeated statistics,msg:{$this->date}已经聚合过"); - }else{ - die("error:Repeated statistics,msg:{$this->date}已经聚合过"); - } + die("error:Repeated statistics,msg:{$this->date}已经聚合过"); } echo "{$this->date}开始统计".PHP_EOL; echo "--收入类型统计中".PHP_EOL; diff --git a/Application/Admin/Model/CmdTasksModel.class.php b/Application/Admin/Model/CmdTasksModel.class.php index ccf7bc0cd..c923c197b 100644 --- a/Application/Admin/Model/CmdTasksModel.class.php +++ b/Application/Admin/Model/CmdTasksModel.class.php @@ -37,11 +37,11 @@ class CmdTasksModel extends Model{ if(empty($task)){ return false; }else{ - return date("Y-d-m H:i:s",$task['end_time']); + return date("Y-m-d H:i:s",$task['end_time']); } } //插入任务 - public function addTask($type,$params,$need_tasksid = true,$need_path=true) + public function addTask($type,$params,$need_path=true) { $task = $this->field("end_time")->where(['status'=>["in","0,1"],'type'=>$type])->order("id desc")->find(); if(!empty($task)){ @@ -55,9 +55,7 @@ class CmdTasksModel extends Model{ $params = "cd ".ROOTTTTT.";".$params; } } - if($need_tasksid){ - $params = rtrim($params,";").'/taskid/{$taskid};'; - } + $params = rtrim($params,";").' 2>&1'; $save = [ "uid"=>$_SESSION['onethink_admin']['user_auth']['uid'], "created_time"=>time(),