back_recharge
parent
f7e184aeba
commit
0b67387c77
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.db.redis;
|
|||
import com.google.gson.Gson;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.common.mogodb.util.GlobalData;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||
import com.ljsd.jieling.util.ConfigurableApplicationContextManager;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -1408,7 +1409,7 @@ public class RedisUtil {
|
|||
}
|
||||
else if (!RedisKey.newAreaCacChe.contains(type) && !RedisKey.rankCacChe.contains(type)) {
|
||||
if (key.length() == 8) {
|
||||
Integer serverId = RedisUtil.getInstence().getObject(RedisKey.CUser_ServerId_Key, key, Integer.class, -1);
|
||||
Integer serverId = RedisUtil.getInstence().getObject(RedisKey.CUser_ServerId_Key, key, Integer.class, GlobalsDef.REDIS_OVER_TIME_DAY * 10);
|
||||
if (serverId != null && !AreaManager.getInstance().checkServerIdAllowPermit(serverId)) {
|
||||
result = serverId + RedisKey.Delimiter_colon + type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
|
|
|
@ -161,16 +161,12 @@ public class CrossServiceLogic {
|
|||
if(bol && player != null){
|
||||
return player;
|
||||
}
|
||||
try {
|
||||
User user = PlayerLogic.getInstance().getUserByRpc(uid);
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
player = formatUserToPlayer(user);
|
||||
RedisUtil.getInstence().setObject(getKey(player.getUserId()), player, EXPIRE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
User user = PlayerLogic.getInstance().getUserByRpc(uid);
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
player = formatUserToPlayer(user);
|
||||
RedisUtil.getInstence().setObject(getKey(player.getUserId()), player, EXPIRE);
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.ljsd.jieling.config.json.CoreSettings;
|
|||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
||||
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
|
@ -1695,13 +1696,18 @@ public class PlayerLogic {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public User getUserByRpc(int uid) throws Exception {
|
||||
Integer serverId = RedisUtil.getInstence().getObject(RedisKey.CUser_ServerId_Key, Integer.toString(uid), Integer.class, -1);
|
||||
if (serverId == null) {
|
||||
public User getUserByRpc(int uid) {
|
||||
int serverId = AreaManager.getInstance().getServerIdByUid(uid, GameApplication.serverId);
|
||||
if (serverId == 0) {
|
||||
return null;
|
||||
}
|
||||
if (serverId == GameApplication.serverId) {
|
||||
return UserManager.getUser(uid, true);
|
||||
try {
|
||||
return UserManager.getUser(uid, true);
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("getUserByRpc Exception uid={} e={}", uid, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
String rpcString = RedisUtil.getInstence().getObject(RedisKey.LOGIC_SERVER_INFO, Integer.toString(serverId), String.class, -1);
|
||||
String[] split = rpcString.split(":");
|
||||
|
@ -1711,9 +1717,6 @@ public class PlayerLogic {
|
|||
}
|
||||
String ip = rpcString.split(":")[0];
|
||||
String port = rpcString.split(":")[3];
|
||||
//rpc 数据调用
|
||||
//String ip =csPlayer.getRpcIp();
|
||||
//int port = csPlayer.getRpcPort();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("RPCCORE").append("|")
|
||||
.append(ip).append("|")
|
||||
|
|
Loading…
Reference in New Issue