generated from root/miduo_server
增加发邮件唯一表示判断
parent
630968b0de
commit
b30cfabad6
|
@ -31,7 +31,7 @@ public class Application {
|
|||
//redis初始化
|
||||
RedisAutoConfiguration redisAutoConfiguration = configurableApplicationContext.getBean(RedisAutoConfiguration.class);
|
||||
RedisUtil.getInstence().init(redisAutoConfiguration.getRedisProperties());
|
||||
// JsonUtil.getInstence().initServerIPandProt();
|
||||
JsonUtil.getInstence().initServerIPandProt();
|
||||
// Map<String, BaseHandler> commandHanderMap = configurableApplicationContext.getBeansOfType(BaseHandler.class);
|
||||
// for (BaseHandler handler : commandHanderMap.values()){
|
||||
// handlerManager.addHandler(handler);
|
||||
|
|
|
@ -103,7 +103,7 @@ public class RechargeController {
|
|||
return JsonUtil.getInstence().getGson().toJson(resultVo);
|
||||
}
|
||||
public static void main (String [] args){
|
||||
String s = MD5Util.encrypByMd5("test2234567892"+10212+10005697+111111+0.99+60+1550828074000L+YsjConstant.TW_GameKey);
|
||||
String s = MD5Util.encrypByMd5("test1323456789"+10074+10005686+"111112"+0.99+60+1550828074000L+YsjConstant.TW_GameKey);
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,14 @@ public class SendMailController {
|
|||
//验证sign
|
||||
String sig = MD5Util.encrypByMd5(userId+roleId+serverCode+gameCode+serialNo+packageId+YsjConstant.TW_GameKey);
|
||||
if (!sig.equals(sign)){
|
||||
FindPlayerResult findPlayerResult = new FindPlayerResult("1010","sign derify failed",null);
|
||||
return JsonUtil.getInstence().getGson().toJson(findPlayerResult);
|
||||
ResultVo resultVo = new ResultVo("1010", "sign derify failed");
|
||||
return JsonUtil.getInstence().getGson().toJson(resultVo);
|
||||
}
|
||||
boolean isExist =cuserDao.getMailSeriaNo(serialNo);
|
||||
//发奖流水号 不能重复
|
||||
if (isExist){
|
||||
ResultVo resultVo = new ResultVo("1006", "serialNo is exist");
|
||||
return JsonUtil.getInstence().getGson().toJson(resultVo);
|
||||
}
|
||||
CUserInfo cUserInfo = cuserDao.getUserInfobyNameAndServerId(userId, Integer.parseInt(serverCode));
|
||||
if (Integer.parseInt(roleId) != cUserInfo.getUserId()){
|
||||
|
@ -61,7 +67,7 @@ public class SendMailController {
|
|||
try {
|
||||
rPCClient = ClientAdapterPo.getClientAdapterPo(serviceKey);
|
||||
rPCClient.getClient().sendMail(cUserInfo.getUserId(), rewardItems,URLDecoder.decode(title, "UTF-8"),URLDecoder.decode(content, "UTF-8"));
|
||||
|
||||
cuserDao.addMailSeriaNo(serialNo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -85,7 +91,7 @@ public class SendMailController {
|
|||
}
|
||||
|
||||
public static void main (String [] args){
|
||||
String s = MD5Util.encrypByMd5(111111+10005697+10212+"TWDK"+"skdfjskfdjslakdfjals"+"1,1001,100;1,1002,1000"+YsjConstant.TW_GameKey);
|
||||
String s = MD5Util.encrypByMd5("111112"+10005686+10074+"TWDK"+"skdfjskfdjslakdfjals"+"1,1001,100;1,1002,1000"+YsjConstant.TW_GameKey);
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class UserController {
|
|||
}
|
||||
|
||||
public static void main (String [] args){
|
||||
String s = MD5Util.encrypByMd5(YsjConstant.TW_GameKey + "9000709253" + 10074);
|
||||
String s = MD5Util.encrypByMd5(YsjConstant.TW_GameKey + "111112" + 10074);
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,9 @@ public interface CUserDao {
|
|||
void addCpayOrder(CPayOrder cPayOrder);
|
||||
|
||||
CPayOrder getCpayOrderByOrderId(String pOrderId);
|
||||
|
||||
void addMailSeriaNo(String serialNo);
|
||||
|
||||
boolean getMailSeriaNo(String serialNo);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.jmfy.dto.CPayOrder;
|
|||
import com.jmfy.dto.CUser;
|
||||
import com.jmfy.dto.CUserDao;
|
||||
import com.jmfy.dto.CUserInfo;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
import com.jmfy.util.Connect;
|
||||
import com.jmfy.util.RedisUtil;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
|
@ -25,9 +26,9 @@ public class CUserDaoImpl implements CUserDao {
|
|||
private Connect connect ;
|
||||
@Override
|
||||
public String findUserInfo(int serverId, int userId) {
|
||||
String userInfo = RedisUtil.getInstence().getObject(serverId+":CUser_ServerInfo", Integer.toString(userId),String.class, -1);
|
||||
String userInfo = RedisUtil.getInstence().getObject(serverId+ RedisUserKey.Delimiter_colon +RedisUserKey.CUser_ServerInfo, Integer.toString(userId),String.class, -1);
|
||||
if (userInfo==null){
|
||||
userInfo = RedisUtil.getInstence().getOldObject(serverId+":CUser_ServerInfo", Integer.toString(userId),String.class, -1);
|
||||
userInfo = RedisUtil.getInstence().getOldObject(serverId+ RedisUserKey.Delimiter_colon +RedisUserKey.CUser_ServerInfo, Integer.toString(userId),String.class, -1);
|
||||
}
|
||||
return userInfo;
|
||||
}
|
||||
|
@ -45,7 +46,7 @@ public class CUserDaoImpl implements CUserDao {
|
|||
|
||||
@Override
|
||||
public CUser getCUser(int userId, int serverid) throws Exception {
|
||||
CUser cUser = RedisUtil.getInstence().getObject(serverid + ":CUser_Key", Integer.toString(userId), CUser.class, 7 * 24 * 3600);
|
||||
CUser cUser = RedisUtil.getInstence().getObject(serverid + RedisUserKey.Delimiter_colon + RedisUserKey.CUser_Key, Integer.toString(userId), CUser.class, 7 * 24 * 3600);
|
||||
if (cUser == null) {
|
||||
MongoTemplate mongoTemplete = connect.getMongoTemplete("ysj_" + serverid);
|
||||
Query query = new Query(Criteria.where("_id").is(userId));
|
||||
|
@ -60,20 +61,34 @@ public class CUserDaoImpl implements CUserDao {
|
|||
DateFormat dateTimeformat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String date = dateTimeformat.format(new Date());
|
||||
//保存单独订单
|
||||
RedisUtil.getInstence().putObject("C_PAYORDER",cPayOrder.getOrderId(),cPayOrder,-1);
|
||||
RedisUtil.getInstence().putObject(RedisUserKey.C_PAYORDER,cPayOrder.getOrderId(),cPayOrder,-1);
|
||||
//保存每一天的订单
|
||||
RedisUtil.getInstence().putMapEntry("C_PAYORDER_MAP",date,cPayOrder.getOrderId(),cPayOrder,-1);
|
||||
RedisUtil.getInstence().putMapEntry(RedisUserKey.C_PAYORDER_MAP,date,cPayOrder.getOrderId(),cPayOrder,-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CPayOrder getCpayOrderByOrderId(String pOrderId) {
|
||||
return RedisUtil.getInstence().getObject("C_PAYORDER",pOrderId,CPayOrder.class,-1);
|
||||
return RedisUtil.getInstence().getObject(RedisUserKey.C_PAYORDER,pOrderId,CPayOrder.class,-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMailSeriaNo(String serialNo) {
|
||||
RedisUtil.getInstence().putObject(RedisUserKey.C_PAYORDER,serialNo,serialNo,-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getMailSeriaNo(String serialNo) {
|
||||
String seria = RedisUtil.getInstence().getObject(RedisUserKey.C_PAYORDER, serialNo, String.class, -1);
|
||||
if (seria == null || seria.isEmpty()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CPayOrder> getOrderInfoBydate(String agoDate) {
|
||||
List<CPayOrder> orderInfoBydate = new ArrayList<>();
|
||||
Map<String, CPayOrder> map = RedisUtil.getInstence().getMap("C_PAYORDER_MAP:" + agoDate, CPayOrder.class, -1);
|
||||
Map<String, CPayOrder> map = RedisUtil.getInstence().getMap(RedisUserKey.C_PAYORDER_MAP+ agoDate, CPayOrder.class, -1);
|
||||
for (Map.Entry<String, CPayOrder> entry:map.entrySet()){
|
||||
orderInfoBydate.add(entry.getValue());
|
||||
}
|
||||
|
|
|
@ -3,34 +3,10 @@ package com.jmfy.redisProperties;
|
|||
public class RedisUserKey {
|
||||
|
||||
public final static String Delimiter_colon = ":";
|
||||
public final static String Delimiter_len = "|";
|
||||
public final static String Delimiter_code = "#";
|
||||
public final static String CUser_ServerInfo = "CUser_ServerInfo";
|
||||
public final static String CUser_Key = "CUser_Key";
|
||||
public final static String CItem_Key = "CItem_Key";
|
||||
public final static String KICK_Old_key = "Kick_Old_Key";
|
||||
public final static String CMail_Key = "CMail_Key";
|
||||
public final static String Barage_Key = "Barage_Key";
|
||||
public final static String Title_Key = "Title_Key";
|
||||
public final static String Clear_Chat_Key = "Clear_Chat_Key";
|
||||
public final static String SendAllSVR_key = "SendAllSVR_key";
|
||||
public final static String Clight_Key = "Clight_Key";
|
||||
public final static String Notice_key = "Notice_key";
|
||||
public final static String HeroRandSwitch = "HeroRandSwitch";
|
||||
public final static String Server_GM = "Server_GM";
|
||||
/** value key:roleUid,value:CBanInfo*/
|
||||
public final static String CBanInfo_Key = "CBanInfo_Key";
|
||||
|
||||
public final static String BlackList_key = "BlackList_key";
|
||||
public final static String UserInfo_key = "UserInfo_key";
|
||||
public final static String CTeam_Pos_Key = "CTeam_Pos_Key";
|
||||
/**
|
||||
* hash key:roleUid,hashKey:heroUid,value:cHero
|
||||
*/
|
||||
public final static String CHero_Key = "CHero_Key";
|
||||
|
||||
public final static String Shero_Rand_Switch = "Shero_Rand_Switch";
|
||||
public final static String Shero_Rand_Template = "Shero_Rand_Template";
|
||||
public final static String Login_Server_Info = "Login_Server_Info";
|
||||
|
||||
public final static String C_PAYORDER = "C_PAYORDER";
|
||||
public final static String C_PAYORDER_MAP = "C_PAYORDER_MAP";
|
||||
public final static String IP_AND_PROT_MAP = "IP_AND_PROT_MAP";
|
||||
public final static String Barage_Key = "Barage_Key";
|
||||
}
|
||||
|
|
|
@ -80,14 +80,15 @@ public class JsonUtil {
|
|||
return dayBefore;
|
||||
}
|
||||
|
||||
// public void initServerIPandProt() {
|
||||
// InetAddress ia=null;
|
||||
// try {
|
||||
// ia=ia.getLocalHost();
|
||||
// String deliveryAddress = ia.getHostAddress() +":"+9991;
|
||||
// RedisUtil.getInstence().putMapEntry(RedisUserKey.IP_AND_PROT_MAP, String.valueOf(9991),deliveryAddress,3,-1);
|
||||
// } catch (UnknownHostException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
public void initServerIPandProt() {
|
||||
InetAddress ia=null;
|
||||
try {
|
||||
ia=ia.getLocalHost();
|
||||
String deliveryAddress = ia.getHostAddress() +":"+9991;
|
||||
LOGGER.info("initServerIPandProt=>deliveryAddress={}",deliveryAddress);
|
||||
RedisUtil.getInstence().putMapEntry(RedisUserKey.IP_AND_PROT_MAP, String.valueOf(9991),deliveryAddress,3,-1);
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue