BrandController.php 1006 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace addons\QiShangTong\backend\controllers;
  3. use addons\QiShangTong\common\service\BrandService;
  4. use Yii;
  5. class BrandController extends BaseController
  6. {
  7. public $enableCsrfValidation = false;
  8. /**
  9. * 首页
  10. *
  11. * @return string
  12. */
  13. public function actionIndex()
  14. {
  15. if (\Yii::$app->request->isAjax && \Yii::$app->request->isGet) {
  16. $data = Yii::$app->request->get();
  17. $valid = Yii::$app->services->validate->validate($data, [
  18. [['limit', 'page'], 'integer'],
  19. [['keyword'], 'string'],
  20. ]);
  21. if ($valid === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
  22. return $this->success();
  23. }
  24. return $this->render('index',[]);
  25. }
  26. public function actionImport()
  27. {
  28. $ret = (new BrandService())->find($this->mall_id);
  29. return is_string($ret) ? $this->error($ret) : $this->success('后台导入中...');
  30. }
  31. }