| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 | 
							- <?php
 
- namespace api\modules\v1\controllers;
 
- use abei2017\wx\Application;
 
- 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;
 
- use common\models\Voice;
 
- use common\modules\attachment\models\Attachment;
 
- use Yii;
 
- use yii\base\Exception;
 
- use yii\helpers\ArrayHelper;
 
- use yii\web\NotFoundHttpException;
 
- use yii\web\ServerErrorHttpException;
 
- class UserController extends Controller
 
- {
 
-     public function behaviors()
 
-     {
 
-         return ArrayHelper::merge(parent::behaviors(), [
 
-             [
 
-                 'class' => QueryParamAuth::className(),
 
-                 'tokenParam' => 'token',
 
-             ]
 
-         ]);
 
-     }
 
-     
 
-     public function actionRefresh()
 
-     {
 
-         return ['data' => User::findOne(Yii::$app->user->id)];
 
-     }
 
-     
 
-     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' => '设置成功'];
 
-     }
 
- }
 
 
  |