| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace addons\OperationCenter\api\modules\v1\controllers;
- use addons\OperationCenter\api\services\CenterService;
- use api\controllers\OnAuthController;
- /**
- * 运营中心控制器
- *
- * OperationController class
- * @package addons\OperationCenter\api\modules\v1\controllers
- */
- class OperationController extends OnAuthController
- {
- /**
- * @var string
- */
- public $modelClass = '';
- /**
- * @var boolean
- */
- public $enableCsrfValidation = false;
- /**
- * 微店(运营中心)列表
- *
- * @return string
- */
- public function actionList()
- {
- $params = $this->request->get();
- $service = new CenterService(['mall_id' => $this->mall_id]);
- return $this->success('ok', $service->getPageListOrderByDistance($this->user_id, $params));
- }
- /**
- * 选择运营中心
- *
- * @return string
- */
- public function actionSelectOperation()
- {
- $id = $this->request->get('id', 0);
- if (empty($id)) return $this->error('ID不能为空');
-
- $service = new CenterService(['mall_id' => $this->mall_id]);
- return $service->selectOperation($this->user_id, $id)
- ? $this->success('ok')
- : $this->error($service->getError());
- }
- /**
- * 当前运营中心
- *
- * @return string
- */
- public function actionCurrent()
- {
- $service = new CenterService(['mall_id' => $this->mall_id]);
- return $this->success(
- 'ok',
- $service->currentOperation($this->user_id)
- );
- }
- }
|