邮件唯一id生成方式修改
parent
7e26aa7c17
commit
b3ff1d81b8
|
@ -383,6 +383,11 @@ public class RedisKey {
|
|||
|
||||
public static final String ONLINE_MAIL_FIRST_MARK = "ONLINE_MAIL_FIRST_MARK";//上线福利邮件,只有一次
|
||||
|
||||
// 唯一key生成
|
||||
public static final String UUID_KEY = "UUID_KEY";//唯一key
|
||||
// 补单
|
||||
public static final String ANEW_RECHARGE_ORDER = "ANEW_RECHARGE_ORDER";//补单订单
|
||||
|
||||
|
||||
//进程排行 合区统一
|
||||
public static Set<String> newAreaCacChe = new HashSet<>();
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.ljsd.jieling.util.UUIDEnum;
|
|||
|
||||
public class Mail extends MongoBase {
|
||||
|
||||
private String id ;
|
||||
private String id ;
|
||||
|
||||
private int roleUid; //所属玩家的UID
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class Mail extends MongoBase {
|
|||
|
||||
}
|
||||
public Mail(int uid,String head,String content,String mailItem,int sendTime,int effectiveTime,String sendName,int mailType){
|
||||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.MAIL, uid);
|
||||
this.id = KeyGenUtils.produceIdByModuleNew(UUIDEnum.MAIL, uid);
|
||||
this.roleUid = uid;
|
||||
this.state = Global.MAIL_STATE_NEW;
|
||||
this.head = head;
|
||||
|
@ -50,7 +50,7 @@ public class Mail extends MongoBase {
|
|||
this.mailType = mailType;
|
||||
}
|
||||
public Mail(int uid,String head,String content,String mailItem,int sendTime,int effectiveTime,String sendName,int mailType,int isTop,int markType){
|
||||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.MAIL, uid);
|
||||
this.id = KeyGenUtils.produceIdByModuleNew(UUIDEnum.MAIL, uid);
|
||||
this.roleUid = uid;
|
||||
this.state = Global.MAIL_STATE_NEW;
|
||||
this.head = head;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
||||
public class KeyGenUtils {
|
||||
//机器码
|
||||
private static String machineNum;
|
||||
|
@ -44,6 +48,16 @@ public class KeyGenUtils {
|
|||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public synchronized static String produceIdByModuleNew(UUIDEnum uuidEnum, int userId){
|
||||
StringBuilder stringBuffer = new StringBuilder();
|
||||
stringBuffer.append(userId);
|
||||
stringBuffer.append(GameApplication.serverId);
|
||||
stringBuffer.append(uuidEnum.getValue());
|
||||
stringBuffer.append(System.currentTimeMillis()/1000);
|
||||
stringBuffer.append(RedisUtil.getInstence().increment(RedisKey.UUID_KEY));
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public static void setMachineNum(int machineNum) {
|
||||
if(machineNum/10 == 0){
|
||||
KeyGenUtils.machineNum = "0" + machineNum;
|
||||
|
|
|
@ -19,6 +19,7 @@ public enum UUIDEnum {
|
|||
FourChallenge(16),
|
||||
Faxiang(17),
|
||||
MagicSoldier(18),
|
||||
Recharge(19),//订单
|
||||
;
|
||||
|
||||
private final int value;
|
||||
|
|
Loading…
Reference in New Issue