Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
edd814a97d
|
@ -12,9 +12,9 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public enum ReportEventEnum {
|
public enum ReportEventEnum {
|
||||||
|
|
||||||
CREATE_ACCOUNT(1,"create_account", new CreateRoleEventHanlder(),new String[]{""}),
|
CREATE_ACCOUNT(1,"create_account", new CreateRoleEventHandler(),new String[]{""}),
|
||||||
APP_LOGIN(2,"app_login", new LoginEventHandler(),new String[]{""}),
|
APP_LOGIN(2,"app_login", new LoginEventHandler(),new String[]{""}),
|
||||||
CREATE_ROLE(3,"create_role ", new CommonEventHandler(),new String[]{"role_name"}),
|
CREATE_ROLE(3,"create_role ", new CreateRoleEventHandler(),new String[]{"role_name"}),
|
||||||
GUILD(4,"guild", new CommonEventHandler(),new String[]{"step_id","step_name","rewards_list","guild_start_time"}),
|
GUILD(4,"guild", new CommonEventHandler(),new String[]{"step_id","step_name","rewards_list","guild_start_time"}),
|
||||||
LEVEL_UP(5,"level_up", new UserLevelUpEventHandler(),new String[]{"promotion_level","improved_level"}),
|
LEVEL_UP(5,"level_up", new UserLevelUpEventHandler(),new String[]{"promotion_level","improved_level"}),
|
||||||
MISSION_START(6,"mission_start", new CommonEventHandler(),new String[]{"mission_id","mission_name"}),
|
MISSION_START(6,"mission_start", new CommonEventHandler(),new String[]{"mission_id","mission_name"}),
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.ktbeans;
|
||||||
|
|
||||||
import cn.thinkingdata.tga.javasdk.ThinkingDataAnalytics;
|
import cn.thinkingdata.tga.javasdk.ThinkingDataAnalytics;
|
||||||
import com.ljsd.GameApplication;
|
import com.ljsd.GameApplication;
|
||||||
|
import com.ljsd.common.mogodb.util.BlockingUniqueQueue;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||||
|
@ -12,6 +13,7 @@ import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lvxinran
|
* @author lvxinran
|
||||||
|
@ -25,6 +27,8 @@ public class ReportUtil {
|
||||||
|
|
||||||
private static ThinkingDataAnalytics ta = new ThinkingDataAnalytics(new ThinkingDataAnalytics.LoggerConsumer(LOG_PATH));
|
private static ThinkingDataAnalytics ta = new ThinkingDataAnalytics(new ThinkingDataAnalytics.LoggerConsumer(LOG_PATH));
|
||||||
|
|
||||||
|
public static BlockingQueue<ReportUserEvent> queue = new BlockingUniqueQueue<>();
|
||||||
|
|
||||||
public static final int COIN_ID = 14;
|
public static final int COIN_ID = 14;
|
||||||
|
|
||||||
public static final int DIAMOND_ID = 16;
|
public static final int DIAMOND_ID = 16;
|
||||||
|
@ -52,8 +56,9 @@ public class ReportUtil {
|
||||||
reportUserEvent.setEventInfo(eventProperties);
|
reportUserEvent.setEventInfo(eventProperties);
|
||||||
//设置事件名称
|
//设置事件名称
|
||||||
reportUserEvent.setEventName(report.getEventName());
|
reportUserEvent.setEventName(report.getEventName());
|
||||||
//执行
|
//执行(改为异步)
|
||||||
doReport(reportUserEvent);
|
queue.offer(reportUserEvent);
|
||||||
|
// doReport(reportUserEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ReportUserEvent userToReportBean(User user){
|
private static ReportUserEvent userToReportBean(User user){
|
||||||
|
@ -89,7 +94,7 @@ public class ReportUtil {
|
||||||
.setFighting_capacity(user.getPlayerInfoManager().getMaxForce());
|
.setFighting_capacity(user.getPlayerInfoManager().getMaxForce());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void doReport(ReportUserEvent reportUserEvent){
|
public static void doReport(ReportUserEvent reportUserEvent){
|
||||||
try {
|
try {
|
||||||
//todo 访客id
|
//todo 访客id
|
||||||
ta.setSuperProperties(reportUserEvent.getBaseInfo());
|
ta.setSuperProperties(reportUserEvent.getBaseInfo());
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Map;
|
||||||
* @date 2020/7/9
|
* @date 2020/7/9
|
||||||
* @discribe
|
* @discribe
|
||||||
*/
|
*/
|
||||||
public class CreateRoleEventHanlder extends CommonEventHandler{
|
public class CreateRoleEventHandler extends CommonEventHandler{
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer, Map<String, Object>> getUserProperties(User user) {
|
public Map<Integer, Map<String, Object>> getUserProperties(User user) {
|
||||||
Map<Integer,Map<String, Object>> userProperties = new HashMap<>();
|
Map<Integer,Map<String, Object>> userProperties = new HashMap<>();
|
|
@ -64,6 +64,7 @@ public class UserManager {
|
||||||
initPlayer(user,openId,channel,pid,gid);
|
initPlayer(user,openId,channel,pid,gid);
|
||||||
MongoUtil.getInstence().getMyMongoTemplate().save(user);
|
MongoUtil.getInstence().getMyMongoTemplate().save(user);
|
||||||
PlayerLogic.getInstance().sendTestWelfareMail(user,1,1);
|
PlayerLogic.getInstance().sendTestWelfareMail(user,1,1);
|
||||||
|
ReportUtil.onReportEvent(user, ReportEventEnum.CREATE_ROLE.getType());
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +117,6 @@ public class UserManager {
|
||||||
user.getExpeditionManager().setExpeditionLeve(1);
|
user.getExpeditionManager().setExpeditionLeve(1);
|
||||||
// user.getExpeditionManager().setForceSnap(force);
|
// user.getExpeditionManager().setForceSnap(force);
|
||||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister);
|
// KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister);
|
||||||
ReportUtil.onReportEvent(user, ReportEventEnum.CREATE_ACCOUNT.getType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public enum PassiveskillCalEnum {
|
||||||
HERO_PROFESSION_ADD(129,(config,hero,heroSkillAdMap)->{
|
HERO_PROFESSION_ADD(129,(config,hero,heroSkillAdMap)->{
|
||||||
float[] value = config.getValue();
|
float[] value = config.getValue();
|
||||||
|
|
||||||
if(SCHero.getsCHero().get(hero.getTemplateId()).getProfession()!=value[0]){
|
if(SCHero.getsCHero().get(hero.getTemplateId()).getPropertyName()!=value[0]){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float parm = value[1];
|
float parm = value[1];
|
||||||
|
@ -78,11 +78,11 @@ public enum PassiveskillCalEnum {
|
||||||
if( sPropertyConfig.getStyle()!= GlobalsDef.PERCENT_TYPE){
|
if( sPropertyConfig.getStyle()!= GlobalsDef.PERCENT_TYPE){
|
||||||
sPropertyConfig = SPropertyConfig.getsPropertyConfigByTargetPropertyId(sPropertyConfig.getPropertyId());
|
sPropertyConfig = SPropertyConfig.getsPropertyConfigByTargetPropertyId(sPropertyConfig.getPropertyId());
|
||||||
}
|
}
|
||||||
parm = value[0]*10000;
|
parm = value[1]*10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sPropertyConfig.getStyle()== GlobalsDef.PERCENT_TYPE){
|
if( sPropertyConfig.getStyle()== GlobalsDef.PERCENT_TYPE){
|
||||||
parm = value[0]*10000;
|
parm = value[1]*10000;
|
||||||
}
|
}
|
||||||
int extraValue = (int) cal(optCode, parm);
|
int extraValue = (int) cal(optCode, parm);
|
||||||
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(),0)+extraValue);
|
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(),0)+extraValue);
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.ljsd.jieling.thread.task;
|
||||||
|
|
||||||
import com.ljsd.GameApplication;
|
import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||||
|
import com.ljsd.jieling.ktbeans.ReportUserEvent;
|
||||||
|
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
@ -14,18 +16,14 @@ public class DataReportTask extends Thread {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(GameApplication.serverProperties.isDebug()){
|
// if(GameApplication.serverProperties.isDebug()){
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
while (true) {
|
try {
|
||||||
DataMessageUtils.manageData();
|
ReportUserEvent event = ReportUtil.queue.take();
|
||||||
|
ReportUtil.doReport(event);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// public static void startTlogThread(){
|
|
||||||
// ExecutorService pool = Executors.newCachedThreadPool();
|
|
||||||
// for (int i = 0; i <= 5 ; i++){
|
|
||||||
// DataReportTask myThread = new DataReportTask();
|
|
||||||
// pool.execute(myThread);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue