人民币购买时获得名望及仙晶

back_recharge
duhui 2022-09-16 14:33:49 +08:00
parent 6f88779303
commit 56e993f2a9
3 changed files with 31 additions and 34 deletions

View File

@ -152,12 +152,12 @@ public class BuyGoodsNewLogic {
}
/**
*
*
* @param orderId
* @return
*/
private static boolean notRmbBuy(String orderId){
return "support-order".equals(orderId) || "gm_modifier".equals(orderId) || "test_buy_order".equals(orderId);
private static boolean isRmbBuy(String orderId){
return !"support-order".equals(orderId) && !"gm_modifier".equals(orderId) && !"test_buy_order".equals(orderId);
}
/**
@ -194,10 +194,10 @@ public class BuyGoodsNewLogic {
double priceTemp =config.getPrice();
int cfgType = SSpecialConfig.getIntegerValue(SSpecialConfig.EXCHANGE_FORCE_TYPE);
double price = priceTemp==0?0: SExchangeRate.doubleIntegerHashMap.get(cfgType).get((int)priceTemp);
if(!notRmbBuy(orderId) && !MathUtils.doubleEquals(amount,price * 100)){
if(isRmbBuy(orderId) && !MathUtils.doubleEquals(amount,price * 100)){
resultRes.setResultCode(0);
resultRes.setResultMsg("charge count error");
LOGGER.error("sendGoods charge count error, uid={},the goodId={}, currentPrice={},realPrice={}",uid,goodsId, amount,price);
resultRes.setResultMsg("charge price error");
LOGGER.error("sendGoods charge price error, uid={},the goodId={}, currentPrice={},realPrice={}",uid,goodsId, amount,price);
return resultRes;
}
@ -220,9 +220,12 @@ public class BuyGoodsNewLogic {
countBag.addBuyTimes(1);
}
}
int[][] dropByBag = bag.getDropByBag();
List<int[][]> list = bag.getDropByBag();
if (isRmbBuy(orderId) && config.getGainFame() != null && config.getGainFame().length > 0){
list.add(config.getGainFame());
}
//发货
sendGoodsByType(user,config,dropByBag);
sendGoodsByType(user,config,list);
if(config.getAccumulativeRecharge() == 1 && !"gm_modifier".equals(orderId)){
if(info.getMaxSingleR() < price){
@ -428,12 +431,12 @@ public class BuyGoodsNewLogic {
/**
*
*/
public static void sendGoodsByType(User user,SRechargeCommodityNewConfig config,int[][] dropArray) throws Exception{
public static void sendGoodsByType(User user,SRechargeCommodityNewConfig config,List<int[][]> dropList) throws Exception{
ISession session = OnlineUserManager.getSessionByUid(user.getId());
int type = config.getType();
CommonProto.Drop.Builder drop = null;
if(dropArray!=null && dropArray.length>=1){
drop = ItemUtil.drop(user,dropArray, BIReason.DIRECT_BUY);
if(dropList != null && !dropList.isEmpty()){
drop = ItemUtil.drop(user, dropList, BIReason.DIRECT_BUY);
}
//红包事件
if(type==GiftGoodsType.RED_PACKET){

View File

@ -7,7 +7,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.TimeUtils;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class AbstractWelfareBag extends MongoBase{
@ -84,34 +86,20 @@ public class AbstractWelfareBag extends MongoBase{
return true;
}
public int[][] getDropByBag() {
public List<int[][]> getDropByBag() {
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(modId);
if (config == null) {
LOGGER.info("getDropByBag modId={} ", modId);
return new int[0][0];
return null;
}
int[][] baseReward = config.getBaseReward();
int[][] firstMultiple = config.getFirstMultiple();
int length = baseReward.length;
int[][] result ;
if(buyTimes == 1){
length += firstMultiple.length;
result = new int[length][];
int i=0;
for(;i<baseReward.length;i++){
result[i] =baseReward[i];
}
for(int j=0;j<firstMultiple.length;j++){
result[i++] = firstMultiple[j];
}
}else{
result = new int[length][];
int i=0;
for(;i<baseReward.length;i++){
result[i] =baseReward[i];
}
ArrayList<int[][]> list = new ArrayList<>();
if (config.getBaseReward() != null && config.getBaseReward().length > 0){
list.add(config.getBaseReward());
}
return result;
if(buyTimes == 1 && config.getFirstMultiple() != null && config.getFirstMultiple().length > 0){
list.add(config.getFirstMultiple());
}
return list;
}
/**

View File

@ -70,6 +70,8 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
private int isRecommond;
private int[][] extraReward;
private int[][] gainFame;
public static Map<Integer,SRechargeCommodityNewConfig> configMap;
public static Map<String,SRechargeCommodityNewConfig> sdkconfigMap;
public static Map<Integer, List<Integer>> configTypeMap;
@ -224,4 +226,8 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
public int[][] getExtraReward() {
return extraReward;
}
public int[][] getGainFame() {
return gainFame;
}
}