| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace addons\CardSecret\backend\controllers;
- use addons\CardSecret\common\models\CardSecretImportLog;
- use addons\CardSecret\common\models\Cate;
- use common\enums\StatusEnum;
- use Yii;
- use yii\db\Exception;
- /**
- * 默认控制器
- *
- * Class DefaultController
- * @package addons\CardSecret\backend\controllers
- */
- class ImportLogController extends BaseController
- {
- public $enableCsrfValidation = false;
- /**
- * 首页
- *
- * @return string
- */
- public function actionIndex()
- {
- $retuest = Yii::$app->request;
- if ($retuest->isAjax) {
- if ($retuest->isGet) {
- $get = Yii::$app->request->get();
- // 检查提交的参数
- $res = Yii::$app->services->validate->validate($get,[
- [['cate_id'], 'safe'],
- [['limit'],'default','value' => '15'],
- ]);
- if($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
- $where = [];
- if(!empty($get['keyword'])) $where[] = ['like', 'name', $get['keyword']];
- $where[] = ['=', 'cate_id', $get['cate_id']];
- $where[] = ['=', 'mall_id', $this->mall_id];
- $where[] = ['>=', 'status', StatusEnum::DISABLED];
- $order = 'id desc';
- $params = array('where' => $where, 'order'=>$order, 'limit' => $get['limit']);
- $list = CardSecretImportLog::listPage($params, false, true);
- $this->success('获取成功', $list);
- }
- } else {
- return $this->render($this->action->id);
- }
- }
- }
|