$this->mall_id]); return $this->success('ok', $service->getApplyStatus($this->user_id)); } /** * 获取申请配置 * * @return string */ public function actionGetApplyConfig() { $service = new SettingService(['mall_id' => $this->mall_id]); return $this->success('ok', $service->getApplyConfig()); } /** * 添加申请 * * @return string */ public function actionAddApply() { $data = $this->request->post(); $service = new ApplyService(['mall_id' => $this->mall_id]); // 申请项 $apply_for = $service->getApplyingFor(); $apply_for = array_merge($apply_for, [ 'province', 'province_id', 'city', 'city_id', 'district', 'district_id', 'logo' ]); // 验证 $validate = Yii::$app->services->validate->validate($data, [ [$apply_for, 'required'], [['town', 'town_id'], 'safe'] ]); if ($validate === false) return $this->error(Yii::$app->services->validate->getErrorMessage()); return $service->addApply($this->user_id, $data) ? $this->success('ok') : $this->error(sprintf('申请失败: %s', $service->getError())); } }