|
@@ -22,12 +22,10 @@ class UserProc {
|
|
|
switch ($req->cmd) {
|
|
|
case CmdCode::cmd_user_getzonelist: # 6000 分区列表
|
|
|
return UserProc::GetZoneList();
|
|
|
- case CmdCode::cmd_user_loginuserinfo: # 6001 登录
|
|
|
+ case CmdCode::cmd_user_loginuserinfo: # 6001 登录/新玩家直接注册并登录
|
|
|
return UserProc::loginUserInfo();
|
|
|
case CmdCode::cmd_user_gameconstinfo: # 6002 下载游戏配置
|
|
|
- return UserProc::downloadConstInfo();
|
|
|
- case CmdCode::cmd_user_registerNewRole: # 6003 注册新角色
|
|
|
- return UserProc::RegisterNewRole();
|
|
|
+ return UserProc::downloadConstInfo();
|
|
|
default:
|
|
|
Err(ErrCode::cmd_err);
|
|
|
}
|
|
@@ -66,31 +64,6 @@ class UserProc {
|
|
|
return Resp::ok($g);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 6006 注册新角色
|
|
|
- */
|
|
|
- public static function RegisterNewRole() {
|
|
|
- $userID = req()->uid;
|
|
|
- list($rolename, $gender, $profile_img) = req()->paras; # 参数: 昵称,性别,头像
|
|
|
- $id = gMem()->increment(MemKey_GameRun::Stat_UserCountByZone_int(req()->zoneid)); # 增加玩家数量计数
|
|
|
- $rolename = "No." . sprintf("%03d", req()->zoneid) . sprintf("%07d", $id); # 生成编号
|
|
|
- if (self::checkRoleNameNotExist($rolename)) { # 记录玩家
|
|
|
- $game = self::createUser($rolename, $gender, $profile_img);
|
|
|
- if (1 == self::regRole(req()->zoneid, $userID, $rolename, $gender, $profile_img, req()->getPlatStr())) {
|
|
|
-
|
|
|
-
|
|
|
- $resp = Resp::ok($game);
|
|
|
- self::updtateUserZoneInfo();
|
|
|
- } else {
|
|
|
- $resp = Resp::err(ErrCode::err_db);
|
|
|
- }
|
|
|
-// StatProc::UserGuidStep($userinfo->user->firstLogOn, $req->zoneid, -2, 1);
|
|
|
- } else { # 昵称已存在
|
|
|
- $resp = Resp::ok(array('ret' => '用户已存在.'));
|
|
|
- }
|
|
|
- return $resp;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 6000 【移动端】 获取分区列表
|
|
|
*/
|
|
@@ -185,10 +158,26 @@ class UserProc {
|
|
|
public static function loginUserInfo() {
|
|
|
$game = UserProc::getUserGame(req()->zoneid, req()->uid);
|
|
|
if ($game == null) { # 新用户, -> 6006创建账号
|
|
|
- $ret = array(
|
|
|
- 'isNewUser' => true
|
|
|
- );
|
|
|
- return Resp::ok($ret);
|
|
|
+ $userID = req()->uid;
|
|
|
+
|
|
|
+ $id = gMem()->increment(MemKey_GameRun::Stat_UserCountByZone_int(req()->zoneid)); # 增加玩家数量计数
|
|
|
+ $rolename = "No." . sprintf("%03d", req()->zoneid) . sprintf("%07d", $id); # 生成编号
|
|
|
+ if (self::checkRoleNameNotExist($rolename)) { # 记录玩家
|
|
|
+ $game = self::createUser($rolename);
|
|
|
+ if (1 == self::regRole(req()->zoneid, $userID, $rolename, "", "","")) {
|
|
|
+ $resp = Resp::ok($game);
|
|
|
+ self::updtateUserZoneInfo();
|
|
|
+ } else {
|
|
|
+ $resp = Resp::err(ErrCode::err_db);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else { # 昵称已存在
|
|
|
+ $resp = Resp::ok(array('ret' => '用户已存在.'));
|
|
|
+ }
|
|
|
+
|
|
|
+ UserProc::updateUserInfo(); # 这一步回存操作只有在 userInfo正常存在的情况下才进行
|
|
|
+
|
|
|
+ return $resp;
|
|
|
} else { # 2.如果玩家已存在,则处理普通登录流程
|
|
|
req()->game = $game; # 给Req挂载玩家数据
|
|
|
UserProc::checkContidays(); # 连续登录,状态检查
|
|
@@ -256,7 +245,7 @@ class UserProc {
|
|
|
ctx()->baseInfo->lastLogin = now(); # 更新下访问时间
|
|
|
|
|
|
TapDBUtil::SOnUserLogin(); # 向tapdb上报玩家登录 2023.5.10
|
|
|
- TaskProc::OnUserLogin();
|
|
|
+
|
|
|
return $ret;
|
|
|
}
|
|
|
|
|
@@ -274,18 +263,16 @@ class UserProc {
|
|
|
* 创建用户
|
|
|
* @return Data_UserGame
|
|
|
*/
|
|
|
- static function createUser($rolename, $gender, $profile_img) {
|
|
|
+ static function createUser($rolename) {
|
|
|
$game = new Data_UserGame();
|
|
|
req()->game = $game; # 更新Req挂载的玩家数据,
|
|
|
$game->initialize(); # 初始化玩家数据
|
|
|
- $game->baseInfo->name = $rolename;
|
|
|
- $game->baseInfo->gender = $gender;
|
|
|
- $game->baseInfo->headImg = $profile_img;
|
|
|
+ $game->baseInfo->name = $rolename;
|
|
|
+ $game->baseInfo->headImg = "";
|
|
|
$game->baseInfo->firstLogin = now();
|
|
|
|
|
|
#Ps 6006是没有获得到Userinfo到Req中的
|
|
|
UserProc::checkContidays(1); # 每日状态检查
|
|
|
- UserProc::dataUpdate();
|
|
|
// UserProc::fetchFromInteract($mem, $req); # 从interact拉取数据,Ps.初始化的过程应该还拉取不到什么有效数据
|
|
|
UserProc::updateUserInfo(); # 回存用户数据
|
|
|
|
|
@@ -318,10 +305,6 @@ class UserProc {
|
|
|
gMem()->hset(MemKey_GameRun::DailyLoginUser_byLevel_hash($zoneid, $level), $uid, $platUser);
|
|
|
}
|
|
|
|
|
|
- private static function dataUpdate() {
|
|
|
- ctx()->privateState->bornPlace = 1;
|
|
|
- }
|
|
|
-
|
|
|
// </editor-fold>
|
|
|
//
|
|
|
// <editor-fold defaultstate="collapsed" desc="读写玩家数据">
|