本文整理汇总了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;
}