|
@@ -585,16 +585,16 @@ class UserProc {
|
|
|
|
|
|
/**
|
|
|
* 回写玩家数据
|
|
|
- * @param UserInfoMo $userInfo
|
|
|
+ * @param Data_UserGame $game
|
|
|
*/
|
|
|
- public static function setUserInfo($userInfo) {
|
|
|
+ public static function setUserInfo($game) {
|
|
|
$OK = false;
|
|
|
- if ($userInfo) {
|
|
|
+ if ($game) {
|
|
|
$zoneid = req()->zoneid;
|
|
|
$uid = req()->uid;
|
|
|
- $userInfo->game->baseInfo->lastSaveTs = now();
|
|
|
+ $game->baseInfo->lastSaveTs = now();
|
|
|
$key = MemKey_User::Info_hash($zoneid, $uid);
|
|
|
- $OK = $userInfo->game->updateDataFull($key); # 向Redis回写玩家数据
|
|
|
+ $OK = $game->updateDataFull($key); # 向Redis回写玩家数据
|
|
|
self::backupUserInfoMongo(); # 向MongoDB备份数据
|
|
|
}
|
|
|
return $OK;
|
|
@@ -626,7 +626,7 @@ class UserProc {
|
|
|
$zoneid = $req->zoneid;
|
|
|
$playerName = "";
|
|
|
$headImg = "";
|
|
|
- if (isset($req->userInfo)) { # 防御确保玩家数据不为空
|
|
|
+ if (null != ctx()) { # 防御确保玩家数据不为空
|
|
|
$level = ctx()->baseInfo->level;
|
|
|
$playerName = ctx()->baseInfo->name;
|
|
|
$headImg = ctx()->baseInfo->headImg;
|
|
@@ -655,10 +655,10 @@ class UserProc {
|
|
|
* version 1.0.0 Mysql storagef 1. 分表不做了, 2. 存储过程不用了 3. 先能用再说
|
|
|
*/
|
|
|
public static function backupUserInfo() {
|
|
|
- $tsday = TimeUtil::totalDays(); # 精确到天,保留10个最近记录.
|
|
|
- $value = base64_encode(gzdeflate(JsonUtil::encode(req()->userInfo))); # blob数据,序列化下
|
|
|
+ $tsday = TimeUtil::totalDays(); # 精确到天,保留10个最近记录.
|
|
|
+ $value = base64_encode(gzdeflate(JsonUtil::encode(ctx()))); # blob数据,序列化下
|
|
|
$sql = sprintf("call insertUserInfo('%s', %d, %d, '%s');", # # 所以直接将序列化后的结果存进去吧,
|
|
|
- req()->uid, req()->zoneid, $tsday, $value); # zoneid, uid, tsday
|
|
|
+ req()->uid, req()->zoneid, $tsday, $value); # zoneid, uid, tsday
|
|
|
daoInst()->exec($sql); # 也可以用exec($sql)
|
|
|
}
|
|
|
|