[ 'class' => LoginBehavior::className(), 'ignore' => [ 'api/user/modify-user', 'api/user/verify-user' ] ] ]); } /** * showdoc * @catalog 会员注册 * @method post * @url /api/user/modify-user * @return {"code":0,"msg":"ok","data":{}} * @remark */ public function actionVerifyUser() { //微信登陆后 判断去登陆 还是去绑定 $post = \Yii::$app->request->post(); // attributes 转成键值对形式 key=> value $user_outh = UserOauth::findOne(['openid' => $post['code']]); if ($user_outh == null) { $data = ['code' => 1, 'msg' => '授权失败,请重新进行微信公众号授权',]; return $this->responseHandler($data); } if ($user_outh->user_id == 0) { $data = ['code' => 1, 'msg' => '暂未填写信息',]; return $this->responseHandler($data); } // 查用户信息 $user = User::findOne(['id' => $user_outh->user_id]); //未绑定 if ($user == null || empty($user->mobile_phone)) { $data = ['code' => 1, 'msg' => '未绑定']; } else { //已绑定 $form = new LoginForm(); $form->cx_mch_id = $this->cx_mch_id; $form->token_type = $this->_cx_token_type; $form->username = $user->username; $form->password = '123456'; $data = $form->login(); } return $this->responseHandler($data); } /** * showdoc * @catalog 会员注册 * @method post * @url /api/user/modify-user * @param /weight 必填 体重 * @param /height 必填 身高 * @param /age 必填 年龄 * @param /gender 必填 男女 * @param /mobile_phone 必填 手机号 * @return {"code":0,"msg":"ok","data":{}} * @remark */ public function actionModifyUser() { $post = \Yii::$app->request->post(); // attributes 转成键值对形式 key=> value $form = new UserModifyForm(); $form->cx_mch_id = $this->cx_mch_id; //商户ID 没看到传参赋值 默认给0 $form->attributes = $post; // $form->user_id = \Yii::$app->user->identity->id; //获取用户登陆ID $data = $form->modify_user(); return $this->responseHandler($data); } /** * showdoc * @catalog 会员注册 * @method post * @url /api/user/user-create * @return {"code":0,"msg":"ok","data":{}} * @remark */ public function actionUserCreate() { $post = \Yii::$app->request->post(); // attributes 转成键值对形式 key=> value $form = new ReportEditForm(); // $form->cx_mch_id = $this->cx_mch_id; //商户ID 没看到传参赋值 默认给0 $form->attributes = $post; $form->user_id = \Yii::$app->user->identity->id; //获取用户登陆ID $data = $form->edit(); return $this->responseHandler($data); } }