public function onBeforeInsert() { parent::onBeforeInsert(); $this->castValues(); $this->user_id = md5(rand(0, 1000000.0) . microtime(true)); $this->password = UserService::makePassword($this->password); }
public function logout() { UserService::logout(); return Response::redirectUrl('/'); }
/** * @param User $user * @return bool */ public static function saveUploadedFile(User $user) { if ($user->file->isValid()) { $directoryExists = UserService::makeUserStorageDirectory($user); if ($directoryExists) { $destination = UserService::produceFullUserCategoryDir($user); return $user->file->move($destination . $user->file->getClientOriginalName()); } } return false; }
/** * user regist */ public static function userRegistDeal() { $requestUserInfo = Flight::request()->query->getData(); // 接受信息 if (ifNoEmptyData($requestUserInfo)) { $result = UserService::registUserInfo($requestUserInfo); if ($result && 300 == $result['errorn']) { returnJson(true, null, throwInfo($result['errorn'])); } else { returnJson(false, null, throwInfo($result['errorn'])); } } else { returnJson(false, null, throwInfo(404)); } }