获取gid
parent
0d4e4ee5fd
commit
0a9c1f7e2a
|
|
@ -15,10 +15,10 @@ import com.ljsd.jieling.util.http.HttpPool;
|
|||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import util.StringUtil;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
public class DataMessageUtils {
|
||||
|
|
@ -29,8 +29,11 @@ public class DataMessageUtils {
|
|||
|
||||
private static Gson gson = new Gson();
|
||||
private static final String sendUrl = "https://gskuld.receiver.extranet.kt007.com:8081/skuld/game/common/";
|
||||
private static final String sendTaskUrl37 = "http://pvt.api.m.37.com/hd/postTaskInfo/" + SDK37Constans.pid + "/" + SDK37Constans.gid;
|
||||
private static final String sendRoleUrl37 = "http://pvt.api.m.37.com/report/roleChangeReport/" + SDK37Constans.pid + "/" + SDK37Constans.gid;
|
||||
private static final Map<Long,String> sendTaskUrl37Map = new HashMap<>();
|
||||
private static final String sendTaskUrl37 = "http://pvt.api.m.37.com/hd/postTaskInfo/" ;
|
||||
private static final Map<Long,String> sendRoleUrl37Map = new HashMap<>();
|
||||
private static final String sendRoleUrl37 = "http://pvt.api.m.37.com/report/roleChangeReport/";
|
||||
|
||||
private static final String sendChatContent37 = "http://cm3.api.37.com.cn/Content/_checkContent/";
|
||||
//入队列
|
||||
public static void addLogQueue(Object info) {
|
||||
|
|
@ -59,16 +62,29 @@ public class DataMessageUtils {
|
|||
String sendToUrl;
|
||||
List<BasicNameValuePair> sendForm = new ArrayList<>();
|
||||
if (object instanceof Report37TaskBean) {
|
||||
sendToUrl = sendTaskUrl37;
|
||||
long key =(long)((Report37TaskBean) object).getGid()*10000+((Report37TaskBean) object).getPid();
|
||||
sendToUrl = sendTaskUrl37Map.get((long)((Report37TaskBean) object).getGid()*10000+((Report37TaskBean) object).getPid());
|
||||
if(sendToUrl==null){
|
||||
sendToUrl = sendTaskUrl37 + ((Report37TaskBean) object).getPid() + "/" + ((Report37TaskBean) object).getGid();
|
||||
sendTaskUrl37Map.put(key,sendToUrl);
|
||||
}
|
||||
sendForm = ((Report37TaskBean) object).getPairList();
|
||||
} else if (object instanceof Report37RoleLeveBean) {
|
||||
long key =(long)((Report37RoleLeveBean) object).getGid()*10000+((Report37RoleLeveBean) object).getPid();
|
||||
sendToUrl = sendRoleUrl37Map.get((long)((Report37RoleLeveBean) object).getGid()*10000+((Report37RoleLeveBean) object).getPid());
|
||||
if(sendToUrl==null){
|
||||
sendToUrl = sendRoleUrl37 + ((Report37RoleLeveBean) object).getPid() + "/" + ((Report37RoleLeveBean) object).getGid();
|
||||
sendRoleUrl37Map.put(key,sendToUrl);
|
||||
}
|
||||
sendToUrl = sendRoleUrl37;
|
||||
sendForm = ((Report37RoleLeveBean) object).getPairList();
|
||||
} else {
|
||||
sendToUrl = "";
|
||||
}
|
||||
try {
|
||||
HttpPool.sendPostForm(sendToUrl, new UrlEncodedFormEntity(sendForm, "utf-8"));
|
||||
if(!StringUtil.isEmpty(sendToUrl)){
|
||||
HttpPool.sendPostForm(sendToUrl, new UrlEncodedFormEntity(sendForm, "utf-8"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ public abstract class Report37Bean implements Report37Param{
|
|||
private String zone_name;
|
||||
|
||||
public Report37Bean() {
|
||||
this.pid = Integer.valueOf(SDK37Constans.pid);
|
||||
this.gid = Integer.valueOf(SDK37Constans.gid);
|
||||
this.pid = 0;
|
||||
this.gid = 0;
|
||||
this.event_time = (int)(System.currentTimeMillis()/1000);
|
||||
this.zone_id = String.valueOf(GameApplication.serverId);
|
||||
this.zone_name = String.valueOf(GameApplication.serverId);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class Report37RoleLeveBean extends Report37Bean{
|
|||
pairList.add(new BasicNameValuePair("zone_id", getZone_id()));
|
||||
pairList.add(new BasicNameValuePair("zone_name", getZone_id()));
|
||||
pairList.add(new BasicNameValuePair("pid", String.valueOf(getPid())));
|
||||
pairList.add(new BasicNameValuePair("gid", getZone_id()));
|
||||
pairList.add(new BasicNameValuePair("gid", String.valueOf(getGid())));
|
||||
return pairList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class Report37TaskBean extends Report37Bean {
|
|||
pairList.add(new BasicNameValuePair("zone_id", getZone_id()));
|
||||
pairList.add(new BasicNameValuePair("zone_name", getZone_id()));
|
||||
pairList.add(new BasicNameValuePair("pid", String.valueOf(getPid())));
|
||||
pairList.add(new BasicNameValuePair("gid", getZone_id()));
|
||||
pairList.add(new BasicNameValuePair("gid", String.valueOf(getGid())));
|
||||
return pairList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ public class Repot37EventUtil {
|
|||
String taskName = String.valueOf(parm[1]);
|
||||
report37TaskBean.setTask_id(String.valueOf(taskId));//todo
|
||||
report37TaskBean.setTask_name(taskName);
|
||||
report37TaskBean.setGid(user.getPlayerInfoManager().getGid());
|
||||
report37TaskBean.setPid(user.getPlayerInfoManager().getPid());
|
||||
String signStr = report37TaskBean.getEvent_time() + report37TaskBean.getUid() + report37TaskBean.getZone_id() + report37TaskBean.getRoleid() + report37TaskBean.getTask_id()+SDK37Constans.appkey;
|
||||
report37TaskBean.setSign(MD5Util.encrypByMd5(signStr));
|
||||
DataMessageUtils.addLogQueue(report37TaskBean);
|
||||
|
|
@ -45,14 +47,13 @@ public class Repot37EventUtil {
|
|||
report37RoleLeveBean.setTotal_online_time(user.getPlayerInfoManager().getOnlineTime());
|
||||
report37RoleLeveBean.setGuild_id("");//todo
|
||||
report37RoleLeveBean.setGuild_name("0");//todo
|
||||
report37RoleLeveBean.setGid(user.getPlayerInfoManager().getGid());
|
||||
report37RoleLeveBean.setPid(user.getPlayerInfoManager().getPid());
|
||||
String signSt = report37RoleLeveBean.getEvent_time() + report37RoleLeveBean.getUid() + report37RoleLeveBean.getZone_id() + report37RoleLeveBean.getRoleid() + SDK37Constans.appkey;
|
||||
report37RoleLeveBean.setSign(MD5Util.encrypByMd5(signSt));
|
||||
DataMessageUtils.addLogQueue(report37RoleLeveBean);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static <T> T hadResReport(Class<T> clazz,User user, Report37EventType eventType, Object... parm){
|
||||
switch (eventType) {
|
||||
|
|
@ -63,8 +64,8 @@ public class Repot37EventUtil {
|
|||
report37CheckChat.setUid(String.valueOf(user.getPlayerInfoManager().getOpenId()));//uid
|
||||
report37CheckChat.setActor_name(user.getPlayerInfoManager().getNickName());
|
||||
report37CheckChat.setActor_id(String.valueOf(user.getId()));
|
||||
report37CheckChat.setGid(SDK37Constans.gid);
|
||||
report37CheckChat.setPid(SDK37Constans.pid);
|
||||
report37CheckChat.setGid(String.valueOf(user.getPlayerInfoManager().getGid()));
|
||||
report37CheckChat.setPid(String.valueOf(user.getPlayerInfoManager().getPid()));
|
||||
report37CheckChat.setDsid(String.valueOf(GameApplication.serverId));
|
||||
report37CheckChat.setType(parm[0].toString());//类型
|
||||
report37CheckChat.setContent(parm[1].toString());//内容
|
||||
|
|
|
|||
|
|
@ -192,6 +192,8 @@ public class RedisKey {
|
|||
public final static String CDKEY = "CDKEY";
|
||||
public final static String GLOBAL_SYS_PRO = "GLOBAL_SYS_PRO";
|
||||
|
||||
public final static String PIDGIDTEMP = "PIDGIDTEMP";
|
||||
|
||||
|
||||
public static Set<String> familyKey = new HashSet<>();
|
||||
static {
|
||||
|
|
|
|||
|
|
@ -99,6 +99,20 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
}
|
||||
}
|
||||
|
||||
//临时代码 等前端出新包后删除2019 11 29
|
||||
if(gid==0){
|
||||
try {
|
||||
String value = RedisUtil.getInstence().getKey(RedisKey.PIDGIDTEMP, Integer.toString(userId));
|
||||
|
||||
String[] splitvalue = value.split("#");
|
||||
if (splitChannelS.length==2){
|
||||
pid = Integer.valueOf(splitvalue[0]);
|
||||
gid = Integer.valueOf(splitvalue[1]);
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
}
|
||||
|
||||
LOGGER.info("the uid={},the channel={},,the pid={}",userId,pid,gid);
|
||||
//登陆注册入内存
|
||||
String openIdFront = loginRequest.getOpenId();
|
||||
|
|
@ -107,9 +121,9 @@ 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);
|
||||
user = UserManager.userLogin(userId,openId,chanel,pid,gid);
|
||||
}else{
|
||||
user = UserManager.userLogin(userId,openIdFront,"",pid);
|
||||
user = UserManager.userLogin(userId,openIdFront,"",pid,gid);
|
||||
}
|
||||
|
||||
// String newToken = UserManager.getNewToken(userId);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private int pid;
|
||||
|
||||
private int gid;
|
||||
|
||||
private String nickName;
|
||||
|
||||
private int level;
|
||||
|
|
@ -497,6 +499,7 @@ public class PlayerManager extends MongoBase {
|
|||
this.phoneBindInfo = phoneBindInfo;
|
||||
}
|
||||
|
||||
|
||||
public void setPid(int pid) {
|
||||
updateString("pid",pid);
|
||||
this.pid = pid;
|
||||
|
|
@ -506,6 +509,14 @@ public class PlayerManager extends MongoBase {
|
|||
return pid;
|
||||
}
|
||||
|
||||
public int getGid() {
|
||||
return gid;
|
||||
}
|
||||
|
||||
public void setGid(int gid) {
|
||||
updateString("gid",gid);
|
||||
this.gid = gid;
|
||||
}
|
||||
|
||||
public Set<Integer> getSysMailIds() {
|
||||
return sysMailIds;
|
||||
|
|
|
|||
|
|
@ -38,12 +38,12 @@ public class UserManager {
|
|||
return userMap.containsKey(uid);
|
||||
}
|
||||
|
||||
public static User userLogin(int uid,String openId,String channel,int pid) throws Exception {
|
||||
public static User userLogin(int uid,String openId,String channel,int pid,int gid) 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);
|
||||
user = registerUser(uid,openId,channel,pid,gid);
|
||||
}
|
||||
UserManager.addUser(user);
|
||||
}else{
|
||||
|
|
@ -53,16 +53,16 @@ public class UserManager {
|
|||
}
|
||||
|
||||
|
||||
private static User registerUser(int uid,String openId,String channel,int pid) throws Exception {
|
||||
private static User registerUser(int uid,String openId,String channel,int pid,int gid) throws Exception {
|
||||
User user = new User(uid);
|
||||
initPlayer(user,openId,channel,pid);
|
||||
initPlayer(user,openId,channel,pid,gid);
|
||||
UserManager.addUser(user);
|
||||
MongoUtil.getInstence().getMyMongoTemplate().save(user);
|
||||
PlayerLogic.getInstance().sendTestWelfareMail(user,1,1);
|
||||
return user;
|
||||
}
|
||||
|
||||
private static void initPlayer(User user,String openId,String channel,int pid) throws Exception {
|
||||
private static void initPlayer(User user,String openId,String channel,int pid,int gid) throws Exception {
|
||||
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
|
||||
PlayerManager playerManager = user.getPlayerInfoManager();
|
||||
long now = TimeUtils.now();
|
||||
|
|
@ -81,6 +81,7 @@ public class UserManager {
|
|||
playerManager.setPhoneBindInfo(new PhoneBindInfo(""));
|
||||
playerManager.setChannel(channel);
|
||||
playerManager.setPid(pid);
|
||||
playerManager.setGid(gid);
|
||||
playerManager.setHeadFrame(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getDefaultPicture());
|
||||
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(1);
|
||||
playerManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy());
|
||||
|
|
|
|||
Loading…
Reference in New Issue