error = '验证码错误'; return false; } if($user = User::where('phone',$data['phone'])->find()){ if($user['user_id'] != $this->user_id){ $this->error = '该手机号已被占用'; return false; } } return $this->save($data) != false; } /** * 微信绑定 */ public function wechatBind($data) { if($user = User::where('open_id',$data['open_id'])->where('status','>',10)->find()){ if($user['user_id'] != $this->user_id){ $this->error = '该微信已绑定在其它账号'; return false; } } return $this->save($data) != false; } /** * 代理登陆 */ public function agentLogin() { if($this->status['value'] != 30){ $this->error = '您还不是代理'; return false; } // 保存登录状态 Session::set('hema_agent', [ 'user' => $this, 'is_login' => true ]); return true; } }