public function changeAvatar($user_id, $avatar_url) { $user_basic = DtbUserBasic::findFirstByuser_id($user_id); if (!$user_basic) { return false; } $user_basic->avatar_url = $avatar_url; if ($user_basic->save() == false) { return false; } else { return true; } }
private function _checkRegisterConditon($type, $mobile, $email, $password, $mobile_code, $nickname = null) { $ubm = new DtbUserBasic(); $check_value = true; if ($type == 1) { if (!$ubm->checkMobile($mobile)) { $this->flash->error('手机号码不合法'); return $check_value = false; } // $mm = new MobileModel(); // $code_data = $mm->getDataByMobile($mobile, 'code, expire_ts'); // if(!$code_data || $code_data['code'] != $code){ // $this->_return('MSG_CODE_ERROR'); // } // $now = time(); // if($now > $code_data['expire_ts']){ // $this->_return('MSG_CODE_EXPIRED'); // } $user_data = $ubm->getDataByMobile($mobile, 'user_id'); if ($user_data) { $this->flash->error('手机已存在'); return $check_value = false; } } else { if (!$ubm->checkEmail($email)) { $this->flash->error('邮箱不合法'); return $check_value = false; } $user_data = $ubm->getDataByEmail($email, 'user_id'); if ($user_data) { $this->flash->error('邮箱已存在'); return $check_value = false; } } if ($nickname !== null) { if (!$ubm->checkNickName($nickname)) { $this->flash->error('昵称不合法'); return $check_value = false; } // if(switchBlockWord($nickname) != $nickname){ // //$this->_return('NICKNAME_HAS_BLOCK_WORD'); // } $user_data = $ubm->getDataByNickname($nickname, 'user_id'); if ($user_data) { $this->flash->error('昵称已存在'); return $check_value = false; } } if (strlen($password) < 6) { $this->flash->error('密码要大于6位'); return $check_value = false; } return $check_value; }