| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace backend\modules\mall\controllers;
- use backend\controllers\MallController;
- use common\models\common\SmsLog;
- use Yii;
- /**
- * 短信控制器
- *
- * Class SmsController
- * @package backend\modules\mall\BackendLogController
- */
- class SmsController extends MallController
- {
- /**
- * 短信日志记录
- * @return mixed|string|void
- */
- public function actionIndex()
- {
- $request = Yii::$app->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);
- }
- }
|