仙充卡线下返利

back_recharge
duhui 2023-02-01 14:18:07 +08:00
parent 5745c2f764
commit 1cdb30a18e
11 changed files with 126 additions and 110 deletions

View File

@ -5,6 +5,7 @@ import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.dao.GuilidManager;
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
@ -16,6 +17,8 @@ import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
import config.SErrorCodeEerverConfig;
import config.SWorldBossRewardConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.ZSetOperations;
import util.TimeUtils;
@ -25,6 +28,8 @@ import java.util.Set;
import java.util.TreeMap;
public class CarDelayFunction implements FunctionManager {
private static final Logger LOGGER = LoggerFactory.getLogger(CarDelayFunction.class);
@Override
public void startAction(TimeControllerOfFunction timeControllerOfFunction) throws Exception {
@ -43,7 +48,7 @@ public class CarDelayFunction implements FunctionManager {
RedisUtil.getInstence().rename(60*60*16, backName, delKeys);
// String userLevelGuild = RedisUtil.getInstence().getKey(RedisKey.USER_LEVEL_GUILD_INFO, "");
// delKeys.add(userLevelGuild);
System.out.println("车迟斗法备份排行榜:"+ Arrays.asList(delKeys));
LOGGER.error("车迟斗法备份排行榜:{}",Arrays.asList(delKeys));
MongoUtil.getLjsdMongoTemplate().lastUpdate();
}

View File

@ -16,7 +16,6 @@ import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
import com.ljsd.jieling.logic.family.GuildFightLogic;
import com.ljsd.jieling.logic.fight.*;
import com.ljsd.jieling.logic.fight.result.FightResult;
@ -86,7 +85,7 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
privilege = sWorldBossSetting.getPrivilege()[type - 1];
boolean b = PlayerLogic.getInstance().check(user, privilege, 1);
if(!b){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"次数不足");
}
} else {
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);

View File

@ -82,7 +82,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
User user = UserManager.getUser(userId);
QuestionLogic.getInstence().onLogin(user);
PlayerManager playerInfoManager = user.getPlayerInfoManager();
PlayerLogic.getInstance().checkOldMonthCard(user);
// PlayerLogic.getInstance().checkOldMonthCard(user);
ActivityLogic.getInstance().flushForLogin(user,iSession);
GlobalDataManaager.checkNeedReFlush(iSession,user,null);
BuyGoodsNewLogic.refreshWelfareState(user);
@ -184,7 +184,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
remove.removeAll(user.getItemManager().getItemMap().keySet());
remove.forEach(n->{
try {
LOGGER.info("GET_PLAYERINFO_REQUEST uid n = {}", userId, n);
LOGGER.info("GET_PLAYERINFO_REQUEST uid n = {}, {}", userId, n);
user.getItemManager().newItem(n, 0);
}catch (Exception e){
e.printStackTrace();

View File

@ -4,8 +4,6 @@ import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.activity.event.AutoRechargeBackEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
@ -56,11 +54,6 @@ public class GmBuyGoodHandler extends BaseHandler<PlayerInfoProto.GmBuyGoodReque
if (!cost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
// 仙充记录线下返利
if (master.getType() == 8){
Poster.getPoster().dispatchEvent(new AutoRechargeBackEvent(user.getId(),goodsId,"gm_modifier"));
}
// 走礼包逻辑发送奖励
BuyGoodsNewLogic.gmBuyGoods(iSession, goodsId);
}

View File

@ -1,20 +1,11 @@
package com.ljsd.jieling.logic;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.reportData.DataMessageUtils;
import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.TeamEnum;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.util.http.HttpPool;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.TimeUtils;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
/**
*
@ -50,35 +41,35 @@ public class AiWanPlayerInfoUpload {
* @param type
*/
public void upload(User user, String type){
// 只有爱玩的服务器需要上报
if (!app_id.equals(GameApplication.serverProperties.getAiwanAppId())){
return;
}
PlayerManager playerInfoManager = user.getPlayerInfoManager();
int force = user.getTeamPosManager().getTeamForceMap().getOrDefault(TeamEnum.FORMATION_NORMAL.getTeamId(),0L).intValue();
int nowInt = TimeUtils.nowInt();
SortedMap<String, Object> extMap = new TreeMap<>();
extMap.put("power",force);
extMap.put("stage",user.getMainLevelManager().getFightId());
SortedMap<String, Object> map = new TreeMap<>();
map.put("appid",app_id);
map.put("serverid",String.valueOf(GameApplication.serverId));
map.put("openid", playerInfoManager.getOpenId());
map.put("roleid",String.valueOf(user.getId()));
map.put("posttime",nowInt);
map.put("level",playerInfoManager.getLevel());
map.put("ext",DataMessageUtils.gson.toJson(extMap));
// 制作sign
String sign = getSign(map);
map.put("sign",sign);
// 以下3个参数不参加sign
map.put("eventtype",type);
map.put("nickname",playerInfoManager.getNickName());
map.put("regtime",(playerInfoManager.getCreateTime()/1000));
// 请求url
String result = HttpPool.sendPost2(url, DataMessageUtils.gson.toJson(map));
LOGGER.info("爱玩玩家信息上报 uid={} 返回结果={} 参数={}", user.getId(), result, map);
// // 只有爱玩的服务器需要上报
// if (!app_id.equals(GameApplication.serverProperties.getAiwanAppId())){
// return;
// }
// PlayerManager playerInfoManager = user.getPlayerInfoManager();
// int force = user.getTeamPosManager().getTeamForceMap().getOrDefault(TeamEnum.FORMATION_NORMAL.getTeamId(),0L).intValue();
// int nowInt = TimeUtils.nowInt();
// SortedMap<String, Object> extMap = new TreeMap<>();
// extMap.put("power",force);
// extMap.put("stage",user.getMainLevelManager().getFightId());
//
// SortedMap<String, Object> map = new TreeMap<>();
// map.put("appid",app_id);
// map.put("serverid",String.valueOf(GameApplication.serverId));
// map.put("openid", playerInfoManager.getOpenId());
// map.put("roleid",String.valueOf(user.getId()));
// map.put("posttime",nowInt);
// map.put("level",playerInfoManager.getLevel());
// map.put("ext",DataMessageUtils.gson.toJson(extMap));
// // 制作sign
// String sign = getSign(map);
// map.put("sign",sign);
// // 以下3个参数不参加sign
// map.put("eventtype",type);
// map.put("nickname",playerInfoManager.getNickName());
// map.put("regtime",(playerInfoManager.getCreateTime()/1000));
// // 请求url
// String result = HttpPool.sendPost2(url, DataMessageUtils.gson.toJson(map));
// LOGGER.info("爱玩玩家信息上报 uid={} 返回结果={} 参数={}", user.getId(), result, map);
}
private static String getSign(Map<String, Object> map){

View File

@ -30,7 +30,6 @@ import com.ljsd.jieling.logic.hardStage.HardStageLogic;
import com.ljsd.jieling.logic.help.HelpHeroLogic;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.home.ArchitectureUnLockHandler;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.GameMisionType;
import com.ljsd.jieling.logic.mission.data.DataManagerDistributor;
@ -571,7 +570,7 @@ public class GlobalDataManaager implements IManager {
}
public TimeControllerOfFunction getOpenTimeOfFuntionCacheByType(FunctionIdEnum functionIdEnum ) {
public TimeControllerOfFunction getOpenTimeOfFuntionCacheByType(FunctionIdEnum functionIdEnum) {
if (functionIdEnum == null){
return null;
}

View File

@ -46,6 +46,8 @@ public class GmActivityLogic implements IEventHandler {
Poster.getPoster().listenEvent(this, AutoRechargeBackEvent.class);
}
public static final String item_token = "item_token";
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof AutoRechargeBackEvent)){
@ -55,10 +57,22 @@ public class GmActivityLogic implements IEventHandler {
if (rechargeBackEvent.getGiftId() <= 0){
return;
}
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(rechargeBackEvent.getGiftId());
if (config == null){
double price = 0;
String method = rechargeBackEvent.getRechargeMethod();
if (method.equals(item_token)){
price = rechargeBackEvent.getGiftId();
}else {
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(rechargeBackEvent.getGiftId());
if (config != null){
price = config.getPrice();
}
}
if (price <= 0){
return;
}
User user = UserManager.getUser(rechargeBackEvent.getUserId());
GmActivityManager manager = user.getGmActivityManager();
Map<String, ARBActivity> arbActivityMap = getArbActivity();
@ -76,16 +90,16 @@ public class GmActivityLogic implements IEventHandler {
GmActivity gmActivity = manager.getActivityMap().getOrDefault(entry.getKey(), new GmActivity(arbActivity));
switch (gmActivity.getType()){
case 1://单日累充
getRewardToSingleTotalRecharge(user, gmActivity, config.getPrice());
getRewardToSingleTotalRecharge(user, gmActivity, price);
break;
case 2://妖晶返利
getRewardToMonsterCurrencyBack(user, gmActivity, config.getPrice());
getRewardToMonsterCurrencyBack(user, gmActivity, price);
break;
case 4://单笔充值
getRewardToSingleRecharge(user, gmActivity, config.getPrice());
getRewardToSingleRecharge(user, gmActivity, price);
break;
default://3、5、6多日累充永久大充开服首日累充
getDefaultReward(user, gmActivity,config.getPrice());
getDefaultReward(user, gmActivity, price);
break;
}
manager.putActivityMap(gmActivity.getId(),gmActivity);

View File

@ -33,4 +33,12 @@ public class AutoRechargeBackEvent implements IEvent {
public void setGiftId(int giftId) {
this.giftId = giftId;
}
public void setRechargeMethod(String rechargeMethod) {
this.rechargeMethod = rechargeMethod;
}
public String getRechargeMethod() {
return rechargeMethod;
}
}

View File

@ -47,7 +47,6 @@ import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
import com.ljsd.jieling.logic.mission.main.ServenMissionIdsType;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
import com.ljsd.jieling.network.session.ISession;
@ -67,8 +66,6 @@ import util.TimeUtils;
import java.util.*;
import java.util.stream.Collectors;
import static com.ljsd.jieling.logic.store.BuyGoodsNewLogic.refreshUnitWF;
public class PlayerLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(PlayerLogic.class);
private PlayerLogic(){
@ -1661,39 +1658,39 @@ public class PlayerLogic {
* @throws Exception
*/
public void checkOldMonthCard(User user) throws Exception {
PlayerManager playerInfoManager = user.getPlayerInfoManager();
if (playerInfoManager.getOldMonthCardMark() == 1){
return;
}
double rmb = playerInfoManager.getNewRechargeInfo().getRr();
long createTime = playerInfoManager.getCreateTime();
long format2 = TimeUtils.dateFormat2("2022-06-14 00:00:00");
playerInfoManager.setMonthCard(new HashMap<>());
if (createTime < format2 && rmb >= 100){
Map<Integer, SMonthcardConfig> configMap = STableManager.getConfig(SMonthcardConfig.class);
for (SMonthcardConfig config : configMap.values()) {
int goodId = config.getPrice();
SRechargeCommodityNewConfig newConfig = SRechargeCommodityNewConfig.getConfigById(goodId);
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(newConfig.getOtype());
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(goodId);
if (bag == null){
bag = rechargeHandler.initUnitWF(user, newConfig);
refreshUnitWF(bag,user);
rechargeHandler.addNew(user,bag);
}
boolean bol = bag.buy();
if (!bol){
LOGGER.error("老玩家月卡兼容报错礼包已购买uid{}goodid{}",user.getId(),goodId);
continue;
}
BuyGoodsNewLogic.activePrivilege(user,newConfig);
BuyGoodsNewLogic.activeMonthCard(user,goodId);
}
}
playerInfoManager.setOldMonthCardMark(1);
// PlayerManager playerInfoManager = user.getPlayerInfoManager();
// if (playerInfoManager.getOldMonthCardMark() == 1){
// return;
// }
//
// double rmb = playerInfoManager.getNewRechargeInfo().getRr();
//
// long createTime = playerInfoManager.getCreateTime();
// long format2 = TimeUtils.dateFormat2("2022-06-14 00:00:00");
//
// playerInfoManager.setMonthCard(new HashMap<>());
// if (createTime < format2 && rmb >= 100){
// Map<Integer, SMonthcardConfig> configMap = STableManager.getConfig(SMonthcardConfig.class);
// for (SMonthcardConfig config : configMap.values()) {
// int goodId = config.getPrice();
// SRechargeCommodityNewConfig newConfig = SRechargeCommodityNewConfig.getConfigById(goodId);
// RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(newConfig.getOtype());
// AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(goodId);
// if (bag == null){
// bag = rechargeHandler.initUnitWF(user, newConfig);
// refreshUnitWF(bag,user);
// rechargeHandler.addNew(user,bag);
// }
// boolean bol = bag.buy();
// if (!bol){
// LOGGER.error("老玩家月卡兼容报错礼包已购买uid{}goodid{}",user.getId(),goodId);
// continue;
// }
// BuyGoodsNewLogic.activePrivilege(user,newConfig);
// BuyGoodsNewLogic.activeMonthCard(user,goodId);
// }
// }
// playerInfoManager.setOldMonthCardMark(1);
}
/**

View File

@ -1,12 +1,9 @@
package com.ljsd.jieling.logic.store;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.json.ServerProperties;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
@ -294,7 +291,7 @@ public class BuyGoodsNewLogic {
if(config.getPrice()!=0&&mail!=null&&mail.length>1){
String title = SErrorCodeEerverConfig.getI18NMessage(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);
MailLogic.getInstance().sendMail(uid,title,content,"",TimeUtils.nowInt(),Global.MAIL_EFFECTIVE_TIME);
}
notifyPaySuccessFul(uid,goodsId,amount != -999);
@ -304,10 +301,11 @@ public class BuyGoodsNewLogic {
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),config.getId(),1,1));
// 更新入库
MongoUtil.getLjsdMongoTemplate().lastUpdate();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.RECHARGE_SUCCESS_INDICATION_VALUE,
PlayerInfoProto.RechargeSuccessIndication.newBuilder().setOrderId(orderId).build(), true);
// 扶持订单不需要上报
if(price>0 && isRmbBuy(orderId)) {
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.RECHARGE_SUCCESS_INDICATION_VALUE,
PlayerInfoProto.RechargeSuccessIndication.newBuilder().setOrderId(orderId).build(), true);
// 开天上报
KtEventUtils.onKtEvent(user, ParamEventBean.UserPayEvent, goodsId, orderId, resultRes.getResultCode(), price);
}
@ -514,15 +512,19 @@ public class BuyGoodsNewLogic {
//礼包开启活动
if(type ==GiftGoodsType.DailyPreferentialGift){
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityById(ActivityType.DAILY_PREFERENTIAL_GIFT);
abstractActivity.initActivity(user);
if (abstractActivity != null){
abstractActivity.initActivity(user);
}
}
if(type ==GiftGoodsType.WholeLife){
if(type == GiftGoodsType.WholeLife){
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityById(9901);
abstractActivity.initActivity(user);
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(9901);
activityMission.setV(2);
activityMission.setCreatTime(TimeUtils.now());
user.getActivityManager().getActivityMissionMap().put(9901, activityMission);
if (abstractActivity != null) {
abstractActivity.initActivity(user);
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(9901);
activityMission.setV(2);
activityMission.setCreatTime(TimeUtils.now());
user.getActivityManager().getActivityMissionMap().put(9901, activityMission);
}
}
if(drop!=null&&session!=null){
PlayerInfoProto.DirectBuyIndication build = PlayerInfoProto.DirectBuyIndication.newBuilder().setDrop(drop).build();
@ -555,7 +557,7 @@ public class BuyGoodsNewLogic {
}
sendneed=true;
// 当天零点
int beginOfDay = (int) (TimeUtils.getBeginOfDay(TimeUtils.now())/1000);
int beginOfDay = (int) (TimeUtils.getBeginOfDay(TimeUtils.nowInt()));
user.getPlayerInfoManager().putMonthCard(monthcardConfig.getId(), beginOfDay);
// 特殊处理
if (monthcardConfig.getId() == Global.LMONTHCARDID){
@ -591,7 +593,12 @@ public class BuyGoodsNewLogic {
// btVIP等级提升
if (getbTVIPlevel != null && getbTVIPlevel.length > 0){
for (int[] vip : getbTVIPlevel) {
user.getPlayerInfoManager().putBtVipLevel(vip[0],vip[1]);
int type = vip[0];
int value = vip[1];
Integer orDefault = user.getPlayerInfoManager().getBtVipLevel().getOrDefault(type, 0);
if (value > orDefault){
user.getPlayerInfoManager().putBtVipLevel(type, value);
}
}
LOGGER.info("********************bt vip等级提升{}", StringUtil.parseArrayToString(getbTVIPlevel));
}

View File

@ -18,6 +18,7 @@ import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.ActivityType;
import com.ljsd.jieling.logic.activity.activityLogic.GmActivityLogic;
import com.ljsd.jieling.logic.activity.event.*;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
@ -1452,9 +1453,11 @@ public class ItemUtil {
combineRewardDropGroup(user,sItem.getRewardGroup(),1, itemMap);
Poster.getPoster().dispatchEvent(new TotalItemEvent(user.getId(),itemMap));
// 单笔充值
if (sItem.getItemType() == GlobalItemType.XIAN_RECHARGE_CARD || sItem.getItemType() == GlobalItemType.DAY_XIAN_RECHARGE_CARD){
// 单笔充值
Poster.getPoster().dispatchEvent(new SingleRechargeEvent(user.getId(),num));
// 线下自动返利
Poster.getPoster().dispatchEvent(new AutoRechargeBackEvent(user.getId(),num, GmActivityLogic.item_token));
}
return true;
}