From bd94f83bfda4e0c65b02a4c7a81ccb89097f7551 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Tue, 8 Aug 2023 18:06:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2sql=E6=B3=A8=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/application/api/controller/pass/Passcc.php | 12 ++++++------ source/application/common/logic/PassFlow.php | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/application/api/controller/pass/Passcc.php b/source/application/api/controller/pass/Passcc.php index a6d842d..c8f5811 100644 --- a/source/application/api/controller/pass/Passcc.php +++ b/source/application/api/controller/pass/Passcc.php @@ -26,8 +26,8 @@ class Passcc extends Controller public function allGroupTimeNum() { $granularity = $this->request->param('granularity'); - $groupsId = $this->request->param('groupsId'); - $res = PassFlow::allGroupTimeNum(['granularity' => $granularity, 'groupsId' => $groupsId]); + $type = $this->request->param('type'); + $res = PassFlow::allGroupTimeNum(['granularity' => $granularity, 'type' => $type]); if (empty($res['code'])) $this->renderError($res['msg']); $data = $res['data']; return $this->renderSuccess(compact('data')); @@ -42,8 +42,8 @@ class Passcc extends Controller */ public function allGroupNum() { - $groupsId = $this->request->param('groupsId') ?: ''; - $returnData = PassFlow::allGroupNum(null,['groupsId' => $groupsId]); + $type = $this->request->param('type') ?: ''; + $returnData = PassFlow::allGroupNum(null,['type' => $type]); return $this->renderSuccess(compact('returnData')); } @@ -69,8 +69,8 @@ class Passcc extends Controller */ public function toDayGroupsEnterNum() { - $groupsId = $this->request->param('groupsId') ?: ''; - $data = PassFlow::toDayGroupsEnterNum(null,['groupsId' => $groupsId]); + $type = $this->request->param('type') ?: ''; + $data = PassFlow::toDayGroupsEnterNum(null,['type' => $type]); return $this->renderSuccess(compact('data')); } diff --git a/source/application/common/logic/PassFlow.php b/source/application/common/logic/PassFlow.php index 2fb6391..a7fd2d5 100644 --- a/source/application/common/logic/PassFlow.php +++ b/source/application/common/logic/PassFlow.php @@ -7,6 +7,7 @@ use app\common\dm\Dm; class PassFlow { protected static $groupType = [1,2];# 1 = 体育 2 = 文化 + protected static $granularity = ['daily','monthly','yearly'];# 1 = 体育 2 = 文化 protected static function getGroupIds($dm,$type = 1) { @@ -31,6 +32,7 @@ class PassFlow $type = $param['type']; if (empty($granularity)) return ['code' => 0, 'msg' => '缺少参数:granularity']; + if (!in_array($granularity,self::$granularity)) return ['code' => 0, 'msg' => '参数错误:granularity']; $where = ''; $groupsId = ''; if (!empty($type)) {