Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
f05b764cfa
|
@ -68,7 +68,7 @@ public class SimpleTransaction {
|
|||
}
|
||||
|
||||
|
||||
void commit() {
|
||||
public void commit() {
|
||||
doAddSendCache();
|
||||
for (TransTask transTask : tasks) {
|
||||
if (!transTask.isCallback())
|
||||
|
@ -84,11 +84,27 @@ public class SimpleTransaction {
|
|||
}
|
||||
}
|
||||
|
||||
public static class SendTask extends TransTask {
|
||||
public static class SendTask extends SendResponseTask {
|
||||
|
||||
public SendTask(GeneratedMessage proto, int msgId) {
|
||||
super(proto, msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (null != HandlerLogicThread.current() && null != HandlerLogicThread.current().getSession())
|
||||
MessageUtil.sendIndicationMessage(HandlerLogicThread.current().getSession(), 1, getMsgId(), getProto(), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class SendResponseTask extends TransTask{
|
||||
|
||||
private GeneratedMessage proto;
|
||||
private int msgId;
|
||||
|
||||
public SendTask(GeneratedMessage proto, int msgId) {
|
||||
public SendResponseTask(GeneratedMessage proto, int msgId) {
|
||||
this.proto = proto;
|
||||
this.msgId = msgId;
|
||||
}
|
||||
|
@ -96,9 +112,8 @@ public class SimpleTransaction {
|
|||
@Override
|
||||
public void run() {
|
||||
if (null != HandlerLogicThread.current() && null != HandlerLogicThread.current().getSession())
|
||||
MessageUtil.sendIndicationMessage(HandlerLogicThread.current().getSession(), 1, msgId, proto, true);
|
||||
MessageUtil.sendMessage(HandlerLogicThread.current().getSession(), 1, getMsgId(), getProto());
|
||||
}
|
||||
|
||||
public int getMsgId() {
|
||||
return msgId;
|
||||
}
|
||||
|
@ -122,7 +137,7 @@ public class SimpleTransaction {
|
|||
if (sendCacheMap.containsKey(entry.getKey())) {
|
||||
List<GeneratedMessage> combineList = entry.getValue().combine(sendCacheMap.get(entry.getKey()));
|
||||
for (GeneratedMessage generatedMessage : combineList) {
|
||||
tasks.add(new SimpleTransaction.SendTask(generatedMessage, entry.getKey()));
|
||||
tasks.add(0,new SimpleTransaction.SendTask(generatedMessage, entry.getKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -389,7 +389,6 @@ public class ArenaLogic {
|
|||
Set<String> arenaRank = RedisUtil.getInstence().getZsetRange(RedisKey.ARENA_RANK,Integer.toString(matchSeason), myScore * low / 10000.0f-1, myScore * high / 10000.0f +1);
|
||||
LOGGER.info("curSeason={},matchSeason={},the uid={},the myscore={},the low={},the high={},mylow={},myhigh={},",curSeason,matchSeason,uid,myScore,low,high,myScore * low / 10000.0f-1,myScore * high / 10000.0f +1);
|
||||
if(arenaRank!=null && !arenaRank.isEmpty()){
|
||||
LOGGER.info("arenRank-->{}",arenaRank);
|
||||
arenaRank.remove(Integer.toString(uid));
|
||||
String s = randomSet(arenaRank);
|
||||
if(!StringUtil.isEmpty(s)){
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.ljsd.jieling.protocols.CommonProto;
|
|||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import org.luaj.vm2.ast.Str;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -55,17 +56,24 @@ public class MailLogic {
|
|||
}
|
||||
List<Mail> cMailList = new CopyOnWriteArrayList<>();
|
||||
Iterator<Map.Entry<String, Mail>> iterator = mailMap.entrySet().iterator();
|
||||
|
||||
int nowTime = (int)(TimeUtils.now()/1000);
|
||||
Set<String> removeIds = new HashSet<>();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<String, Mail> next = iterator.next();
|
||||
Mail cMail = next.getValue();
|
||||
int nowTime = (int)(TimeUtils.now()/1000);
|
||||
if (cMail.getEffectiveTime() != 0 && (nowTime - cMail.getSendTime()) > cMail.getEffectiveTime()){
|
||||
mailManager.removeMail(cMail.getId());
|
||||
removeIds.add(cMail.getId());
|
||||
continue;
|
||||
}
|
||||
if(cMail.getMailItem()!=null && "2100#15".equals(cMail.getMailItem())){
|
||||
removeIds.add(cMail.getId());
|
||||
continue;
|
||||
}
|
||||
cMailList.add(cMail);
|
||||
}
|
||||
for(String removeId : removeIds){
|
||||
mailManager.removeMail(removeId);
|
||||
}
|
||||
//超过邮件上限, 删除时间最早的一封
|
||||
int size = cMailList.size();
|
||||
if (size > Global.MAIL_BOX_CAPACITY){
|
||||
|
@ -123,6 +131,14 @@ public class MailLogic {
|
|||
mailMap.put(mail.getId(),mail);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Calendar calendar =Calendar.getInstance();
|
||||
calendar.set(Calendar.HOUR_OF_DAY,18);
|
||||
calendar.set(Calendar.MINUTE,30);
|
||||
System.out.println(calendar.getTime());
|
||||
System.out.println(calendar.getTimeInMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有系统邮件
|
||||
*
|
||||
|
|
|
@ -127,15 +127,19 @@ public class StoreLogic {
|
|||
long nowTime = System.currentTimeMillis();
|
||||
StoreManager storeManager = user.getStoreManager();
|
||||
Iterator<Map.Entry<Integer, StoreInfo>> it = storeInfoMap.entrySet().iterator();
|
||||
Set<Integer> removeStoreIds = new HashSet<>();
|
||||
while(it.hasNext()){
|
||||
StoreInfo storeInfo = it.next().getValue();
|
||||
SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeInfo.getId());
|
||||
if (sStoreTypeConfig.getStoreOpenRule() ==2){
|
||||
if (nowTime > storeInfo.getEndTime()){
|
||||
storeManager.removeStoreInfo(storeInfo.getId());
|
||||
removeStoreIds.add(storeInfo.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
for(Integer removeStoreId : removeStoreIds){
|
||||
storeManager.removeStoreInfo(removeStoreId);
|
||||
}
|
||||
for(Integer openId :openStoreInfo){
|
||||
if(!storeInfoMap.containsKey(openId)){
|
||||
initOneStore(user,openId);
|
||||
|
|
|
@ -97,6 +97,12 @@ public class MessageUtil {
|
|||
}
|
||||
|
||||
public static void sendMessage(ISession session, int result, int msgId, GeneratedMessage generatedMessage, boolean flush) {
|
||||
|
||||
if(null!= HandlerLogicThread.current()){
|
||||
HandlerLogicThread.current().dealWhileCommit(new SimpleTransaction.SendResponseTask(generatedMessage,msgId));
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] byteBuf = wrappedBuffer(session.getUid(), session.getToken(), session.getIndex(), result, msgId, generatedMessage);
|
||||
if (flush) {
|
||||
session.writeAndFlush(byteBuf);
|
||||
|
@ -106,6 +112,13 @@ public class MessageUtil {
|
|||
session.putBackMassageToMap(byteBuf);
|
||||
}
|
||||
|
||||
|
||||
public static void sendMessage(ISession session, int result, int msgId, GeneratedMessage generatedMessage) {
|
||||
byte[] byteBuf = wrappedBuffer(session.getUid(), session.getToken(), session.getIndex(), result, msgId, generatedMessage);
|
||||
session.writeAndFlush(byteBuf);
|
||||
session.putBackMassageToMap(byteBuf);
|
||||
}
|
||||
|
||||
public static void sendMessageWithoutBack(ISession session, int result, int msgId, GeneratedMessage generatedMessage, boolean flush) {
|
||||
byte[] byteBuf = wrappedBuffer(session.getUid(), session.getToken(), session.getIndex(), result, msgId, generatedMessage);
|
||||
if (flush) {
|
||||
|
|
Loading…
Reference in New Issue