| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace addons\ReservationService\backend\controllers;
- use addons\ReservationService\common\services\BackendService;
- use addons\ReservationService\common\services\UserService;
- use common\enums\ApiStatusEnum;
- use Yii;
- use yii\helpers\Json;
- /**
- * 申请控制器
- *
- * Class ApplyController
- * @package addons\ReservationService\backend\controllers
- */
- class ApplyController extends BaseController
- {
- public $enableCsrfValidation = false;
- /**
- * 首页
- *
- * @return string
- */
- public function actionIndex()
- {
- $retuest = \Yii::$app->request;
- if ($retuest->isAjax) {
- if ($retuest->isGet) {
- $params = \Yii::$app->request->get();
- $list = BackendService::getUserList($this->mall_id, $params);
- if ($list == false) {
- return $this->error(BackendService::getStaticError());
- } else {
- if (!empty($list['list'])) {
- foreach ($list['list'] as &$item) {
- $item['idcard_images'] = [
- $item['idcard_front'],
- $item['idcard_back'],
- ];
- }
- }
- $this->success('数据请求成功', $list, ApiStatusEnum::CODE_SUCCESS, JSON_BIGINT_AS_STRING);
- }
- }
- }
- return $this->render($this->action->id);
- }
- /**
- * 入驻审核
- * @return mixed|null
- */
- public function actionAudit()
- {
- $data = Yii::$app->request->post();
- $valid = Yii::$app->services->validate->validate($data, [
- [['id', 'status'], 'integer'],
- [['remark'], 'string'],
- [['id', 'status'], 'required']
- ]);
- if ($valid === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
- try {
- $ret = (new UserService())->audit($this->mall_id, $data);
- return is_string($ret) ? $this->error($ret) : $this->success();
- } catch (\Exception $e) {
- return $this->error($e->getMessage());
- }
- }
- }
|