当前位置: 首页>>代码示例>>PHP>>正文


PHP DBUtils::facebookBirthDayConverter方法代码示例

本文整理汇总了PHP中DBUtils::facebookBirthDayConverter方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtils::facebookBirthDayConverter方法的具体用法?PHP DBUtils::facebookBirthDayConverter怎么用?PHP DBUtils::facebookBirthDayConverter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBUtils的用法示例。


在下文中一共展示了DBUtils::facebookBirthDayConverter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createGameUser

 public static function createGameUser($fbUser, $accessToken)
 {
     $result = new FunctionResult();
     $errors = array();
     if (empty($fbUser) || empty($fbUser['id'])) {
         array_push($errors, LanguageUtils::getText("LANG_FACEBOOK_USER_CREATE_ERROR_USER_EMPTY"));
         $result->success = false;
         $result->result = $errors;
         unset($errors);
         return $result;
     }
     if (empty($accessToken)) {
         array_push($errors, LanguageUtils::getText("LANG_FACEBOOK_USER_CREATE_ERROR_TOKEN_EMPTY"));
         $result->success = false;
         $result->result = $errors;
         unset($errors);
         return $result;
     }
     $user = GameUsers::create();
     $user->setActive(1);
     $user->setFacebookId($fbUser['id']);
     $user->setOauthToken($accessToken);
     $user->setCoins(GameConstantUtil::getConstant(GameUsers::$CONSTANT_USER_FIRST_COIN));
     if (isset($fbUser['username'])) {
         $user->setUserName($fbUser['username']);
     } else {
         $user->setUserName($fbUser['id']);
     }
     if (isset($fbUser['first_name'])) {
         $user->setUserFirstname($fbUser['first_name']);
     }
     if (isset($fbUser['last_name'])) {
         $user->setUserLastname($fbUser['last_name']);
     }
     if (isset($fbUser['email'])) {
         $user->setUserMail($fbUser['email']);
     }
     $time = time();
     $user->setRegisterDate($time);
     $user->setLastLoginDate($time);
     $user->setLoginCount(1);
     if (isset($fbUser['gender'])) {
         if ($fbUser['gender'] == "male") {
             $user->setGender(1);
         } else {
             if ($fbUser['gender'] == "female") {
                 $user->setGender(0);
             }
         }
     }
     if (isset($fbUser['birthday'])) {
         $user->setBirtday($fbUser['birthday']);
         $user->setBirthdayDate(DBUtils::facebookBirthDayConverter($fbUser['birthday']));
     }
     $user->setPassword(DBUtils::get_uuid());
     $user->setUserXP(0);
     $level = GameUserLevel::getUserLevel(0);
     if (!empty($level)) {
         $user->setUserLevelNumber($level->levelNumber);
     }
     $user->setWinGameCount(0);
     $user->setLostGameCount(0);
     $user->setWinCountQuitGame(0);
     $user->setWinCountConnectionLostGame(0);
     $user->setWinCountDoubleGame(0);
     $user->setLostCountQuitGame(0);
     $user->setLostCountConnectionLostGame(0);
     $user->setLostCountDoubleGame(0);
     $user->insertIntoDatabase(DBUtils::getConnection());
     $result->success = true;
     $result->result = $user;
     Queue::updateUserImage($user->userId);
     unset($user);
     return $result;
 }
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:75,代码来源:GameUsers.class.php


注:本文中的DBUtils::facebookBirthDayConverter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。