diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 166bf0eeb..cda667c89 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -42,7 +42,6 @@ class StoreController extends BaseApiController { $store_id = (int)$this->request->get('store_id'); $phone = (int)$this->request->get('phone'); - $code = $this->request->get('code',''); $where = []; if($phone){ $where['phone'] = $phone; @@ -50,17 +49,6 @@ class StoreController extends BaseApiController if($store_id){ $where['id'] = $store_id; } - if($code && $phone){ - $remark = $phone.'_reporting'; - $codeCache = Cache::get($remark); - if(empty($codeCache)){ - return $this->fail('验证码不存在'); - } - if ($codeCache != $code) { - return $this->fail('验证码错误'); - } - } - $info = StoreLogic::search($where); if ($info) { return $this->success('ok',$info); @@ -77,6 +65,18 @@ class StoreController extends BaseApiController $params = (new UserValidate())->post()->goCheck('rechargeStoreMoney'); $auth_code = $this->request->post('auth_code'); //微信支付条码 $recharge_type = $this->request->post('recharge_type',''); //微信支付条码 + $code = $this->request->post('code','');//验证码 + $phone = $params['mobile']; + if($code && $phone){ + $remark = $phone.'_reporting'; + $codeCache = Cache::get($remark); + if(empty($codeCache)){ + return $this->fail('验证码不存在'); + } + if ($codeCache != $code) { + return $this->fail('验证码错误'); + } + } $find=User::where('mobile',$params['mobile'])->find(); if(!$find){ $params['create_uid']=$this->userId; diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php index 148a25b58..d6f5b8694 100644 --- a/app/api/controller/user/UserController.php +++ b/app/api/controller/user/UserController.php @@ -4,6 +4,7 @@ namespace app\api\controller\user; use app\api\controller\BaseApiController; use app\api\logic\user\UserLogic; +use app\api\service\UserTokenService; use app\api\validate\UserValidate; use app\common\enum\PayEnum; use app\common\logic\PaymentLogic; @@ -38,7 +39,14 @@ class UserController extends BaseApiController if ($result === false) { return $this->fail(UserLogic::getError()); } - $data = UserLogic::info($this->userId); + if($result && is_numeric($result)){ + $data = UserLogic::info($result); + $userInfo = UserTokenService::setToken($result, 1); + $data['token'] = $userInfo['token']; + }else{ + $data = UserLogic::info($this->userId); + } + return $this->success('绑定成功', $data, 1, 1); } @@ -165,7 +173,7 @@ class UserController extends BaseApiController $params = (new UserValidate())->post()->goCheck('login'); $res = (new UserLogic())->dealReportingSms($params['account']); if ($res){ - return $this->success('发送成功'); + return $this->success('发送成功',[],1,1); } return $this->fail('发送失败'); diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 67c7e4fc5..b98b7c48c 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -60,7 +60,7 @@ class UserLogic extends BaseLogic UserAuth::where('user_id',$params['user_id'])->update([ 'user_id'=>$user['id'] ]); - + User::destroy($params['user_id']); return $user['id']; // throw new \Exception('手机号已被其他账号绑定'); }