diff --git a/Application/Admin/Controller/FinancialSummaryController.class.php b/Application/Admin/Controller/FinancialSummaryController.class.php index f4ca32627..7fcb028c0 100644 --- a/Application/Admin/Controller/FinancialSummaryController.class.php +++ b/Application/Admin/Controller/FinancialSummaryController.class.php @@ -25,11 +25,32 @@ class FinancialSummaryController extends AdminController if(!array_key_exists("year",$_REQUEST) || !array_key_exists("type",$_REQUEST)){ $this->redirect(ACTION_NAME, array('year' => date('Y',time()),"type"=>2)); } + if(!IS_ROOT){ + $this->OpAuthList= getModuleControllerAuth(); + } + $this->assign('menubtn',$this->menuAuth()); + $lastRecount = D("CmdTasks")->getTypeLastTask("FinancialSummary"); + if(!$lastRecount){ + $lastRecount = "无"; + } + $this->assign('lastRecount',$lastRecount); + $this->getYearList(); $this->getYearData(); $this->display(); } + public function updateStatement() + { + $temp = date('Y',time()).'-'.(date('m',time())-1); + $params = "cd ".ROOTTTTT.";php admin.php FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}"; + $r = D("CmdTasks")->addTask("FinancialSummary",$params); + if($r){ + $this->ajaxReturn(["success"=>"ok"]); + }else{ + $this->ajaxReturn(["error"=>"error"]); + } + } //获取指定年份数据 public function getYearData() { @@ -142,6 +163,23 @@ class FinancialSummaryController extends AdminController } $this->assign('YearList', $list); } + public function menuAuth() + { + $mentBtn = [ + "updateStatement"=>"重算金额" + ]; + $resarr = []; + foreach ($mentBtn as $k => $v) { + if(IS_ROOT){ + $resarr[] = $v; + }else{ + if(in_array($k,$this->OpAuthList)){ + $resarr[] = $v; + } + } + } + return $resarr; + } diff --git a/Application/Admin/Model/CmdTasksModel.class.php b/Application/Admin/Model/CmdTasksModel.class.php index ac7b9f408..c85f59722 100644 --- a/Application/Admin/Model/CmdTasksModel.class.php +++ b/Application/Admin/Model/CmdTasksModel.class.php @@ -8,6 +8,7 @@ use Think\Model; */ class CmdTasksModel extends Model{ protected $tablePrefix = 'tab_'; + //获取待执行任务 public function getTask() { //按顺序获取任务 @@ -24,8 +25,37 @@ class CmdTasksModel extends Model{ return $task; } } + //更新 public function updateTask($params) { $this->save($params); } + //获取同类型任务最后一次操作时间 + public function getTypeLastTask($type) + { + $task = $this->field("end_time")->where(['status'=>"2",'type'=>$type])->order("id desc")->find(); + if(empty($task)){ + return false; + }else{ + return date("Y-d-m H:i:s",$task['end_time']); + } + } + //插入任务 + public function addTask($type,$params,$need_tasksid = true) + { + $task = $this->field("end_time")->where(['status'=>"1",'type'=>$type])->order("id desc")->find(); + if(!empty($task)){ + return false; + } + if($need_tasksid){ + $params = rtrim($params,";").'/taskid/{$taskid};'; + } + $save = [ + "uid"=>$_SESSION['onethink_admin']['user_auth']['uid'], + "created_time"=>time(), + "params"=>$params, + "type"=>$type + ]; + return $this->add($save); + } } \ No newline at end of file diff --git a/Application/Admin/View/FinancialSummary/index.html b/Application/Admin/View/FinancialSummary/index.html index 9ac8b05ca..93d095469 100644 --- a/Application/Admin/View/FinancialSummary/index.html +++ b/Application/Admin/View/FinancialSummary/index.html @@ -39,43 +39,12 @@ font-size: 12px; } - .tooltip { - position: relative; - /* display: block; */ - /* color: #056dae; */ - } - - .tooltip .tooltiptext { - display: none; - width: 100%; - background-color: #fff; - text-align: center; - border-radius: 6px; - padding: 5px 10px 5px 5px; - position: absolute; - z-index: 1; - bottom: 80%; - left: 0; - border: #000 solid 1px; - line-height: 20px; - } - - .tooltip .tooltiptext::after { - content: ""; - position: absolute; - top: 100%; - left: 50%; - margin-left: -5px; - border-width: 5px; - border-style: solid; - border-color: black transparent transparent transparent; - } - - .tooltip:hover .tooltiptext { - color: #333; - display: block; - - } + .butnbox {padding:10px 0 15px;} + .butnbox .butnlist {overflow:hidden;clear:both;} + .butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;} + .butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;} + .butnbox .butnlist .butn.last {background:#009900;} + .butnbox .butnlist .butn~.butn {margin-left:20px;}