充值类型更换
parent
329cb6dcc2
commit
47bfc8c339
|
@ -85,118 +85,7 @@ public class Cmd_changename extends GmRoleAbstract {
|
|||
}
|
||||
}
|
||||
if("recharge".equals(args[2])){
|
||||
Gson gson = new Gson();
|
||||
Map<String,String> rechargeInfoMap = new HashMap<>();
|
||||
|
||||
|
||||
Map<Integer,Integer> realBuyGoodsTimes = new HashMap<>();
|
||||
Map<Integer,Integer> hotGoods = new HashMap<>();
|
||||
rechargeInfoMap= gson.fromJson(args[3],rechargeInfoMap.getClass());
|
||||
String rechargeInfoFileStr = rechargeInfoMap.get(String.valueOf(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();
|
||||
|
||||
for (Map.Entry<Integer,Integer> entry:oldBuyGoodsTimes.entrySet() ) {
|
||||
if(realBuyGoodsTimes.containsKey(entry.getKey())){
|
||||
int finalvalue = realBuyGoodsTimes.get(entry.getKey())-entry.getValue();
|
||||
|
||||
if(finalvalue==0){
|
||||
realBuyGoodsTimes.remove(entry.getKey());
|
||||
}else if(finalvalue>0){
|
||||
realBuyGoodsTimes.put(entry.getKey(),finalvalue);
|
||||
}else {
|
||||
//日志记录不对
|
||||
LOGGER.info("cmd_________recharge:err");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int hotRechargeMoney = 0;
|
||||
for (Map.Entry<Integer,Integer> entry:realBuyGoodsTimes.entrySet()) {
|
||||
if(entry.getKey()==1||entry.getKey()==2||entry.getKey()==3||entry.getKey()==4||entry.getKey()==5||entry.getKey()==13||entry.getKey()==14||entry.getKey()==15||entry.getKey()==16){
|
||||
SRechargeCommodityConfig sRechargeCommodityConfig = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(entry.getKey());
|
||||
int price =sRechargeCommodityConfig.getPrice();
|
||||
hotRechargeMoney+=entry.getValue()*price;
|
||||
}
|
||||
}
|
||||
|
||||
//月卡
|
||||
boolean mulvip =false;
|
||||
if(realBuyGoodsTimes.containsKey(9)||realBuyGoodsTimes.containsKey(10)||realBuyGoodsTimes.containsKey(11)){
|
||||
mulvip =true;
|
||||
}
|
||||
|
||||
|
||||
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
|
||||
int saveAmt = rechargeInfo.getSaveAmt();
|
||||
|
||||
|
||||
//成长礼金
|
||||
if(realBuyGoodsTimes.containsKey(7)||realBuyGoodsTimes.containsKey(8)){
|
||||
// if(!user.getActivityManager().getActivityMissionMap().containsKey(6)){
|
||||
ActivityLogic.getInstance().openActivityReallyOpen(user, ActivityType.GrowthFund);
|
||||
//}
|
||||
}
|
||||
// int[][] costItemArr = StringUtil.parseFiledInt2(rewardStr);
|
||||
// for (int i = 0; i <costItemArr.length ; i++) {
|
||||
// if(costItemArr[i][0]==Global.SOULCRYSTAL){
|
||||
// rechargeInfo.addSoulCrystalAmt(costItemArr[i][1]);
|
||||
// }
|
||||
// }
|
||||
//充值金额
|
||||
rechargeInfo.setSaveAmt(hotRechargeMoney+saveAmt);
|
||||
//累计充值
|
||||
// ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RechargeTotal,rechargeInfo.getSaveAmt());
|
||||
//限时累计充值
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_NUM,hotRechargeMoney);
|
||||
|
||||
Map<Integer, Integer> goodsDurationMap = user.getPlayerInfoManager().getRechargeInfo().getGoodsDurationMap();
|
||||
Integer nowTime =(int)(System.currentTimeMillis()/1000);
|
||||
for(Integer goodsId : hotGoods.keySet()){
|
||||
if(goodsDurationMap.containsKey(goodsId)){
|
||||
LOGGER.info("the uid={} already send the goods={}",user.getId(),goodsId);
|
||||
continue;
|
||||
}
|
||||
SRechargeCommodityConfig sRechargeCommodityConfig = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(goodsId);
|
||||
int goodsType = sRechargeCommodityConfig.getType();
|
||||
if(goodsType == GiftGoodsType.MONTHCARD || goodsType == GiftGoodsType.LUXURYMONTHCARD || goodsType == GiftGoodsType.WEEKCARD){
|
||||
Integer endTime = null;
|
||||
boolean needSendMail = false;
|
||||
for(Map.Entry<Integer,Integer> goodsDurationItem : goodsDurationMap.entrySet()){
|
||||
if(SRechargeCommodityConfig.rechargeCommodityConfigMap.get(goodsDurationItem.getKey()).getType() == goodsType){
|
||||
endTime = goodsDurationItem.getValue();
|
||||
}
|
||||
}
|
||||
if(endTime == null || nowTime>endTime){
|
||||
endTime = nowTime;
|
||||
needSendMail = true;
|
||||
}
|
||||
|
||||
endTime +=sRechargeCommodityConfig.getContiueDays() * 24 * 3600;
|
||||
rechargeInfo.updateGoodsTypeDuration(sRechargeCommodityConfig.getId(),endTime);
|
||||
if(needSendMail){
|
||||
int[] openPrivilege = sRechargeCommodityConfig.getOpenPrivilege();
|
||||
if(openPrivilege!=null && openPrivilege.length>0){
|
||||
for(int privilege:openPrivilege){
|
||||
user.getPlayerInfoManager().addVipInfo(privilege);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
user.getPlayerInfoManager().getRechargeInfo().setBuyGoodsTimes(hotGoods);
|
||||
|
||||
LOGGER.info("cmd_________recharge:hotRechargeMoney"+hotRechargeMoney+"重复月卡:"+mulvip);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue