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