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