| | |
| | | { |
| | | $mobile = $this->request->post('mobile'); |
| | | $captcha = $this->request->post('captcha'); |
| | | $ismobouth=$this->request->post('ismobouth',false); |
| | | if (!$mobile || !$captcha) { |
| | | $this->error(__('Invalid parameters')); |
| | | } |
| | | if (!Validate::regex($mobile, "^1\d{10}$")) { |
| | | $this->error(__('Mobile is incorrect')); |
| | | } |
| | | if (!Sms::check($mobile, $captcha, 'login')) { |
| | | if (!$ismobouth&&!Sms::check($mobile, $captcha, 'login')) { |
| | | $this->error(__('Captcha is incorrect')); |
| | | } |
| | | $user = \app\common\model\User::getByMobile($mobile); |
| | |
| | | $res = $LogicUser->unboundWechat(USERID); |
| | | $this->success('解绑成功',[]); |
| | | } |
| | | |
| | | /** |
| | | * 修改邀请码 |
| | | * |
| | | * @return void |
| | | */ |
| | | public function changecode(){ |
| | | $user = $this->auth->getUser(); |
| | | if($user->level<2){ |
| | | $this->error('当前等级不能修改邀请码'); |
| | | } |
| | | $invitation_code = request()->param('invite_code',''); |
| | | if (!$invitation_code ) { |
| | | $this->error(__('请输入邀请码')); |
| | | } |
| | | if(strlen($invitation_code)<4){ |
| | | $this->error('邀请码不能少于4位'); |
| | | } |
| | | if(strlen($invitation_code)>9){ |
| | | $this->error('邀请码不能超过8位'); |
| | | |
| | | } |
| | | if (\app\common\model\User::where('invitation_code', $invitation_code)->where('id', '<>', $user->id)->find()) { |
| | | $this->error('邀请码已存在'); |
| | | } |
| | | $user->invitation_code = $invitation_code; |
| | | $user->save(); |
| | | |
| | | $this->success(); |
| | | |
| | | } |
| | | |
| | | |
| | | } |