Merge branch 'master_test_gn_mcz' of http://60.1.1.230/backend/jieling_server into master_test_gn_mcz

back_recharge
mengchengzhen 2021-04-26 17:29:25 +08:00
commit 2019129057
3 changed files with 21 additions and 58 deletions

View File

@ -126,11 +126,11 @@ public class BuyGoodsNewLogic {
openId = "free-openId";
}
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TEST_BUY_GIGT_GOODS_RESPONSE_VALUE,null,true);
Result result = sendGoods(uid, goodsId, openId, orderId,System.currentTimeMillis(), price);
List<Integer> itemList = new ArrayList<>();
for(int[] item:sRechargeCommodityConfig.getBaseReward()){
itemList.add(item[0]);
}
sendGoods(uid, goodsId, openId, orderId,System.currentTimeMillis(), price);
// List<Integer> itemList = new ArrayList<>();
// for(int[] item:sRechargeCommodityConfig.getBaseReward()){
// itemList.add(item[0]);
// }
}
public static Result sendGoods(int uid, String sdkGoodsId, String openId, String orderId, long orderTime, int amount) throws Exception {
@ -178,8 +178,9 @@ public class BuyGoodsNewLogic {
pbag.setBuyTimes(pbag.getBuyTimes()+1);
}
}
rewardStr = bag.sendGoods();
sendGoodsByType(user,config,rewardStr);
//发货
sendGoodsByType(user,config);
if(config.getAccumulativeRecharge() == 1){
info.setRr(MathUtils.doubleAdd(price,info.getRr()));
//处理月卡
@ -195,8 +196,18 @@ public class BuyGoodsNewLogic {
//处理特权
activePrivilege(user,config);
resultRes.setResultCode(1);
//发送邮件
int[] mail = config.getMail();
if(mail!=null&&mail.length>1){
String title = SErrorCodeEerverConfig.errorMap.get(mail[0]).getkey();
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert(SErrorCodeEerverConfig.errorMap.get(mail[1]).getkey(), new Object[]{config.getName()}, new int[]{1}, "#");
MailLogic.getInstance().sendMail(uid,title,content,"",(int) (TimeUtils.now() / 1000),Global.MAIL_EFFECTIVE_TIME);
}
notifyPaySuccessFul(uid,goodsId,amount != -999);
// Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),goodsId));
MongoUtil.getLjsdMongoTemplate().lastUpdate();
sendGiftGoodsWithoutJudge(uid);
@ -304,12 +315,12 @@ public class BuyGoodsNewLogic {
/**
*
*/
public static void sendGoodsByType(User user,SRechargeCommodityNewConfig config,String rewardStr) throws Exception{
public static void sendGoodsByType(User user,SRechargeCommodityNewConfig config) throws Exception{
ISession session = OnlineUserManager.getSessionByUid(user.getId());
int type = config.getType();
CommonProto.Drop.Builder drop = ItemUtil.drop(user, config.getBaseReward(), BIReason.DIRECT_BUY);
//直购礼包
if(type == GiftGoodsType.DIRECTBAG){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, config.getBaseReward(), BIReason.DIRECT_BUY);
if(session!=null){
PlayerInfoProto.DirectBuyIndication build = PlayerInfoProto.DirectBuyIndication.newBuilder().setDrop(drop).build();
@ -317,8 +328,6 @@ public class BuyGoodsNewLogic {
}
}else{
if(type== GiftGoodsType.GEM || type==GiftGoodsType.MONTHCARD || type==GiftGoodsType.LUXURYMONTHCARD){
}
if(type==GiftGoodsType.RED_PACKET){
//红包事件
Poster.getPoster().dispatchEvent(new BuyGoodsDirectEvent(user.getId(),config.getId()));
@ -338,22 +347,6 @@ public class BuyGoodsNewLogic {
.setHadBuy(user.getPlayerInfoManager().getHadBuyTreasure()).setLevel(user.getPlayerInfoManager().getTreasureLevel()).build();
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()),1,MessageTypeProto.MessageType.TREASURE_LEVELUP_INDICATION_VALUE,indication,true);
}
String title = "";
String content ="";
int titleId = (config.getMail()==null || config.getMail().length<1)?-1:config.getMail()[0];
int contentId = (config.getMail()==null || config.getMail().length<1)?-1:config.getMail()[1];
if(titleId != -1){
title = SErrorCodeEerverConfig.getMsgById(titleId);
}
if(contentId != -1){
content = SErrorCodeEerverConfig.getMsgById(contentId);
}
//发货
if(!rewardStr.isEmpty()){
int nowTime =(int) (TimeUtils.now()/1000);
MailLogic.getInstance().sendMail(user.getId(),title,content,rewardStr,nowTime, Global.MAIL_EFFECTIVE_TIME);
}
}
}

View File

@ -91,36 +91,6 @@ public class AbstractWelfareBag extends MongoBase{
return true;
}
public String sendGoods() throws Exception{
String rewardStr="";
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(modId);
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];
}
}
rewardStr = ItemUtil.getMailReward(result);
return rewardStr;
}
/**
*
*/

View File

@ -10,7 +10,7 @@ import java.util.concurrent.ConcurrentHashMap;
@Table(name ="ErrorCodeEerverConfig")
public class SErrorCodeEerverConfig implements BaseConfig {
private static Map<String ,SErrorCodeEerverConfig> errorCodeMap;
private static Map<Integer,SErrorCodeEerverConfig> errorMap;
public static Map<Integer,SErrorCodeEerverConfig> errorMap;
private int id;
private String key;