兽潮来袭 37数据上报
parent
d83a28c2b3
commit
7e80be3a92
|
|
@ -12,7 +12,7 @@ public class SFloodConfig implements BaseConfig {
|
|||
|
||||
private int monster;
|
||||
|
||||
private int[] reward;
|
||||
private int[][] reward;
|
||||
|
||||
private int battleTime;
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ public class SFloodConfig implements BaseConfig {
|
|||
return monster;
|
||||
}
|
||||
|
||||
public int[] getReward() {
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
package com.ljsd.jieling.config.json;
|
||||
|
||||
public class SDK37Constans {
|
||||
public static String gid = "1006856";
|
||||
public static String pid = "1";
|
||||
public static String appkey = "$5wl2BKfodm4nqxVIC0XeHPb9ZRLQFz?";
|
||||
public static String payKey = "cxSeo5IBl6;kdPOJRgjEYHp9LsQMf+1V";
|
||||
}
|
||||
|
|
@ -1,10 +1,16 @@
|
|||
package com.ljsd.jieling.config.reportData;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.common.mogodb.util.BlockingUniqueQueue;
|
||||
import com.ljsd.jieling.config.json.SDK37Constans;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Report37Param;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Report37RoleLeveBean;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Report37TaskBean;
|
||||
import com.ljsd.jieling.ktbeans.KTParam;
|
||||
import com.ljsd.jieling.ktbeans.KTSendBody;
|
||||
import com.ljsd.jieling.util.http.HttpPool;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -13,25 +19,67 @@ import java.util.concurrent.BlockingQueue;
|
|||
public class DataMessageUtils {
|
||||
|
||||
static final BlockingQueue<Object> logQueue = new BlockingUniqueQueue<>();
|
||||
|
||||
static final BlockingQueue<Object> logQueue_37 = new BlockingUniqueQueue<>(); //37任务、等级数据上报
|
||||
|
||||
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;
|
||||
|
||||
//入队列
|
||||
public static void addLogQueue(Object info){
|
||||
logQueue.offer(info);
|
||||
public static void addLogQueue(Object info) {
|
||||
if (info instanceof KTParam) {
|
||||
logQueue.offer(info);
|
||||
} else if (info instanceof Report37Param) {
|
||||
logQueue_37.offer(info);
|
||||
}
|
||||
}
|
||||
|
||||
public static void manageData() {
|
||||
List<Object> sendDataList = new ArrayList<>(10);
|
||||
logQueue.drainTo(sendDataList,10);
|
||||
if(sendDataList.isEmpty()){
|
||||
logQueue.drainTo(sendDataList, 10);
|
||||
|
||||
List<Object> sendData37List = new ArrayList<>(10);
|
||||
logQueue_37.drainTo(sendData37List, 10);
|
||||
|
||||
if (!sendDataList.isEmpty()) {
|
||||
KTSendBody sendBody = new KTSendBody(sendDataList);
|
||||
HttpPool.sendPost(sendUrl, gson.toJson(sendBody));
|
||||
}
|
||||
|
||||
if (!sendData37List.isEmpty()) {
|
||||
|
||||
for (Object object : sendData37List) {
|
||||
String sendToUrl;
|
||||
List<BasicNameValuePair> sendForm = new ArrayList<>();
|
||||
if (object instanceof Report37TaskBean) {
|
||||
sendToUrl = sendTaskUrl37;
|
||||
sendForm = ((Report37TaskBean) object).getPairList();
|
||||
} else if (object instanceof Report37RoleLeveBean) {
|
||||
sendToUrl = sendRoleUrl37;
|
||||
sendForm = ((Report37RoleLeveBean) object).getPairList();
|
||||
} else {
|
||||
sendToUrl = "";
|
||||
}
|
||||
try {
|
||||
HttpPool.sendPostForm(sendToUrl, new UrlEncodedFormEntity(sendForm, "utf-8"));
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (sendDataList.isEmpty() && sendData37List.isEmpty()) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
return;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
KTSendBody sendBody = new KTSendBody(sendDataList);
|
||||
HttpPool.sendPost(sendUrl,gson.toJson(sendBody));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
package com.ljsd.jieling.dataReport.reportBeans_37;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.json.SDK37Constans;
|
||||
|
||||
public abstract class Report37Bean implements Report37Param{
|
||||
|
||||
private int pid;
|
||||
private int gid;
|
||||
private int event_time;
|
||||
private String zone_id;
|
||||
private String zone_name;
|
||||
|
||||
public Report37Bean() {
|
||||
this.pid = Integer.valueOf(SDK37Constans.pid);
|
||||
this.gid = Integer.valueOf(SDK37Constans.gid);
|
||||
this.event_time = (int)(System.currentTimeMillis()/1000);
|
||||
this.zone_id = String.valueOf(GameApplication.serverId);
|
||||
this.zone_name = String.valueOf(GameApplication.serverId);
|
||||
}
|
||||
|
||||
public int getEvent_time() {
|
||||
return event_time;
|
||||
}
|
||||
|
||||
public String getZone_id() {
|
||||
return zone_id;
|
||||
}
|
||||
|
||||
public String getZone_name() {
|
||||
return zone_name;
|
||||
}
|
||||
|
||||
public void setEvent_time(int event_time) {
|
||||
this.event_time = event_time;
|
||||
}
|
||||
|
||||
public int getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(int pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public int getGid() {
|
||||
return gid;
|
||||
}
|
||||
|
||||
public void setGid(int gid) {
|
||||
this.gid = gid;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.ljsd.jieling.dataReport.reportBeans_37;
|
||||
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface Report37Param {
|
||||
List<BasicNameValuePair> getPairList();
|
||||
}
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
package com.ljsd.jieling.dataReport.reportBeans_37;
|
||||
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Report37RoleLeveBean extends Report37Bean{
|
||||
|
||||
private String uid;
|
||||
private String roleid;
|
||||
private String sign;
|
||||
private String role_type;
|
||||
private String role_name;
|
||||
private String role_c_time;
|
||||
private int role_grade;
|
||||
private String role_grade_desc;
|
||||
private String role_grade_u_time;
|
||||
private String balance;
|
||||
private String total_pay_amount;
|
||||
private long total_online_time;
|
||||
private String guild_id;
|
||||
private String guild_name;
|
||||
|
||||
@Override
|
||||
public List<BasicNameValuePair> getPairList() {
|
||||
List<BasicNameValuePair> pairList = new ArrayList<>();
|
||||
pairList.add(new BasicNameValuePair("uid", getUid()));
|
||||
pairList.add(new BasicNameValuePair("roleid", getRoleid()));
|
||||
pairList.add(new BasicNameValuePair("role_type", getRole_type()));
|
||||
pairList.add(new BasicNameValuePair("role_name", getRole_name()));
|
||||
pairList.add(new BasicNameValuePair("role_c_time", getRole_c_time()));
|
||||
pairList.add(new BasicNameValuePair("role_grade", String.valueOf(getRole_grade())));
|
||||
pairList.add(new BasicNameValuePair("role_grade_desc", getRole_grade_desc()));
|
||||
pairList.add(new BasicNameValuePair("role_grade_u_time", getRole_grade_u_time()));
|
||||
pairList.add(new BasicNameValuePair("balance", getBalance()));
|
||||
pairList.add(new BasicNameValuePair("total_pay_amount", getTotal_pay_amoun()));
|
||||
pairList.add(new BasicNameValuePair("total_online_time", String.valueOf(getTotal_online_time())));
|
||||
pairList.add(new BasicNameValuePair("guild_id", getGuild_id()));
|
||||
pairList.add(new BasicNameValuePair("guild_name", getGuild_name()));
|
||||
pairList.add(new BasicNameValuePair("sign", getSign()));
|
||||
pairList.add(new BasicNameValuePair("event_time", String.valueOf(getEvent_time())));
|
||||
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()));
|
||||
return pairList;
|
||||
}
|
||||
|
||||
public Report37RoleLeveBean() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getRoleid() {
|
||||
return roleid;
|
||||
}
|
||||
|
||||
public void setRoleid(String roleid) {
|
||||
this.roleid = roleid;
|
||||
}
|
||||
|
||||
public String getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void setSign(String sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
public String getRole_type() {
|
||||
return role_type;
|
||||
}
|
||||
|
||||
public void setRole_type(String role_type) {
|
||||
this.role_type = role_type;
|
||||
}
|
||||
|
||||
public String getRole_name() {
|
||||
return role_name;
|
||||
}
|
||||
|
||||
public void setRole_name(String role_name) {
|
||||
this.role_name = role_name;
|
||||
}
|
||||
|
||||
public String getRole_c_time() {
|
||||
return role_c_time;
|
||||
}
|
||||
|
||||
public void setRole_c_time(String role_c_time) {
|
||||
this.role_c_time = role_c_time;
|
||||
}
|
||||
|
||||
public int getRole_grade() {
|
||||
return role_grade;
|
||||
}
|
||||
|
||||
public void setRole_grade(int role_grade) {
|
||||
this.role_grade = role_grade;
|
||||
}
|
||||
|
||||
public String getRole_grade_desc() {
|
||||
return role_grade_desc;
|
||||
}
|
||||
|
||||
public void setRole_grade_desc(String role_grade_desc) {
|
||||
this.role_grade_desc = role_grade_desc;
|
||||
}
|
||||
|
||||
public String getRole_grade_u_time() {
|
||||
return role_grade_u_time;
|
||||
}
|
||||
|
||||
public void setRole_grade_u_time(String role_grade_u_time) {
|
||||
this.role_grade_u_time = role_grade_u_time;
|
||||
}
|
||||
|
||||
public String getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(String balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public String getTotal_pay_amoun() {
|
||||
return total_pay_amount;
|
||||
}
|
||||
|
||||
public void setTotal_pay_amoun(String total_pay_amoun) {
|
||||
this.total_pay_amount = total_pay_amoun;
|
||||
}
|
||||
|
||||
public long getTotal_online_time() {
|
||||
return total_online_time;
|
||||
}
|
||||
|
||||
public void setTotal_online_time(long total_online_time) {
|
||||
this.total_online_time = total_online_time;
|
||||
}
|
||||
|
||||
public String getGuild_id() {
|
||||
return guild_id;
|
||||
}
|
||||
|
||||
public void setGuild_id(String guild_id) {
|
||||
this.guild_id = guild_id;
|
||||
}
|
||||
|
||||
public String getGuild_name() {
|
||||
return guild_name;
|
||||
}
|
||||
|
||||
public void setGuild_name(String guild_name) {
|
||||
this.guild_name = guild_name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.ljsd.jieling.dataReport.reportBeans_37;
|
||||
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Report37TaskBean extends Report37Bean {
|
||||
|
||||
private String uid;
|
||||
private String roleid;
|
||||
private String task_id;
|
||||
private String task_name;
|
||||
private int status;
|
||||
private String sign;
|
||||
|
||||
|
||||
public Report37TaskBean() {
|
||||
super();
|
||||
this.status = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicNameValuePair> getPairList() {
|
||||
List<BasicNameValuePair> pairList = new ArrayList<>();
|
||||
pairList.add(new BasicNameValuePair("uid", getUid()));
|
||||
pairList.add(new BasicNameValuePair("roleid", getRoleid()));
|
||||
pairList.add(new BasicNameValuePair("task_id", getTask_id()));
|
||||
pairList.add(new BasicNameValuePair("task_name", getTask_name()));
|
||||
pairList.add(new BasicNameValuePair("status", String.valueOf(getStatus())));
|
||||
pairList.add(new BasicNameValuePair("sign", getSign()));
|
||||
pairList.add(new BasicNameValuePair("event_time", String.valueOf(getEvent_time())));
|
||||
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()));
|
||||
return pairList;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
|
||||
public String getRoleid() {
|
||||
return roleid;
|
||||
}
|
||||
|
||||
public void setRoleid(String roleid) {
|
||||
this.roleid = roleid;
|
||||
}
|
||||
|
||||
public String getTask_id() {
|
||||
return task_id;
|
||||
}
|
||||
|
||||
public void setTask_id(String task_id) {
|
||||
this.task_id = task_id;
|
||||
}
|
||||
|
||||
public String getTask_name() {
|
||||
return task_name;
|
||||
}
|
||||
|
||||
public void setTask_name(String task_name) {
|
||||
this.task_name = task_name;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void setSign(String sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.ljsd.jieling.dataReport.reportBeans_37;
|
||||
|
||||
import com.ljsd.jieling.config.json.SDK37Constans;
|
||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.MD5Util;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
|
||||
public class Repot37EventUtil {
|
||||
|
||||
public static void onKtEvent(User user, Report37EventType eventType, Object... parm) {
|
||||
|
||||
switch (eventType) {
|
||||
case TASK_FINISH_EVEMT:
|
||||
Report37TaskBean report37TaskBean = new Report37TaskBean();
|
||||
report37TaskBean.setUid(String.valueOf(user.getPlayerInfoManager().getOpenId()));
|
||||
report37TaskBean.setRoleid(String.valueOf(user.getId()));
|
||||
int taskId = (int) parm[0];
|
||||
String taskName = String.valueOf(parm[1]);
|
||||
report37TaskBean.setTask_id(String.valueOf(taskId));//todo
|
||||
report37TaskBean.setTask_name(taskName);
|
||||
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);
|
||||
break;
|
||||
case ROLE_LEVEUP_EVENT:
|
||||
Report37RoleLeveBean report37RoleLeveBean = new Report37RoleLeveBean();
|
||||
report37RoleLeveBean.setUid(String.valueOf(user.getPlayerInfoManager().getOpenId()));
|
||||
report37RoleLeveBean.setRoleid(String.valueOf(user.getId()));
|
||||
report37RoleLeveBean.setRole_type("1");
|
||||
report37RoleLeveBean.setRole_name(user.getPlayerInfoManager().getNickName());
|
||||
report37RoleLeveBean.setRole_c_time(TimeUtils.getTimeStamp(user.getPlayerInfoManager().getCreateTime()));
|
||||
report37RoleLeveBean.setRole_grade(user.getPlayerInfoManager().getLevel());
|
||||
report37RoleLeveBean.setRole_grade_u_time(TimeUtils.getTimeStamp(System.currentTimeMillis()));
|
||||
report37RoleLeveBean.setRole_grade_desc("null");
|
||||
report37RoleLeveBean.setBalance("null");//todo
|
||||
report37RoleLeveBean.setTotal_pay_amoun(String.valueOf(user.getPlayerInfoManager().getRechargeInfo().getSaveAmt()*100));
|
||||
report37RoleLeveBean.setTotal_online_time(user.getPlayerInfoManager().getOnlineTime());
|
||||
report37RoleLeveBean.setGuild_id("");//todo
|
||||
report37RoleLeveBean.setGuild_name("0");//todo
|
||||
String signSt = report37RoleLeveBean.getEvent_time() + report37RoleLeveBean.getUid() + report37RoleLeveBean.getZone_id() + report37RoleLeveBean.getRoleid() + SDK37Constans.appkey;
|
||||
report37RoleLeveBean.setSign(MD5Util.encrypByMd5(signSt));
|
||||
DataMessageUtils.addLogQueue(report37RoleLeveBean);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum Report37EventType {
|
||||
ROLE_LEVEUP_EVENT,//角色升级
|
||||
TASK_FINISH_EVEMT //任务完成
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.handler.map;
|
|||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
|
|
@ -2197,23 +2198,18 @@ public class MapLogic {
|
|||
/**
|
||||
* 结束战斗
|
||||
*/
|
||||
public void endMonsterAttackFight(ISession session, String frames, int fightId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
public void endMonsterAttackFight(ISession session, String frames, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
String fightKey = RedisKey.getKey(RedisKey.CHALLENGE_MONSTER_INFO, String.valueOf(uid), false);
|
||||
String fightInfos = (String) RedisUtil.getInstence().get(fightKey);
|
||||
if (fightInfos.isEmpty()) {
|
||||
LOGGER.info("endFight() uid=>{} fightKey={},fightId={} fightInfos == null", uid, fightKey, fightId);
|
||||
LOGGER.info("endFight() uid=>{} fightKey={},fightId={} fightInfos == null", uid, fightKey);
|
||||
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
String[] split = fightInfos.split("#");
|
||||
int checkFightId = Integer.parseInt(split[0]);
|
||||
if (fightId != checkFightId) {
|
||||
LOGGER.info("endFight() uid=>{} fightId=>{},checkFightId={}", uid, fightId, checkFightId);
|
||||
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
|
||||
String key = RedisKey.getKey(RedisKey.CHALLENGE_MONSTER_ATTACK, Integer.toString(user.getId()), false);
|
||||
Map<Object, Object> valueMap = RedisUtil.getInstence().hmget(key);
|
||||
|
|
@ -2230,9 +2226,9 @@ public class MapLogic {
|
|||
CommonProto.FightTeamInfo fightTeamInfo = builder.build();
|
||||
List<CommonProto.FightTeamInfo> monsterTeamList = BehaviorUtil.getFightTeamInfos(valueMap);
|
||||
|
||||
SFloodConfig sFloodConfig = STableManager.getConfig(SFloodConfig.class).get(fightId);
|
||||
SFloodConfig sFloodConfig = STableManager.getConfig(SFloodConfig.class).get(checkFightId);
|
||||
if (sFloodConfig == null) {
|
||||
LOGGER.info("endFight() uid=>{} fightId=>{} SLevelDifficultyConfig == null", uid, fightId);
|
||||
LOGGER.info("endFight() uid=>{} fightId=>{} SLevelDifficultyConfig == null", uid, checkFightId);
|
||||
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
|
|
@ -2258,16 +2254,20 @@ public class MapLogic {
|
|||
return;
|
||||
}
|
||||
|
||||
//排行榜
|
||||
String rankKey = RedisKey.getKey(RedisKey.MONSTER_ATTACK_RANK,"", false);
|
||||
RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), checkFightId+1);
|
||||
|
||||
//归还水滴
|
||||
Map<Integer,Integer> itemMap = new HashMap<>(1);
|
||||
itemMap.put( Global.DROP,1);
|
||||
ItemUtil.addItem(user,itemMap,null,BIReason.MONSTERATTACK_BACK);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sFloodConfig.getReward(), 1, 0, BIReason.MONSTERATTACK_REWARD);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sFloodConfig.getReward(), BIReason.MONSTERATTACK_REWARD);
|
||||
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
|
||||
fightEndResponse.setEnventDrop(drop);
|
||||
fightEndResponse.setResult(resultCode);
|
||||
fightEndResponse.build();
|
||||
user.getMapManager().setLastMonsterAttack(fightId < STableManager.getConfig(SFloodConfig.class).size() ? fightId + 1 : fightId);
|
||||
user.getMapManager().setLastMonsterAttack(checkFightId + 1);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
}
|
||||
|
||||
|
|
@ -2331,6 +2331,7 @@ public class MapLogic {
|
|||
curExp = curExp - sPlayerLevelConfig.getExp();
|
||||
}
|
||||
}
|
||||
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.ROLE_LEVEUP_EVENT);
|
||||
}
|
||||
playerInfoManager.setExp(curExp);
|
||||
int itemNum = 0;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class FightEndRequestHandler extends BaseHandler {
|
|||
}else if(type == 3){
|
||||
MapLogic.getInstance().endSuddlenlyFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
}else if(type == 5){
|
||||
MapLogic.getInstance().endMonsterAttackFight(iSession, frames,fightId,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
MapLogic.getInstance().endMonsterAttackFight(iSession, frames,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
} else {
|
||||
// MapLogic.getInstance().endFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private int rechargedaily;
|
||||
|
||||
private int onlineTime;
|
||||
private long onlineTime;
|
||||
|
||||
private Set<Integer> fixIds = new CopyOnWriteArraySet<>();
|
||||
|
||||
|
|
@ -425,11 +425,11 @@ public class PlayerManager extends MongoBase {
|
|||
this.fixIds = fixIds;
|
||||
}
|
||||
|
||||
public int getOnlineTime() {
|
||||
public long getOnlineTime() {
|
||||
return onlineTime;
|
||||
}
|
||||
|
||||
public void addOnlineTime(int onlineTime) {
|
||||
public void addOnlineTime(long onlineTime) {
|
||||
this.onlineTime += onlineTime;
|
||||
updateString("onlineTime", this.onlineTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.mission;
|
|||
|
||||
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.map.CrossInfo;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
|
|
@ -314,6 +315,7 @@ public class MissionLoigc {
|
|||
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
|
||||
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -327,6 +329,7 @@ public class MissionLoigc {
|
|||
int score = STreasureTaskConfig.sTreasureTaskConfigMap.get(missionId).getPoints() * takeTimes;
|
||||
user.getPlayerInfoManager().addTreasureScore(score);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
|
||||
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
|
||||
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setTreasureScore(user.getPlayerInfoManager().getTreasureScore()).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
|
||||
return;
|
||||
|
|
@ -343,6 +346,7 @@ public class MissionLoigc {
|
|||
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
|
||||
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
|
||||
}else{
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,"mission can not get reward");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,6 +344,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
playerInfoManager.setOffLineTime(TimeUtils.now());
|
||||
long onlineTime = playerInfoManager.getOffLineTime() - playerInfoManager.getLoginTime();
|
||||
playerInfoManager.addOnlineTime(onlineTime);
|
||||
//更新在线时长
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.OnlineReward,(int)(onlineTime/TimeUtils.ONE_SECOND));
|
||||
GuildLogic.updateMyPos(user);
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class TimeUtils {
|
|||
/**
|
||||
* 年月日 时分秒, 格式如: 20110111011059
|
||||
*/
|
||||
// private static final DateFormat ymdhmsFormat_new = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
private static final DateFormat ymdhmsFormat_new = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
/**
|
||||
* 年月日 时分, 格式如: 2011-01-11 01:10
|
||||
*/
|
||||
|
|
@ -260,6 +260,17 @@ public class TimeUtils {
|
|||
return _format.format(date);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取时间戳字符串yyyyMMDDHHmmss
|
||||
*/
|
||||
public static String getTimeStamp(Long time) {
|
||||
Date data = new Date(time);
|
||||
return ymdhmsFormat_new.format(data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 是否是同一天
|
||||
// *
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.ktbeans.KTSendBody;
|
|||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
|
|
@ -36,6 +37,44 @@ public class HttpPool {
|
|||
return RequestConfig.custom().setSocketTimeout(5000).setConnectTimeout(50000).setConnectionRequestTimeout(5000).build();
|
||||
|
||||
}
|
||||
public static void sendPostForm(String url, UrlEncodedFormEntity info) {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
HttpResponse httpResponse;
|
||||
int sendTimes = 0;
|
||||
do {
|
||||
try {
|
||||
httpPost.setEntity(info);
|
||||
httpPost.setConfig(getRequestConfig());
|
||||
httpPost.setHeader("Content-Type","application/x-www-form-urlencoded");
|
||||
httpResponse = httpclient.execute(httpPost);
|
||||
HttpEntity responseEntity = httpResponse.getEntity();
|
||||
EntityUtils.consume(responseEntity);
|
||||
int statusCode = httpResponse.getStatusLine().getStatusCode();
|
||||
if (statusCode >= 200 && statusCode < 300) {
|
||||
LOGGER.debug("Http sendPostForm,第" + (sendTimes + 1) + "次调用成功,返回码为:[" + statusCode + "]");
|
||||
break;
|
||||
} else {
|
||||
LOGGER.error("Http sendPostForm,第" + (sendTimes + 1) + "次调用出错,返回码为:[" + statusCode + "]");
|
||||
if (sendTimes + 1 <= maxSendTimes) {
|
||||
LOGGER.debug("Http sendPostForm," + (sendIntervalTime / 1000) + "秒后,重新发起请求...");
|
||||
try {
|
||||
Thread.sleep(sendIntervalTime);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
LOGGER.debug("Http sendPostForm,达到重发最大次数,退出程序!");
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Http Send error",e);
|
||||
}finally {
|
||||
sendTimes ++ ;
|
||||
}
|
||||
} while (sendTimes < maxSendTimes);
|
||||
|
||||
}
|
||||
|
||||
public static void sendPost(String url, String info) {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
HttpResponse httpResponse;
|
||||
|
|
@ -46,13 +85,16 @@ public class HttpPool {
|
|||
StringEntity stringEntity = new StringEntity(info, charset);
|
||||
httpPost.setEntity(stringEntity);
|
||||
httpPost.setConfig(getRequestConfig());
|
||||
httpPost.setHeader("Content-Type","application/json;charset=utf-8");
|
||||
|
||||
httpPost.setHeader("Content-Type","application/json;charset=utf-8");
|
||||
|
||||
httpResponse = httpclient.execute(httpPost);
|
||||
HttpEntity responseEntity = httpResponse.getEntity();
|
||||
EntityUtils.consume(responseEntity);
|
||||
int statusCode = httpResponse.getStatusLine().getStatusCode();
|
||||
if (statusCode >= 200 && statusCode < 300) {
|
||||
needBack = false;
|
||||
|
||||
LOGGER.debug("Http Send,第" + (sendTimes + 1) + "次调用成功,返回码为:[" + statusCode + "]");
|
||||
break;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue