充值类型更换
parent
bde18afb04
commit
433ef98265
|
@ -3,6 +3,7 @@ package util;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
|
@ -367,4 +368,10 @@ public class MathUtils {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static double doubleAdd(double d1 ,double d2){
|
||||
BigDecimal b1 = new BigDecimal(Double.toString(d1));
|
||||
BigDecimal b2 = new BigDecimal(Double.toString(d2));
|
||||
return b1.add(b2).doubleValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.setQuestionState(questState)
|
||||
.setSoulEquipPool(equipPool)
|
||||
.addAllPlayedMapTypes(mapManager.getPlayedMapType())
|
||||
.setAmount(rechargeInfo.getSaveAmt())
|
||||
.setAmount((int) rechargeInfo.getSaveAmt())
|
||||
.setVipDaily(playerInfoManager.getHadTakeDailyBoxVip())
|
||||
.setMissingRefreshCount(vipPrivilageValue)
|
||||
.addAllMonthinfos(PlayerLogic.getInstance().getMonthCardInfo(user))
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.activity;
|
|||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SActivityRewardConfig;
|
||||
|
@ -43,7 +44,10 @@ class DailyRechargeActivity extends AbstractActivity {
|
|||
|
||||
@Override
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
return checkValue(session, sActivityRewardConfig, activityProgressInfo);
|
||||
int[][] values = sActivityRewardConfig.getValues();
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getV();
|
||||
return value/1000 >= values[0][0];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -77,7 +77,7 @@ public class LuckyCatActivity extends AbstractActivity {
|
|||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
if (activityMission.getV() < sLuckyRewardConfig.getRmbValue()) {
|
||||
if (activityMission.getV()/1000 < sLuckyRewardConfig.getRmbValue()) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("value illegality"));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.activity;
|
|||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SActivityRewardConfig;
|
||||
|
@ -31,7 +32,10 @@ class RechargeSumActivity extends AbstractActivity {
|
|||
|
||||
@Override
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
return checkValue(session, sActivityRewardConfig, activityProgressInfo);
|
||||
int[][] values = sActivityRewardConfig.getValues();
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getV();
|
||||
return value/1000 >= values[0][0];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class RechargeSumDayActivity extends AbstractActivity {
|
|||
if (activityProgressInfo == null || activityProgressInfo.getProgrss() == 1) {
|
||||
return;
|
||||
}
|
||||
if (count >= SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId).getValues()[0][0]) {
|
||||
if (count/1000 >= SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId).getValues()[0][0]) {
|
||||
activityProgressInfo.setProgrss(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class RechargeTotalActivity extends AbstractActivity {
|
|||
User user = UserManager.getUser(session.getUid());
|
||||
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
|
||||
int days = TimeUtils.differentDaysByHour(rechargeInfo.getCreateTime(), now,5) + 1;
|
||||
if (missionProgress < values[0][0] || days < values[0][1]) {
|
||||
if (missionProgress/1000 < values[0][0] || days < values[0][1]) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -46,8 +46,8 @@ public class LeveGiftEventHander implements IEventHandler {
|
|||
return;
|
||||
}
|
||||
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
|
||||
int saveAmt = rechargeInfo.getSaveAmt();
|
||||
Map.Entry<Integer, Integer> entry = SRechargeCommodityConfig.rechargePlayerLevelMap.floorEntry(saveAmt);
|
||||
double saveAmt = rechargeInfo.getSaveAmt();
|
||||
Map.Entry<Integer, Integer> entry = SRechargeCommodityConfig.rechargePlayerLevelMap.floorEntry((int)saveAmt);
|
||||
SRechargeCommodityConfig orDefault = STableManager.getConfig(SRechargeCommodityConfig.class).getOrDefault(entry.getValue(), null);
|
||||
if(orDefault==null){
|
||||
return;
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
import config.SMonthcardConfig;
|
||||
import config.SPrivilegeTypeConfig;
|
||||
import manager.STableManager;
|
||||
import util.MathUtils;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -85,7 +86,7 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private int signTotay;//今天是否签到
|
||||
|
||||
private int rechargedaily;
|
||||
private double rechargedaily;
|
||||
|
||||
private long onlineTime;
|
||||
|
||||
|
@ -487,17 +488,17 @@ public class PlayerManager extends MongoBase {
|
|||
return signTotay;
|
||||
}
|
||||
|
||||
public int getRechargedaily() {
|
||||
public double getRechargedaily() {
|
||||
return rechargedaily;
|
||||
}
|
||||
|
||||
public void setRechargedaily(int rechargedaily) {
|
||||
public void setRechargedaily(double rechargedaily) {
|
||||
updateString("rechargedaily", rechargedaily);
|
||||
this.rechargedaily = rechargedaily;
|
||||
}
|
||||
|
||||
public void addRechargedaily(int rechargedaily) {
|
||||
this.rechargedaily += rechargedaily;
|
||||
public void addRechargedaily(double rechargedaily) {
|
||||
this.rechargedaily = MathUtils.doubleAdd(rechargedaily,this.rechargedaily);
|
||||
updateString("rechargedaily", this.rechargedaily);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,12 @@ import java.util.*;
|
|||
|
||||
public class RechargeInfo extends MongoBase{
|
||||
|
||||
private int saveAmt;//累计充值
|
||||
private double saveAmt;//累计充值
|
||||
private int soulCrystalAmt;//累计充值购买魂晶
|
||||
private int monthSaveAmt ; //月卡累计总额
|
||||
private int smonthSaveAmt ; //豪华月卡累计总额
|
||||
|
||||
private double monthSaveAmt ; //月卡累计总额
|
||||
private double smonthSaveAmt ; //豪华月卡累计总额
|
||||
|
||||
private int isFirst;
|
||||
private long createTime;
|
||||
private int isDayFirst;
|
||||
|
@ -95,7 +97,7 @@ public class RechargeInfo extends MongoBase{
|
|||
return false;
|
||||
}
|
||||
|
||||
public void setSaveAmt(int saveAmt){
|
||||
public void setSaveAmt(double saveAmt){
|
||||
if(this.saveAmt == 0){
|
||||
createTime = System.currentTimeMillis();
|
||||
updateString("createTime",createTime);
|
||||
|
@ -143,7 +145,7 @@ public class RechargeInfo extends MongoBase{
|
|||
}
|
||||
|
||||
|
||||
public int getSaveAmt() {
|
||||
public double getSaveAmt() {
|
||||
return saveAmt;
|
||||
}
|
||||
|
||||
|
@ -180,14 +182,14 @@ public class RechargeInfo extends MongoBase{
|
|||
this.goodseSendDailyMap.put(goodsType,sendTime);
|
||||
}
|
||||
|
||||
public int getSoulCrystalAmt() {
|
||||
return soulCrystalAmt;
|
||||
}
|
||||
|
||||
public void addSoulCrystalAmt(int soulCrystalAmt) {
|
||||
this.soulCrystalAmt += soulCrystalAmt;
|
||||
updateString("soulCrystalAmt",soulCrystalAmt);
|
||||
}
|
||||
// public int getSoulCrystalAmt() {
|
||||
// return soulCrystalAmt;
|
||||
// }
|
||||
//
|
||||
// public void addSoulCrystalAmt(int soulCrystalAmt) {
|
||||
// this.soulCrystalAmt += soulCrystalAmt;
|
||||
// updateString("soulCrystalAmt",soulCrystalAmt);
|
||||
// }
|
||||
|
||||
public Map<Integer, Long> getTypeBagMap() {
|
||||
return typeBagMap;
|
||||
|
@ -243,20 +245,20 @@ public class RechargeInfo extends MongoBase{
|
|||
updateString("refreshBagMap", refreshBagMap);
|
||||
}
|
||||
|
||||
public int getMonthSaveAmt() {
|
||||
public double getMonthSaveAmt() {
|
||||
return monthSaveAmt;
|
||||
}
|
||||
|
||||
public void setMonthSaveAmt(int monthSaveAmt) {
|
||||
public void setMonthSaveAmt(double monthSaveAmt) {
|
||||
this.monthSaveAmt = monthSaveAmt;
|
||||
updateString("monthSaveAmt",monthSaveAmt);
|
||||
}
|
||||
|
||||
public int getSmonthSaveAmt() {
|
||||
public double getSmonthSaveAmt() {
|
||||
return smonthSaveAmt;
|
||||
}
|
||||
|
||||
public void setSmonthSaveAmt(int smonthSaveAmt) {
|
||||
public void setSmonthSaveAmt(double smonthSaveAmt) {
|
||||
this.smonthSaveAmt = smonthSaveAmt;
|
||||
updateString("smonthSaveAmt",smonthSaveAmt);
|
||||
}
|
||||
|
|
|
@ -938,8 +938,8 @@ public class PlayerLogic {
|
|||
STableManager.getConfig(SMonthcardConfig.class).forEach((integer, sMonthcardConfig) -> {
|
||||
int time = playerInfoManager.getMonthCard().getOrDefault(integer,0);
|
||||
int state = playerInfoManager.getMonthCardDailyTake().contains(integer)?1:0;
|
||||
int saveAmt = integer==1?rechargeInfo.getMonthSaveAmt():rechargeInfo.getSmonthSaveAmt();
|
||||
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(integer).setEndingTime(time).setState(state).setTotleAmt(saveAmt).build());
|
||||
double saveAmt = integer==1?rechargeInfo.getMonthSaveAmt():rechargeInfo.getSmonthSaveAmt();
|
||||
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(integer).setEndingTime(time).setState(state).setTotleAmt((int)saveAmt).build());
|
||||
});
|
||||
return cardInfos;
|
||||
}
|
||||
|
|
|
@ -39,9 +39,11 @@ import config.*;
|
|||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import util.MathUtils;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -73,12 +75,12 @@ public class BuyGoodsLogic {
|
|||
}
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TEST_BUY_GIGT_GOODS_RESPONSE_VALUE,null,true);
|
||||
Result result = sendGoods(uid, goodsId, "gm-test", "111111", System.currentTimeMillis(), -999);
|
||||
User user = UserManager.getUser(uid);
|
||||
int price =sRechargeCommodityConfig.getPrice();
|
||||
int isDiscount = sRechargeCommodityConfig.getIsDiscount();
|
||||
if(isDiscount!=0){
|
||||
price=(int)(sRechargeCommodityConfig.getPrice() * (10 + isDiscount)/10f);
|
||||
}
|
||||
// User user = UserManager.getUser(uid);
|
||||
// int price =sRechargeCommodityConfig.getPrice();
|
||||
// int isDiscount = sRechargeCommodityConfig.getIsDiscount();
|
||||
// if(isDiscount!=0){
|
||||
// price=(int)(sRechargeCommodityConfig.getPrice() * (10 + isDiscount)/10f);
|
||||
// }
|
||||
List<Integer> itemList = new ArrayList<>();
|
||||
for(int[] item:sRechargeCommodityConfig.getBaseReward()){
|
||||
itemList.add(item[0]);
|
||||
|
@ -108,7 +110,7 @@ public class BuyGoodsLogic {
|
|||
if(buyCount ==null){
|
||||
buyCount = 0;
|
||||
}
|
||||
int price =sRechargeCommodityConfig.getPrice();
|
||||
double price =sRechargeCommodityConfig.getPrice();
|
||||
buyCount=buyCount+1;
|
||||
|
||||
//time check
|
||||
|
@ -171,11 +173,11 @@ public class BuyGoodsLogic {
|
|||
int monthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.MONTHCARDID).getPrice();
|
||||
int lmonthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.LMONTHCARDID).getPrice();
|
||||
boolean sendneed =false;
|
||||
if(rechargeInfo.getMonthSaveAmt()<monthline&&(price+rechargeInfo.getMonthSaveAmt())>=monthline){
|
||||
if(rechargeInfo.getMonthSaveAmt()<monthline&&(MathUtils.doubleAdd(price,rechargeInfo.getMonthSaveAmt()))>=monthline){
|
||||
sendneed=true;
|
||||
user.getPlayerInfoManager().getMonthCard().put(Global.MONTHCARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
}
|
||||
if(rechargeInfo.getSmonthSaveAmt()<lmonthline&&(price+rechargeInfo.getSmonthSaveAmt())>=lmonthline){
|
||||
if(rechargeInfo.getSmonthSaveAmt()<lmonthline&&(MathUtils.doubleAdd(price,rechargeInfo.getSmonthSaveAmt()))>=lmonthline){
|
||||
sendneed=true;
|
||||
user.getPlayerInfoManager().getMonthCard().put(Global.LMONTHCARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),Global.LMONTHCARDID));
|
||||
|
@ -247,30 +249,31 @@ public class BuyGoodsLogic {
|
|||
rewardStr = ItemUtil.getMailReward(baseReward);
|
||||
}
|
||||
if(sRechargeCommodityConfig.getAccumulativeRecharge() == 1){
|
||||
int saveAmt = rechargeInfo.getSaveAmt();
|
||||
if(!StringUtil.isEmpty(rewardStr)){
|
||||
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(price+saveAmt);
|
||||
double saveAmt = rechargeInfo.getSaveAmt();
|
||||
// if(!StringUtil.isEmpty(rewardStr)){
|
||||
// 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(MathUtils.doubleAdd(price,saveAmt));
|
||||
user.getPlayerInfoManager().addRechargedaily(price);
|
||||
user.getPlayerInfoManager().getMonthCard();
|
||||
rechargeInfo.setMonthSaveAmt(price+rechargeInfo.getMonthSaveAmt());
|
||||
rechargeInfo.setSmonthSaveAmt(price+rechargeInfo.getSmonthSaveAmt());
|
||||
rechargeInfo.setMonthSaveAmt(MathUtils.doubleAdd(price,rechargeInfo.getMonthSaveAmt()));
|
||||
rechargeInfo.setSmonthSaveAmt(MathUtils.doubleAdd(price,rechargeInfo.getSmonthSaveAmt()));
|
||||
|
||||
//TODO 用事件分发
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RechargeTotal,price);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.LUCKYCAT,price);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.DAILY_RECHARGE,price);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_NUM,price);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_SUM_DAY, user.getPlayerInfoManager().getRechargedaily());
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.FIND_FAIRY_FESTIVAL, price);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RechargeTotal,(int)(price*1000));
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.LUCKYCAT,(int)(price*1000));
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.DAILY_RECHARGE,(int)(price*1000));
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_NUM,(int)(price*1000));
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_SUM_DAY, (int)(user.getPlayerInfoManager().getRechargedaily()*1000) );
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.FIND_FAIRY_FESTIVAL, (int)(price*1000));
|
||||
|
||||
AyyncWorker ayyncWorker = new AyyncWorker(user, true, new AynMissionWorker(GameEvent.RECHARGE_TOTAL,price)) ;
|
||||
AyyncWorker ayyncWorker = new AyyncWorker(user, true, new AynMissionWorker(GameEvent.RECHARGE_TOTAL,(int)(price*1000))) ;
|
||||
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||
|
||||
|
||||
|
@ -364,7 +367,7 @@ public class BuyGoodsLogic {
|
|||
return resultRes;
|
||||
|
||||
}
|
||||
private static void onChargeSuccess(int uid,int amount,int virtualAmount,String orderId){
|
||||
private static void onChargeSuccess(int uid,double amount,int virtualAmount,String orderId){
|
||||
RechargeEvent rechargeEvent = new RechargeEvent();
|
||||
rechargeEvent.setModule("GameAnalysis");
|
||||
rechargeEvent.setIp("");
|
||||
|
|
|
@ -8,7 +8,7 @@ package com.ljsd.jieling.logic.store;
|
|||
public class RechargeEventProp {
|
||||
private String order_id;
|
||||
|
||||
private int amount;
|
||||
private double amount;
|
||||
|
||||
private int virtual_currency_amount;
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class RechargeEventProp {
|
|||
this.order_id = order_id;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
public double getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class RechargeEventProp {
|
|||
this.payment = payment;
|
||||
}
|
||||
|
||||
public RechargeEventProp(String order_id, int amount, int virtual_currency_amount, String currency_type, String product, String payment) {
|
||||
public RechargeEventProp(String order_id, double amount, int virtual_currency_amount, String currency_type, String product, String payment) {
|
||||
this.order_id = order_id;
|
||||
this.amount = amount;
|
||||
this.virtual_currency_amount = virtual_currency_amount;
|
||||
|
|
|
@ -43,7 +43,7 @@ public class CBean2Proto {
|
|||
.setServerTime((int) (System.currentTimeMillis() / 1000))
|
||||
.setMaxForce(playerManager.getMaxForce())
|
||||
.setRechargeTime((int) (rechargeInfo.getCreateTime() / 1000))
|
||||
.setSaveAmt(rechargeInfo.getSaveAmt())
|
||||
.setSaveAmt((int)(rechargeInfo.getSaveAmt()))
|
||||
.setIsFirstRecharge(rechargeInfo.getIsFirst())
|
||||
.setHeadFrame(playerManager.getHeadFrame())
|
||||
.setDesignation(playerManager.getDesignation())
|
||||
|
|
|
@ -15,7 +15,7 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
|
||||
private int type;
|
||||
|
||||
private int price;
|
||||
private double price;
|
||||
|
||||
private int[][] firstMultiple;
|
||||
|
||||
|
@ -128,7 +128,7 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
return type;
|
||||
}
|
||||
|
||||
public int getPrice() {
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue