|
@@ -14,6 +14,7 @@ use abei2017\wx\mini\qrcode\Qrcode;
|
|
|
use api\common\behaviors\QueryParamAuth;
|
|
|
use api\common\controllers\Controller;
|
|
|
use api\common\models\User;
|
|
|
+use api\modules\v1\models\Category;
|
|
|
use api\modules\v1\models\UserEditForm;
|
|
|
use common\enums\CodeEnum;
|
|
|
use common\models\Store;
|
|
@@ -48,4 +49,27 @@ class UserController extends Controller
|
|
|
|
|
|
return ['data' => User::findOne(Yii::$app->user->id)];
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置产业链
|
|
|
+ * @return string[]
|
|
|
+ * @throws ServerErrorHttpException
|
|
|
+ * @author nodelog
|
|
|
+ */
|
|
|
+ public function actionSetChain()
|
|
|
+ {
|
|
|
+ $model = Yii::$app->user->identity;
|
|
|
+ if (!empty($model->chain)) {
|
|
|
+ return ['errcode' => CodeEnum::CODE_ERROR, 'errmsg' => '您已设置产业分类,无需重复设置'];
|
|
|
+ }
|
|
|
+ $chain = request('chain');
|
|
|
+ $model->chain = $chain;
|
|
|
+ $model->save();
|
|
|
+ if ($model->hasErrors()) {
|
|
|
+ throw new ServerErrorHttpException(current($model->getErrors())[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ['errmsg' => '设置成功'];
|
|
|
+
|
|
|
+ }
|
|
|
}
|