补充2
parent
584d727dee
commit
b108f8abc9
|
@ -125,28 +125,39 @@ public class BuyGoodsNewLogic {
|
|||
public static void testBuyGoods(ISession session,String goodsId) throws Exception {
|
||||
SRechargeCommodityNewConfig sRechargeCommodityConfig = SRechargeCommodityNewConfig.getConfigById(Integer.parseInt(goodsId));
|
||||
int uid = session.getUid();
|
||||
if (sRechargeCommodityConfig == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
String openId = "test_buy_openId";
|
||||
String orderId = "test_buy_order";
|
||||
int price = (int)sRechargeCommodityConfig.getPrice() *100;
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TEST_BUY_GIGT_GOODS_RESPONSE_VALUE,null,true);
|
||||
sendGoods(uid, goodsId, openId, orderId, TimeUtils.now(), price);
|
||||
}
|
||||
|
||||
/**
|
||||
* gm修改器购买物品
|
||||
* @param user
|
||||
* @param goodsId
|
||||
* @throws Exception
|
||||
*/
|
||||
private void gmBuyGoods(User user, int goodsId) throws Exception {
|
||||
SRechargeCommodityNewConfig sRechargeCommodityConfig = SRechargeCommodityNewConfig.getConfigById(goodsId);
|
||||
if(sRechargeCommodityConfig == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
int price = -999;
|
||||
String openId = "gm-test";
|
||||
String orderId = "111111";
|
||||
if(!GameApplication.serverProperties.isDebug()){
|
||||
if(sRechargeCommodityConfig.getPrice()!=0){
|
||||
throw new ErrorCodeException("In a formal setting");
|
||||
}
|
||||
price = 0;
|
||||
orderId = "free-order";
|
||||
openId = "free-openId";
|
||||
}else{
|
||||
price= (int)sRechargeCommodityConfig.getPrice() *100;
|
||||
}
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TEST_BUY_GIGT_GOODS_RESPONSE_VALUE,null,true);
|
||||
sendGoods(uid, goodsId, openId, orderId,System.currentTimeMillis(), price);
|
||||
// List<Integer> itemList = new ArrayList<>();
|
||||
// for(int[] item:sRechargeCommodityConfig.getBaseReward()){
|
||||
// itemList.add(item[0]);
|
||||
// }
|
||||
String orderId = "gm_modifier";
|
||||
int price = (int)sRechargeCommodityConfig.getPrice() * 100;
|
||||
sendGoods(user.getId(), String.valueOf(goodsId), user.getPlayerInfoManager().getOpenId(), orderId, TimeUtils.now(), price);
|
||||
}
|
||||
|
||||
/**
|
||||
* 非金钱购买类型
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
private static boolean notRmbBuy(String orderId){
|
||||
return "support-order".equals(orderId) || "gm_modifier".equals(orderId) || "test_buy_order".equals(orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,7 +168,6 @@ public class BuyGoodsNewLogic {
|
|||
* @param orderId
|
||||
* @param orderTime
|
||||
* @param amount
|
||||
* @param ext 扩展参数,用作部分渠道上传信息
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -166,10 +176,10 @@ public class BuyGoodsNewLogic {
|
|||
ISession session = OnlineUserManager.getSessionByUid(uid);
|
||||
LOGGER.info("sendGoods to uid={},the goods={},openID={},orderId={},orderTime={},amount={}",uid,sdkGoodsId,openId,orderId,orderTime,amount);
|
||||
int goodsId = 0;
|
||||
SRechargeCommodityNewConfig config ;
|
||||
SRechargeCommodityNewConfig config;
|
||||
if(isNumeric(sdkGoodsId)){
|
||||
goodsId = Integer.parseInt(sdkGoodsId);
|
||||
config =SRechargeCommodityNewConfig.configMap.get(goodsId);
|
||||
config = SRechargeCommodityNewConfig.configMap.get(goodsId);
|
||||
}else {
|
||||
config = SRechargeCommodityNewConfig.sdkconfigMap.get(sdkGoodsId);
|
||||
}
|
||||
|
@ -184,7 +194,7 @@ 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(amount!=-999&&!MathUtils.doubleEquals(amount,price * 100)&&!"support-order".equals(orderId)){
|
||||
if(!notRmbBuy(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);
|
||||
|
@ -202,14 +212,6 @@ public class BuyGoodsNewLogic {
|
|||
}
|
||||
Poster.getPoster().dispatchEvent(new RechargeRewardEvent(user.getId(),(int)price));
|
||||
|
||||
//成功购买
|
||||
// if (goodsId == GlobalsDef.DAILY_GOODS_FAST_ID) {
|
||||
// //每日礼包一键购买之后,把所有单个的每日礼包的购买次数加一
|
||||
// for (int gId : SSpecialConfig.getOnceArrayValue(SSpecialConfig.YIJIANGOUMAI)) {
|
||||
// AbstractWelfareBag pbag = info.getPerpetualMap().get(gId);
|
||||
// pbag.setBuyTimes(pbag.getBuyTimes()+1);
|
||||
// }
|
||||
// }
|
||||
int[] forbid = config.getForbid();
|
||||
if(forbid!=null&&forbid.length>0){
|
||||
//每日礼包一键购买之后,把所有单个的每日礼包的购买次数加一
|
||||
|
@ -229,7 +231,6 @@ public class BuyGoodsNewLogic {
|
|||
info.setRr(MathUtils.doubleAdd(price,info.getRr()));
|
||||
info.setRechargeList(TimeUtils.now(),price);
|
||||
//处理月卡
|
||||
// user.getPlayerInfoManager().getMonthCard();
|
||||
activeMonthCard(user,config.getId());
|
||||
//活动
|
||||
user.getPlayerInfoManager().setRechargedaily(user.getPlayerInfoManager().getRechargedaily()+price);
|
||||
|
@ -262,26 +263,25 @@ public class BuyGoodsNewLogic {
|
|||
if(price>0 && !orderId.equals("support-order")) {
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.RECHARGE_SUCCESS_INDICATION_VALUE,
|
||||
PlayerInfoProto.RechargeSuccessIndication.newBuilder().setOrderId(orderId).build(), true);
|
||||
// 以下为充值上报(数数上报)
|
||||
// Map<Integer, Integer> mapReward = ItemUtil.arrayToMap(dropByBag);
|
||||
// ReportUtil.onReportEvent(user, ReportEventEnum.ORDER_COMPLETE.getType(), orderId, price,
|
||||
// user.getPlayerInfoManager().getBundle_id(),
|
||||
// user.getPlayerInfoManager().getChannel_id(),
|
||||
// String.valueOf(GameApplication.serverId),
|
||||
// String.valueOf(goodsId), config.getName(),
|
||||
// new ArrayList<>(mapReward.keySet()),
|
||||
// new ArrayList<>(mapReward.values()), new Date(),
|
||||
// user.getPlayerInfoManager().getLastDeviceId() == null ? "DEFAULT_DEVICE" : user.getPlayerInfoManager().getLastDeviceId());
|
||||
// 开天上报
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserPayEvent, goodsId, orderId, resultRes.getResultCode(), price);
|
||||
// 上报tapdb
|
||||
// onChargeSuccess(user, price, 0, orderId, cfgType);//充值成功上报
|
||||
|
||||
// kaikianUploadPayInfo(user,orderId,price);
|
||||
}
|
||||
return resultRes;
|
||||
}
|
||||
|
||||
// 数数上报
|
||||
// private static void ReportUploadPayInfo(User user,String orderId,double price){
|
||||
// Map<Integer, Integer> mapReward = ItemUtil.arrayToMap(dropByBag);
|
||||
// ReportUtil.onReportEvent(user, ReportEventEnum.ORDER_COMPLETE.getType(), orderId, price,
|
||||
// user.getPlayerInfoManager().getBundle_id(),
|
||||
// user.getPlayerInfoManager().getChannel_id(),
|
||||
// String.valueOf(GameApplication.serverId),
|
||||
// String.valueOf(goodsId), config.getName(),
|
||||
// new ArrayList<>(mapReward.keySet()),
|
||||
// new ArrayList<>(mapReward.values()), new Date(),
|
||||
// user.getPlayerInfoManager().getLastDeviceId() == null ? "DEFAULT_DEVICE" : user.getPlayerInfoManager().getLastDeviceId());
|
||||
// }
|
||||
|
||||
/**
|
||||
* 如果是开天,增加REST付费上报
|
||||
* @param user
|
||||
|
@ -349,30 +349,30 @@ public class BuyGoodsNewLogic {
|
|||
}
|
||||
}
|
||||
|
||||
private static void onChargeSuccess(User user,double amount,int virtualAmount,String orderId,int cfgType){
|
||||
String currency_type = "CNY";
|
||||
switch (cfgType){
|
||||
case 1:
|
||||
currency_type="CNY";
|
||||
break;
|
||||
case 2:
|
||||
currency_type = "USD";
|
||||
break;
|
||||
default:break;
|
||||
|
||||
}
|
||||
RechargeEvent rechargeEvent = new RechargeEvent();
|
||||
rechargeEvent.setModule("GameAnalysis");
|
||||
rechargeEvent.setIp("");
|
||||
rechargeEvent.setName("charge");
|
||||
rechargeEvent.setIndex(GameApplication.serverProperties.getAppId()==null?"APPID":GameApplication.serverProperties.getAppId());
|
||||
rechargeEvent.setIdentify(String.valueOf(user.getPlayerInfoManager().getOpenId()));
|
||||
rechargeEvent.setProperties(new RechargeEventProp(orderId,amount*100,virtualAmount,currency_type,"",""));
|
||||
String s = DataMessageUtils.sendRechargePost(rechargeEvent);
|
||||
if (s != null && s.equals("1")) {
|
||||
LOGGER.info("{}充值上报成功,价格为{}", user.getPlayerInfoManager().getOpenId(), amount);
|
||||
}
|
||||
}
|
||||
// private static void onChargeSuccess(User user,double amount,int virtualAmount,String orderId,int cfgType){
|
||||
// String currency_type = "CNY";
|
||||
// switch (cfgType){
|
||||
// case 1:
|
||||
// currency_type="CNY";
|
||||
// break;
|
||||
// case 2:
|
||||
// currency_type = "USD";
|
||||
// break;
|
||||
// default:break;
|
||||
//
|
||||
// }
|
||||
// RechargeEvent rechargeEvent = new RechargeEvent();
|
||||
// rechargeEvent.setModule("GameAnalysis");
|
||||
// rechargeEvent.setIp("");
|
||||
// rechargeEvent.setName("charge");
|
||||
// rechargeEvent.setIndex(GameApplication.serverProperties.getAppId()==null?"APPID":GameApplication.serverProperties.getAppId());
|
||||
// rechargeEvent.setIdentify(String.valueOf(user.getPlayerInfoManager().getOpenId()));
|
||||
// rechargeEvent.setProperties(new RechargeEventProp(orderId,amount*100,virtualAmount,currency_type,"",""));
|
||||
// String s = DataMessageUtils.sendRechargePost(rechargeEvent);
|
||||
// if (s != null && s.equals("1")) {
|
||||
// LOGGER.info("{}充值上报成功,价格为{}", user.getPlayerInfoManager().getOpenId(), amount);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 活动变更
|
||||
|
@ -491,12 +491,6 @@ public class BuyGoodsNewLogic {
|
|||
if (bag == null){
|
||||
return;
|
||||
}
|
||||
/*long now = TimeUtils.now();
|
||||
// 时间验证
|
||||
if (now < bag.getStartTime() || now > bag.getRefreshTime()){
|
||||
return;
|
||||
}*/
|
||||
|
||||
Map<Integer, SMonthcardConfig> monthcardConfigMap = STableManager.getConfig(SMonthcardConfig.class);
|
||||
boolean sendneed =false;
|
||||
for (SMonthcardConfig monthcardConfig : monthcardConfigMap.values()) {
|
||||
|
|
Loading…
Reference in New Issue