diff --git a/source/application/api/controller/pass/Passcc.php b/source/application/api/controller/pass/Passcc.php index c8f5811..e6ed82f 100644 --- a/source/application/api/controller/pass/Passcc.php +++ b/source/application/api/controller/pass/Passcc.php @@ -28,7 +28,7 @@ class Passcc extends Controller $granularity = $this->request->param('granularity'); $type = $this->request->param('type'); $res = PassFlow::allGroupTimeNum(['granularity' => $granularity, 'type' => $type]); - if (empty($res['code'])) $this->renderError($res['msg']); + if (empty($res['code'])) return $this->renderError($res['msg']); $data = $res['data']; return $this->renderSuccess(compact('data')); } @@ -44,6 +44,7 @@ class Passcc extends Controller { $type = $this->request->param('type') ?: ''; $returnData = PassFlow::allGroupNum(null,['type' => $type]); + if (isset($returnData['code'])) return $this->renderError($returnData['msg']); return $this->renderSuccess(compact('returnData')); } @@ -71,6 +72,7 @@ class Passcc extends Controller { $type = $this->request->param('type') ?: ''; $data = PassFlow::toDayGroupsEnterNum(null,['type' => $type]); + if (isset($data['code'])) return $this->renderError($data['msg']); return $this->renderSuccess(compact('data')); } @@ -95,6 +97,7 @@ class Passcc extends Controller { $type = $this->request->param('type') ?: ''; $data = PassFlow::getPassHoursData(null,['type' => $type]); + if (isset($data['code'])) return $this->renderError($data['msg']); return $this->renderSuccess(compact('data')); } } \ No newline at end of file diff --git a/source/application/common/logic/PassFlow.php b/source/application/common/logic/PassFlow.php index a7fd2d5..d2ab9ea 100644 --- a/source/application/common/logic/PassFlow.php +++ b/source/application/common/logic/PassFlow.php @@ -35,6 +35,7 @@ class PassFlow if (!in_array($granularity,self::$granularity)) return ['code' => 0, 'msg' => '参数错误:granularity']; $where = ''; $groupsId = ''; + if (empty($dm)) $dm = new Dm(); if (!empty($type)) { if (!in_array($type,self::$groupType)) return ['code' => 0, 'msg' => 'type字段参数错误']; $groupsIdArr = self::getGroupIds($dm,$type); @@ -45,7 +46,6 @@ class PassFlow $allTimeData = []; $groupsData = []; $dkeys = []; - if (empty($dm)) $dm = new Dm(); if ($granularity == 'daily') { $date = self::getDateData('day'); $start_time = $date['day']['start_time'];