Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
e925b88ffd
|
@ -25,10 +25,7 @@ public class CoreService implements RPCRequestIFace.Iface {
|
|||
@Override
|
||||
public Result deliveryRecharge(int uid, int goodsId, String openId, String orderId, long orderTime, int amount) throws InvalidOperException, TException {
|
||||
try {
|
||||
User user = UserManager.getUser(uid);
|
||||
Result result = BuyGoodsLogic.sendGoods(uid, goodsId, openId, orderId, orderTime, amount);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserPayEvent,goodsId,orderId,result.getResultCode(),amount);
|
||||
return result;
|
||||
return BuyGoodsLogic.sendGoods(uid, goodsId, openId, orderId, orderTime, amount);
|
||||
} catch (Exception e) {
|
||||
User user = UserManager.getUserInMem(uid);
|
||||
Result result = new Result();
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.ljsd.jieling.thread.ThreadManager;
|
|||
import com.ljsd.jieling.thread.task.MongoDataHandlerTask;
|
||||
import com.ljsd.jieling.thrift.pool.ThriftPoolUtils;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.SensitiveWordInit;
|
||||
import com.ljsd.jieling.util.SensitivewordFilter;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import com.ljsd.jieling.util.http.HttpPool;
|
||||
|
@ -38,6 +39,8 @@ import org.springframework.context.annotation.ComponentScan;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
@ -117,6 +120,11 @@ public class GameApplication {
|
|||
ThriftPoolUtils.getInstance().initContext(configurableApplicationContext);
|
||||
GlobalDataManaager.getInstance().whenServerStart(configurableApplicationContext);
|
||||
HeroLogic.getInstance().afterSet();
|
||||
URL resource = HeroLogic.class.getClassLoader().getResource("mingan.txt");
|
||||
if(resource!=null){
|
||||
LOGGER.info(resource.getFile());
|
||||
}
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.ljsd.jieling.protocols.ChatProto;
|
|||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.SensitivewordFilter;
|
||||
import com.ljsd.jieling.util.ShieldedWordUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -98,6 +99,17 @@ public class ChatLogic {
|
|||
return;
|
||||
}
|
||||
FriendManager friendManager = user.getFriendManager();
|
||||
|
||||
long nowTime = System.currentTimeMillis();
|
||||
String tmp = SensitivewordFilter.replaceSensitiveWord(message, 1, "*");
|
||||
|
||||
|
||||
if(!tmp.equals(message)){
|
||||
ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,tmp,nowTime,-1);
|
||||
ChatProto.SendChatInfoResponse response = ChatProto.SendChatInfoResponse.newBuilder().setChatInfo(chatInfo).build();
|
||||
MessageUtil.sendMessage(iSession,1,msgId,response,true);
|
||||
return;
|
||||
}
|
||||
boolean result = true;
|
||||
switch (chatType){
|
||||
case 1:
|
||||
|
@ -105,12 +117,12 @@ public class ChatLogic {
|
|||
String s = message;
|
||||
String[] strs = message.split("|",3);
|
||||
if(strs.length==3){
|
||||
s = strs[2];
|
||||
message = strs[2];
|
||||
}
|
||||
result = ShieldedWordUtils.checkName(user,s,false,ChatContentType.WORLD_CHAT);
|
||||
result = ShieldedWordUtils.checkName(user,message,false,ChatContentType.WORLD_CHAT);
|
||||
break;
|
||||
case 2:
|
||||
result= ShieldedWordUtils.checkName(user,message,false,ChatContentType.FAMILY);
|
||||
result = ShieldedWordUtils.checkName(user,message,false,ChatContentType.FAMILY);
|
||||
break;
|
||||
case 3:
|
||||
result = ShieldedWordUtils.checkName(user,message,false,ChatContentType.PRIVATE_CHAT,UserManager.getUser(friendId));
|
||||
|
@ -118,11 +130,13 @@ public class ChatLogic {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
if (!result) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "包含敏感字");
|
||||
return ;
|
||||
if(!result){
|
||||
ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,tmp,nowTime,-1);
|
||||
ChatProto.SendChatInfoResponse response = ChatProto.SendChatInfoResponse.newBuilder().setChatInfo(chatInfo).build();
|
||||
MessageUtil.sendMessage(iSession,1,msgId,response,true);
|
||||
return;
|
||||
}
|
||||
long nowTime = System.currentTimeMillis();
|
||||
|
||||
switch (chatType){
|
||||
case 1: //世界
|
||||
long messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_WORD_MSG_ID + GameApplication.serverId);
|
||||
|
|
|
@ -518,9 +518,10 @@ public class MapLogic {
|
|||
mapManager.updateEndlessConsumeExecution(mapManager.getEndlessMapInfo().getConsumeExecution()+costNum);
|
||||
cost[0]= new int[]{costId,costNum};
|
||||
boolean costResult = ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
|
||||
if(!costResult) {
|
||||
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "行动力不足!");
|
||||
return false;
|
||||
if(!costResult){
|
||||
costNum = user.getItemManager().getItem(costId).getItemNum();
|
||||
cost[0][1]= costNum;
|
||||
ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3345,10 +3346,10 @@ public class MapLogic {
|
|||
User user = UserManager.getUser(entry.getValue().getUid());
|
||||
MapManager mapManager = user.getMapManager();
|
||||
mapManager.setEndlessMapInfo(new EndlessMapInfo());
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
|
||||
resetMapInfo(user,false);
|
||||
if(mapManager.getCurMapId()!=0&&SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
|
||||
MessageUtil.sendIndicationMessage(entry.getValue(),1,MessageTypeProto.MessageType.MAP_OUT_INDICATION_VALUE,null,true);
|
||||
}
|
||||
resetMapInfo(user,false);
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
int [][] costItem = new int[mapItem.length][2];
|
||||
for(int i = 0 ; i <mapItem.length;i++){
|
||||
|
|
|
@ -11,6 +11,9 @@ import com.ljsd.jieling.ktbeans.parmsBean.*;
|
|||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.item.ItemLog;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -65,6 +68,8 @@ public class KtEventUtils {
|
|||
}
|
||||
paramEventBean.add(String.valueOf(itemNum));
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
ItemLogic.getInstance().addItemLog(new ItemLog(user.getId(),useType,String.valueOf(TimeUtils.now()),useReson,itemId,itemNum,itemTotalNum));
|
||||
|
||||
BILog.info("itemflow {}|{}|{}|{}|{}|{}|{}|{}",user.getId(), playerInfoManager.getLevel(), playerInfoManager.getVipLevel(),useType,useReson,itemId,itemNum,itemTotalNum);
|
||||
break;
|
||||
case ParamEventBean.UserLoginOutEvent:
|
||||
|
@ -93,7 +98,7 @@ public class KtEventUtils {
|
|||
int goodsId = (int)parm[0];
|
||||
String orderId = (String)parm[1];
|
||||
String payValid = payResult[(int)parm[2]];
|
||||
String amount = String.valueOf( ((int)parm[3]/10));
|
||||
String amount = String.valueOf( ((int)parm[3]));
|
||||
SRechargeCommodityConfig sRechargeCommodityConfig = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(goodsId);
|
||||
paramEventBean.add(sRechargeCommodityConfig.getName());
|
||||
paramEventBean.add(orderId);
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package com.ljsd.jieling.logic.item;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ItemDetail {
|
||||
private int type;
|
||||
private String time;
|
||||
private int season;
|
||||
private Map<Integer,Integer> items;
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public int getSeason() {
|
||||
return season;
|
||||
}
|
||||
|
||||
public void setSeason(int season) {
|
||||
this.season = season;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(Map<Integer, Integer> items) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package com.ljsd.jieling.logic.item;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ItemLog {
|
||||
|
||||
public static final String _COLLECTION_NAME = "itemLog";
|
||||
|
||||
private String id;
|
||||
|
||||
private int uid;
|
||||
|
||||
private int type;
|
||||
|
||||
private String time;
|
||||
|
||||
private int reason;
|
||||
|
||||
private int itemId;
|
||||
|
||||
private int itemNum;
|
||||
|
||||
private int itemTotalNum;
|
||||
|
||||
public ItemLog(){
|
||||
|
||||
}
|
||||
|
||||
public ItemLog(int uid, int type, String time, int reason, int itemId, int itemNum, int itemTotalNum) {
|
||||
this.uid = uid;
|
||||
this.type = type;
|
||||
this.time = time;
|
||||
this.reason = reason;
|
||||
this.itemId = itemId;
|
||||
this.itemNum = itemNum;
|
||||
this.itemTotalNum = itemTotalNum;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public int getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(int reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public int getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(int itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public int getItemNum() {
|
||||
return itemNum;
|
||||
}
|
||||
|
||||
public void setItemNum(int itemNum) {
|
||||
this.itemNum = itemNum;
|
||||
}
|
||||
|
||||
public int getItemTotalNum() {
|
||||
return itemTotalNum;
|
||||
}
|
||||
|
||||
public void setItemTotalNum(int itemTotalNum) {
|
||||
this.itemTotalNum = itemTotalNum;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.ljsd.jieling.logic.item;
|
||||
|
||||
import com.ljsd.common.mogodb.util.BlockingUniqueQueue;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
public class ItemLogUtil {
|
||||
public static BlockingQueue<ItemLog> logQueue = new BlockingUniqueQueue<>();
|
||||
|
||||
public static void addLogQueue(ItemLog itemLog) {
|
||||
logQueue.offer(itemLog);
|
||||
}
|
||||
public static void record () {
|
||||
List<ItemLog> sendDataList = new ArrayList<>(10);
|
||||
logQueue.drainTo(sendDataList,10);
|
||||
if(sendDataList.size()>0){
|
||||
for(ItemLog data:sendDataList){
|
||||
try {
|
||||
MongoUtil.getInstence().getMyMongoTemplate().save(data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
return;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.logic.item;
|
||||
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
|
@ -550,4 +551,8 @@ public class ItemLogic {
|
|||
return equipId*100+leve;
|
||||
}
|
||||
|
||||
public void addItemLog(ItemLog itemLog){
|
||||
ItemLogUtil.addLogQueue(itemLog);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -198,6 +198,7 @@ public class BuyGoodsLogic {
|
|||
}
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,rewardStr,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
resultRes.setResultCode(1);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserPayEvent,goodsId,orderId,resultRes.getResultCode(),price);
|
||||
return resultRes;
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class ThreadManager {
|
|||
private static PlatConfigureTask platConfigureTask;
|
||||
private static DataReportTask dataReportTask;
|
||||
private static MongoDataHandlerTask mongoDataHandlerTask;
|
||||
|
||||
private static ItemLogTask itemLogTask;
|
||||
public static int SLEEP_INTEVAL_TIME = 60; //每1分钟检查一次
|
||||
|
||||
private static volatile ScheduledThreadPoolExecutor scheduledExecutor; //管理task
|
||||
|
@ -37,6 +37,7 @@ public class ThreadManager {
|
|||
platConfigureTask = configurableApplicationContext.getBean(PlatConfigureTask.class);
|
||||
mongoDataHandlerTask = configurableApplicationContext.getBean(MongoDataHandlerTask.class);
|
||||
dataReportTask = configurableApplicationContext.getBean(DataReportTask.class);
|
||||
itemLogTask = configurableApplicationContext.getBean(ItemLogTask.class);
|
||||
// DataReportTask dataReportTask = new DataReportTask();
|
||||
// dataReportTask.start();
|
||||
go();
|
||||
|
@ -100,6 +101,7 @@ public class ThreadManager {
|
|||
scheduledExecutor.execute(new RetrySendIndicationThread("retry_send"));
|
||||
scheduledExecutor.execute(dataReportTask);
|
||||
scheduledExecutor.execute(mongoDataHandlerTask);
|
||||
scheduledExecutor.execute(itemLogTask);
|
||||
}
|
||||
|
||||
public static ScheduledThreadPoolExecutor getScheduledExecutor() {
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.ljsd.jieling.thread.task;
|
||||
|
||||
import com.ljsd.jieling.logic.item.ItemLogUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ItemLogTask extends Thread {
|
||||
@Override
|
||||
public void run() {
|
||||
while(true){
|
||||
ItemLogUtil.record();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,6 +16,8 @@ import com.ljsd.jieling.logic.activity.event.UseItemEvent;
|
|||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.item.ItemLog;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
|
|
|
@ -112,7 +112,7 @@ public class SensitiveWordInit {
|
|||
@SuppressWarnings("resource")
|
||||
private static Set<String> readSensitiveWordFile() throws Exception{
|
||||
Set<String> set = null;
|
||||
InputStream is = SensitiveWordInit.class.getClassLoader().getResourceAsStream("dirtyWords.dict");
|
||||
InputStream is = SensitiveWordInit.class.getClassLoader().getResourceAsStream("mingan.txt");
|
||||
InputStreamReader read = new InputStreamReader(is,ENCODING);
|
||||
BufferedReader bufferedReader =null;
|
||||
try {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue