Exemplo n.º 1
0
 public function onBeforeInsert()
 {
     parent::onBeforeInsert();
     $this->castValues();
     $this->user_id = md5(rand(0, 1000000.0) . microtime(true));
     $this->password = UserService::makePassword($this->password);
 }
Exemplo n.º 2
0
 public function logout()
 {
     UserService::logout();
     return Response::redirectUrl('/');
 }
Exemplo n.º 3
0
 /**
  * @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;
 }
Exemplo n.º 4
0
 /**
  * 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));
     }
 }