Merge branch 'master' into master_test

lvxinran 2020-07-28 06:37:37 +08:00
commit dc3a3d8c88
5 changed files with 41 additions and 14 deletions

View File

@ -85,18 +85,20 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
int pid = 0;
int gid = 0;
String channle_id = "";
String bundle_id = "";
String channelS = loginRequest.getChannelS();
String[] splitChannelS = channelS.split("#");
if(splitChannelS.length==1){
if(!StringUtil.isEmpty(splitChannelS[0])){
pid = Integer.valueOf(splitChannelS[0]);
}
// if(!StringUtil.isEmpty(splitChannelS[0])){
// pid = Integer.valueOf(splitChannelS[0]);
// }
}else if (splitChannelS.length>=2){
if(!StringUtil.isEmpty(splitChannelS[0])){
pid = Integer.valueOf(splitChannelS[0]);
channle_id = splitChannelS[0];
}
if(!StringUtil.isEmpty(splitChannelS[1])){
gid = Integer.valueOf(splitChannelS[1]);
bundle_id = splitChannelS[1];
}
}
@ -123,10 +125,10 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
if(split.length>=2){
String openId = split[0];
String chanel = split[1];
user = UserManager.userLogin(userId,openId,chanel,pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS());
user = UserManager.userLogin(userId,openId,chanel,pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS(),channle_id,bundle_id);
}else{
user = UserManager.userLogin(userId,openIdFront,"",pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS());
}
user = UserManager.userLogin(userId,openIdFront,"",pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS(),channle_id,bundle_id);
// String newToken = UserManager.getNewToken(userId);

View File

@ -22,7 +22,7 @@ public class CreateRoleEventHandler extends CommonEventHandler{
setProperties.put("role_name",user.getPlayerInfoManager().getNickName());
setOnceProperties.put("role_create_time",new Date());
setOnceProperties.put("server_id",String.valueOf(GameApplication.serverId));
setOnceProperties.put("channel_id",user.getPlayerInfoManager().getPid());
setOnceProperties.put("channel_id",user.getPlayerInfoManager().getChannel_id());
setOnceProperties.put("platform_id",user.getPlayerInfoManager().getPlatform());
setOnceProperties.put("reg_ip",user.getPlayerInfoManager().getIp());

View File

@ -22,6 +22,10 @@ public class PlayerManager extends MongoBase {
private int gid;
private String channel_id;
private String bundle_id;
private String nickName;
private int sex;
@ -751,4 +755,23 @@ public class PlayerManager extends MongoBase {
this.ip = ip;
updateString("ip",ip);
}
public String getChannel_id() {
return channel_id;
}
public void setChannel_id(String channel_id) {
this.channel_id = channel_id;
updateString("channel_id",channel_id);
}
public String getBundle_id() {
return bundle_id;
}
public void setBundle_id(String bundle_id) {
this.bundle_id = bundle_id;
updateString("bundle_id",bundle_id);
}
}

View File

@ -41,12 +41,12 @@ public class UserManager {
return userMap.containsKey(uid);
}
public static User userLogin(int uid,String openId,String channel,int pid,int gid,String platform,String ip) throws Exception {
public static User userLogin(int uid,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id) throws Exception {
User user = null;
if (!UserManager.isUserExist(uid)){
user = MongoUtil.getInstence().getMyMongoTemplate().findById(User.getCollectionName(), uid, User.class);
if (user == null) {
user = registerUser(uid,openId,channel,pid,gid,platform,ip);
user = registerUser(uid,openId,channel,pid,gid,platform,ip,channle_id,bundle_id);
}
UserManager.addUser(user);
}else{
@ -58,17 +58,17 @@ public class UserManager {
}
private static User registerUser(int uid,String openId,String channel,int pid,int gid,String platform,String ip) throws Exception {
private static User registerUser(int uid,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id) throws Exception {
User user = new User(uid);
UserManager.addUser(user);
initPlayer(user,openId,channel,pid,gid,platform,ip);
initPlayer(user,openId,channel,pid,gid,platform,ip,channle_id,bundle_id);
MongoUtil.getInstence().getMyMongoTemplate().save(user);
PlayerLogic.getInstance().sendTestWelfareMail(user,1,1);
ReportUtil.onReportEvent(user, ReportEventEnum.CREATE_ROLE.getType());
return user;
}
private static void initPlayer(User user,String openId,String channel,int pid,int gid,String platform,String ip) throws Exception {
private static void initPlayer(User user,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id) throws Exception {
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
PlayerManager playerManager = user.getPlayerInfoManager();
long now = TimeUtils.now();
@ -91,6 +91,8 @@ public class UserManager {
playerManager.setGid(gid);
playerManager.setPlatform(platform);
playerManager.setIp(ip);
playerManager.setChannel_id(channle_id);
playerManager.setBundle_id(bundle_id);
playerManager.setHeadFrame(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getDefaultPicture());
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(1);
playerManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy());

View File

@ -359,7 +359,7 @@ public class BuyGoodsLogic {
sendGiftGooodsIndication(uid);
onChargeSuccess(uid,sRechargeCommodityConfig.getPrice(),0);//充值成功上报
Map<Integer, Integer> mapReward = ItemUtil.arrayToMap(baseReward);
ReportUtil.onReportEvent(user, ReportEventEnum.ORDER_COMPLETE.getType(),orderId,price,user.getPlayerInfoManager().getGid(),user.getPlayerInfoManager().getPid(),String.valueOf(GameApplication.serverId),String.valueOf(goodsId),sRechargeCommodityConfig.getName(),mapReward.keySet(),mapReward.values());
ReportUtil.onReportEvent(user, ReportEventEnum.ORDER_COMPLETE.getType(),orderId,price,user.getPlayerInfoManager().getBundle_id(),user.getPlayerInfoManager().getChannel_id(),String.valueOf(GameApplication.serverId),String.valueOf(goodsId),sRechargeCommodityConfig.getName(),mapReward.keySet(),mapReward.values());
return resultRes;
}