log
parent
144fadf156
commit
80745fc233
|
@ -61,13 +61,14 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
||||||
|
|
||||||
if (obj instanceof GmRoleAbstract) {
|
if (obj instanceof GmRoleAbstract) {
|
||||||
//todo
|
//todo
|
||||||
Map<Integer, RechargeInfo> rechargeInfoMap = new HashMap<>();
|
Map<Integer, String> rechargeInfoMap = new HashMap<>();
|
||||||
if(cmd.contains("recharge")){
|
if(cmd.contains("recharge")){
|
||||||
File file = new File("../conf/BuyGoodsLogic.log");
|
File file = new File("../conf/BuyGoodsLogic.log");
|
||||||
LOGGER.info("file path={}",file.getAbsolutePath());
|
LOGGER.info("file path={}",file.getAbsolutePath());
|
||||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
|
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
|
||||||
|
|
||||||
String readLine = null;
|
String readLine = null;
|
||||||
|
Gson gson = new Gson();
|
||||||
while ( (readLine= bufferedReader.readLine())!=null){
|
while ( (readLine= bufferedReader.readLine())!=null){
|
||||||
if(readLine.contains("class")){
|
if(readLine.contains("class")){
|
||||||
continue;
|
continue;
|
||||||
|
@ -75,10 +76,10 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
||||||
String[] split = readLine.split(",");
|
String[] split = readLine.split(",");
|
||||||
String uidStr = split[0].split("=")[1];
|
String uidStr = split[0].split("=")[1];
|
||||||
int uid = Integer.parseInt(uidStr);
|
int uid = Integer.parseInt(uidStr);
|
||||||
RechargeInfo rechargeInfo = rechargeInfoMap.get(uid);
|
String rechargeInfoStr = rechargeInfoMap.get(uid);
|
||||||
if( rechargeInfo == null){
|
RechargeInfo rechargeInfo = new RechargeInfo();
|
||||||
rechargeInfo = new RechargeInfo();
|
if( rechargeInfoStr != null){
|
||||||
rechargeInfoMap.put(uid,rechargeInfo);
|
rechargeInfo = gson.fromJson(rechargeInfoStr,RechargeInfo.class);
|
||||||
}
|
}
|
||||||
String goodStr = split[1].split("=")[1];
|
String goodStr = split[1].split("=")[1];
|
||||||
int goodID = Integer.parseInt(goodStr);
|
int goodID = Integer.parseInt(goodStr);
|
||||||
|
@ -92,6 +93,7 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
||||||
}
|
}
|
||||||
buyCount++;
|
buyCount++;
|
||||||
buyGoodsTimes.put(goodID,buyCount);
|
buyGoodsTimes.put(goodID,buyCount);
|
||||||
|
rechargeInfoMap.put(uid,gson.toJson(rechargeInfo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,16 +76,17 @@ public class Cmd_changename extends GmRoleAbstract {
|
||||||
|
|
||||||
if("recharge".equals(args[2])){
|
if("recharge".equals(args[2])){
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Map<Integer,RechargeInfo> rechargeInfoMap = new HashMap<>();
|
Map<Integer,String> rechargeInfoMap = new HashMap<>();
|
||||||
Type type = new TypeToken<Map<Integer,RechargeInfo>>(){}.getType();
|
|
||||||
|
|
||||||
Map<Integer,Integer> realBuyGoodsTimes = new HashMap<>();
|
Map<Integer,Integer> realBuyGoodsTimes = new HashMap<>();
|
||||||
Map<Integer,Integer> hotGoods = new HashMap<>();
|
Map<Integer,Integer> hotGoods = new HashMap<>();
|
||||||
rechargeInfoMap= gson.fromJson(args[3],type);
|
rechargeInfoMap= gson.fromJson(args[3],rechargeInfoMap.getClass());
|
||||||
RechargeInfo rechargeInfoFile = rechargeInfoMap.get(user.getId());
|
String rechargeInfoFileStr = rechargeInfoMap.get(user.getId());
|
||||||
if(rechargeInfoFile == null){
|
if(rechargeInfoFileStr == null){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
RechargeInfo rechargeInfoFile = gson.fromJson(rechargeInfoFileStr,RechargeInfo.class);
|
||||||
realBuyGoodsTimes = rechargeInfoFile.getBuyGoodsTimes();
|
realBuyGoodsTimes = rechargeInfoFile.getBuyGoodsTimes();
|
||||||
hotGoods=new HashMap<>(realBuyGoodsTimes);
|
hotGoods=new HashMap<>(realBuyGoodsTimes);
|
||||||
Map<Integer,Integer> oldBuyGoodsTimes = user.getPlayerInfoManager().getRechargeInfo().getBuyGoodsTimes();
|
Map<Integer,Integer> oldBuyGoodsTimes = user.getPlayerInfoManager().getRechargeInfo().getBuyGoodsTimes();
|
||||||
|
|
Loading…
Reference in New Issue