本文整理匯總了PHP中UserAction::getUserbattle方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserAction::getUserbattle方法的具體用法?PHP UserAction::getUserbattle怎麽用?PHP UserAction::getUserbattle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserAction
的用法示例。
在下文中一共展示了UserAction::getUserbattle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: exeUserRegister
/**
* API:用戶注冊
*
* @access public
* @param 無
* @return JsonView 響應json
*/
public function exeUserRegister()
{
$requestParam = $this->getAllParameters();
Logger::debug('requestParam:' . print_r($requestParam, true));
$requestJsonParam = $this->getDecodedJsonRequest();
Logger::debug('requestJsonParam:' . print_r($requestJsonParam, true));
// 檢測賬號是否重複
$ret = AuthModel::checkUserAccount($requestJsonParam['account']);
if (!$ret) {
$view = new JsonView();
$messageArr['error'] = "該賬號已存在";
return $this->getViewByJson($view, $messageArr, 0, "auth/user_register");
}
// 檢測賬號是否重複
$ret = AuthModel::checkUserName($requestJsonParam['user_name']);
if (!$ret) {
$view = new JsonView();
$messageArr['error'] = "該昵稱已存在";
return $this->getViewByJson($view, $messageArr, 0, "auth/user_register");
}
// 插入新用戶
$ret = AuthModel::insert(array('s_account' => $requestJsonParam['account'], 's_password' => $requestJsonParam['password'], 't_create_time' => date("Y-m-d H:i:s")), $pdo);
if (is_null($ret)) {
throw new ModelException('insert false pa_user_master');
}
//---------------------------- 初始用戶表 ----------------------------
$user_id = AuthModel::getUserID($requestJsonParam['account'], $requestJsonParam['password'], $pdo);
$messageArr['n_id'] = $user_id;
self::$userBasicIni['s_name'] = $requestJsonParam['user_name'];
self::$userBasicIni['n_sex'] = $requestJsonParam['sex'];
self::$userBasicIni['t_create_time'] = date("Y-m-d H:i:s");
// 初始化關卡信息
$checkPointIni = array(1 => array('score' => 0, 'scr_length' => 0, 'reward' => 0, 'kill_num' => 0, 'star_num' => 0));
//self::$userBasicIni['s_checkpoint_info'] = serialize( $checkPointIni );
// 初始化角色信息
self::$userBasicIni['s_role_info '] = CharacterAction::registCharacter($user_id, Constants::INI_CHARACTER_ID);
// 初始化武將信息
self::$userBasicIni['s_general_info'] = GeneralAction::registGeneral($user_id, Constants::INI_GENERAL_ID);
// 初始化任務信息
self::$userBasicIni['s_task_info'] = serialize(TaskAndAchieveAction::randTask($user_id));
// 初始化成就信息
self::$userBasicIni['s_achievement_info'] = TaskAndAchieveAction::registAchieveCsv($user_id);
// 初始化簽到信息
$loginInfo = UserAction::getUserLoginInfo();
self::$userBasicIni['s_login_info'] = serialize($loginInfo);
$userInfo = array_merge($messageArr, self::$userBasicIni);
$ret = UserModel::insert($userInfo, $pdo);
FriendModel::insert(array('n_user_id' => $user_id, 'n_friend_id' => Constants::ROBERT, 't_create_time' => date("Y-m-d H:i:s")));
$battle = UserAction::getUserbattle($user_id);
UserModel::update(array('n_battle' => $battle), array('n_id' => $user_id));
MailAction::sendSystemMail($user_id);
if (is_null($ret)) {
throw new ModelException('insert false pa_user_master');
}
// // 成就
// $statisticArr['login_day'] = 1;
// TaskAndAchieveAction::achieveStatistic( $user_id, $statisticArr );
$userInfo = array_merge($messageArr, self::$userBasicIni);
$session_key = CharacterModel::setSessionKey($user_id, $session_key);
$messageArr['total_day'] = $loginInfo['total_day'];
$messageArr['session_key'] = $session_key;
$view = new JsonView();
return $this->getViewByJson($view, $messageArr, 1, "auth/user_register");
}