request; if ($request->isAjax && $request->isGet) { $get = $request->get(); // 检查提交的参数 $res = Yii::$app->services->validate->validate($get,[ [['page','mobile','ip','type'], 'safe'], ]); if($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage()); // 查询参数 $where[] = ['=', 'mall_id', $this->mall_id]; !empty($get['ip']) && $where[] = ['=', 'ip', $get['ip']]; !empty($get['mobile']) && $where[] = ['=', 'mobile', $get['mobile']]; !empty($get['type']) && $where[] = ['=', 'type', $get['type']]; $params = array('where' => $where, 'order' => 'id desc', 'limit' => $request->get('limit', 20)); $list = SmsLog::listPage($params); $type_arr = SmsLog::getType();// 获取模块 $statistic = []; if ($get['page'] == 1) $statistic = SmsLog::statistic($this->mall_id);// 获取模块 return $this->success('获取成功', compact('list', 'type_arr','statistic')); } return $this->render($this->action->id); } }