Merge branch 'master_test_gn' into master_test_gn_getRandomCount

back_recharge
lvxinran 2021-06-10 13:49:48 +08:00
commit 17925142bc
20 changed files with 245 additions and 32 deletions

View File

@ -120,15 +120,15 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
LOGGER.info("LOGIN_REQUEST the uid={},the pid={},the gid={},",userId,pid,gid);
//登陆注册入内存
String openIdFront = loginRequest.getOpenId();
String ccId = loginRequest.getCcId();
String[] split = openIdFront.split("\\.");
User user = null;
if(split.length>=2){
String openId = split[0];
String chanel = split[1];
user = UserManager.userLogin(userId,openId,chanel,pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS(),channle_id,bundle_id);
}else{
UserManager.userLogin(userId,openId,chanel,pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS(),channle_id,bundle_id,ccId);
}
user = UserManager.userLogin(userId,openIdFront,"",pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS(),channle_id,bundle_id);
user = UserManager.userLogin(userId,openIdFront,"",pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS(),channle_id,bundle_id,ccId);
user.getPlayerInfoManager().setLastDeviceId(loginRequest.getDeviceIdS());
// String newToken = UserManager.getNewToken(userId);

View File

@ -3,10 +3,10 @@ package com.ljsd.jieling.handler;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import org.springframework.stereotype.Component;
import rpc.protocols.CommonProto;
import rpc.protocols.HeroInfoProto;
import rpc.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
import java.util.List;

View File

@ -52,7 +52,7 @@ public class TakeArenaBattleRewardRequestHandler extends BaseHandler<ArenaInfoPr
arenaManager.getHadTakeReward().add(missionId);
//drop
int[][] reward = sArenaBattleReward.getReward();
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.EXPEDITION_BOX_REWARD);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.ARENA_BOX_REWARD);
return ArenaInfoProto.TakeArenaBattleRewardResponse.newBuilder().setDrop(drop).build();
}
}

View File

@ -94,7 +94,7 @@ public class FamilyFeteRequestHandler extends BaseHandler<Family.FamilyFeteReque
Map<Integer, SGuildLevelConfig> levelConfigMap = STableManager.getConfig(SGuildLevelConfig.class);
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + addexp >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
guildInfo.updateExp(guildInfo.getExp() + addexp - levelConfigMap.get(guildInfo.getLevel()).getExp());
guildInfo.updateLevel(guildInfo.getLevel() + 1);
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), new GuildCache(GameApplication.serverId, guildInfo.getIcon(), guildInfo.getLevel(), guildInfo.getName()));
} else {
guildInfo.updateExp(guildInfo.getExp() + addexp);

View File

@ -2087,19 +2087,28 @@ public class MapLogic {
int uid = session.getUid();
User user = UserManager.getUser(uid);
MainLevelManager mainLevelManager = user.getMainLevelManager();
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(fightId);
LOGGER.info("the uid={},play fightId={}",uid,fightId);
int mineFightId = mainLevelManager.getFightId();
if (mineFightId != fightId || mainLevelManager.getState()!=1) {
if (mineFightId != fightId) {
LOGGER.info("startMainLevelFight==> uid={},fightId={}, levelDifficulty is not allow ", uid, fightId);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
else if (mainLevelManager.getState()!=1){
// 动态匹配最新的表数据
if (sMainLevelConfig != null && sMainLevelConfig.getNextLevel() != -1 && user.getPlayerInfoManager().getLevel() >= sMainLevelConfig.getLevelLimit()){
mainLevelManager.setState(1);
}else {
LOGGER.info("startMainLevelFight==> uid={},fightId={}, levelDifficulty is not allow ", uid, fightId);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
LOGGER.info("startLevelDifficultyFight==> uid={},fightId={},teamId={}", uid, fightId, teamId);
throw new ErrorCodeException(ErrorCode.newDefineCode("阵容有误!!"));
}
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(fightId);
// KtEventUtils.onKtEvent(user,ParamEventBean.UserGameType,KTGameType.STORY.getIndex(),fightId);
ReportUtil.onReportEvent(user, ReportEventEnum.ENTER_STAGE.getType(),String.valueOf(fightId));

View File

@ -34,7 +34,7 @@ public class Cmd_addfete extends GmRoleAbstract {
guildInfo.addFete(addexp);
Map<Integer, SGuildLevelConfig> levelConfigMap = STableManager.getConfig(SGuildLevelConfig.class);
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + addexp >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
guildInfo.updateLevel(guildInfo.getLevel() + 1);
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
guildInfo.updateExp(guildInfo.getExp() + addexp - levelConfigMap.get(guildInfo.getLevel()).getExp());
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), new GuildCache(GameApplication.serverId, guildInfo.getIcon(), guildInfo.getLevel(), guildInfo.getName()));
} else {

View File

@ -0,0 +1,79 @@
package com.ljsd.jieling.kefu;
import com.ljsd.GameApplication;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.RechargeInfo;
import com.ljsd.jieling.logic.dao.root.Recharge;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author lvxinran
* @date 2021/6/11
* @discribe
*/
public class Cmd_recharge extends GmAbstract {
@Override
public boolean exec(String[] args) throws Exception {
int serverId = GameApplication.serverId;
MongoTemplate monogTemplate = MongoUtil.getInstence().getMonogTemplate(serverId);
MongoTemplate coreMongoTemplate = MongoUtil.getCoreMongoTemplate();
Query query = new Query(Criteria.where("_id").ne("100000"));
query.fields().include("playerManager");
long count = monogTemplate.count(query, User.class, "user");
int pageSize = 10;
//分页
for(int i = 0 ; i <count/pageSize+1;i++){
Pageable pageable = new PageRequest(i,pageSize);
List<User> allByCondition = monogTemplate.find(query.with(pageable), User.class,"user");
for(User user:allByCondition){
PlayerManager playerInfoManager = user.getPlayerInfoManager();
System.out.println(user.getId());
NewRechargeInfo newRechargeInfo = playerInfoManager.getNewRechargeInfo();
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
double rr = (rechargeInfo==null?0:rechargeInfo.getSaveAmt())+(newRechargeInfo==null?0:newRechargeInfo.getRr());
if(rr==0){
continue;
}
//判断是否有其他服已经加入过充值信息
Query rechargeQuery = new Query(Criteria.where("_id").is(playerInfoManager.getOpenId()));
Recharge recharge = coreMongoTemplate.findOne(rechargeQuery, Recharge.class, "recharge");
if(recharge==null){
recharge = new Recharge();
recharge.setId(playerInfoManager.getOpenId());
recharge.setRr(rr);
Set<Integer> serverIds = new HashSet<>();
serverIds.add(serverId);
recharge.setServerId(serverIds);
}else{
Set<Integer> serverIds = recharge.getServerId();
if(serverIds!=null&&serverIds.contains(serverId)){
continue;
}
recharge.setRr(recharge.getRr()+rr);
recharge.getServerId().add(serverId);
}
coreMongoTemplate.save(recharge,"recharge");
}
}
System.out.println();
return true;
}
}

View File

@ -1,25 +1,30 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.jbean.ActivityMission;
import com.ljsd.jieling.logic.activity.event.ActivityStateChangeEvent;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.UserLevelEvent;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.Recharge;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.ToolsUtil;
import config.*;
import manager.STableManager;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import util.TimeUtils;
import java.util.ArrayList;
@ -71,6 +76,21 @@ public class UserLevelEventHandler implements IEventHandler,IPrivilegeChange{
}
}
if(level==12){
MongoTemplate coreMongoTemplate = MongoUtil.getCoreMongoTemplate();
Query rechargeQuery = new Query(Criteria.where("_id").is(user.getPlayerInfoManager().getOpenId()));
Recharge recharge = coreMongoTemplate.findOne(rechargeQuery, Recharge.class, "recharge");
if(recharge!=null&&recharge.getRewardServerId()==0){
double rr = recharge.getRr();
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_rebate_title");
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("recharge_rebate_content", new Object[]{(int)rr,(int)rr*10},new int[]{0,0},"#");
MailLogic.getInstance().sendMail(uid,title,content, Global.GEM+"#"+(int)rr*10,(int) (TimeUtils.now() / 1000),Global.MAIL_EFFECTIVE_TIME);
recharge.setRewardServerId(GameApplication.serverId);
coreMongoTemplate.save(recharge,"recharge");
}
}
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.GrowthFund,level);
if(sGlobalSystemConfigs == null){
return;

View File

@ -40,6 +40,8 @@ public class PlayerManager extends MongoBase {
private String nameColor;
private String cc_id;
private int sex;
private int level;
@ -194,6 +196,15 @@ public class PlayerManager extends MongoBase {
this.openId = openId;
}
public String getCc_id() {
return cc_id;
}
public void setCc_id(String cc_id) {
updateString("cc_id", cc_id);
this.cc_id = cc_id;
}
public String getNickName() {
return nickName;
}

View File

@ -75,34 +75,35 @@ public class UserManager {
}
public static User userLogin(int uid,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id) throws Exception {
public static User userLogin(int uid,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id,String ccId) throws Exception {
User user = null;
if (!UserManager.isUserExist(uid)){
user = MongoUtil.getInstence().getMyMongoTemplate().findById(User.getCollectionName(), uid, User.class);
if (user == null) {
user = registerUser(uid,openId,channel,pid,gid,platform,ip,channle_id,bundle_id);
user = registerUser(uid,openId,channel,pid,gid,platform,ip,channle_id,bundle_id,ccId);
}
UserManager.addUser(user);
}else{
user = getUser(uid);
user.getPlayerInfoManager().setGid(gid);
user.getPlayerInfoManager().setPid(pid);
user.getPlayerInfoManager().setCc_id(ccId);
}
return user;
}
private static User registerUser(int uid,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id) throws Exception {
private static User registerUser(int uid,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id,String ccId) throws Exception {
User user = new User(uid);
UserManager.addUser(user);
initPlayer(user,openId,channel,pid,gid,platform,ip,channle_id,bundle_id);
initPlayer(user,openId,channel,pid,gid,platform,ip,channle_id,bundle_id,ccId);
MongoUtil.getInstence().getMyMongoTemplate().save(user.getId(),user);
PlayerLogic.getInstance().sendTestWelfareMail(user,1,1);
return user;
}
private static void initPlayer(User user,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id) throws Exception {
private static void initPlayer(User user,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id,String ccId) throws Exception {
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
PlayerManager playerManager = user.getPlayerInfoManager();
long now = TimeUtils.now();
@ -122,6 +123,7 @@ public class UserManager {
playerManager.setNewRechargeInfo(new NewRechargeInfo());
playerManager.setPhoneBindInfo(new PhoneBindInfo(""));
playerManager.setChannel(channel);
playerManager.setCc_id(ccId);
playerManager.setPid(pid);
playerManager.setGid(gid);
playerManager.setPlatform(platform);

View File

@ -8,10 +8,10 @@ public class GuildHelpLog {
private String targetName;
private int logTime; // time
private int type; // 援助类型
private int helpPracticeLevel;
private int targetPracticeLevel;
private Integer helpPracticeLevel;
private Integer targetPracticeLevel;
public GuildHelpLog(int helpId, int targetId, String helperName, String targetName, int logTime, int type, int helpPracticeLevel, int targetPracticeLevel) {
public GuildHelpLog(int helpId, int targetId, String helperName, String targetName, int logTime, int type, Integer helpPracticeLevel, Integer targetPracticeLevel) {
this.helpId = helpId;
this.targetId = targetId;
this.helperName = helperName;
@ -50,11 +50,17 @@ public class GuildHelpLog {
return type;
}
public int getHelpPracticeLevel() {
public Integer getHelpPracticeLevel() {
if (helpPracticeLevel == null){
helpPracticeLevel = 1;
}
return helpPracticeLevel;
}
public int getTargetPracticeLevel() {
public Integer getTargetPracticeLevel() {
if (targetPracticeLevel == null){
targetPracticeLevel = 1;
}
return targetPracticeLevel;
}
}

View File

@ -0,0 +1,57 @@
package com.ljsd.jieling.logic.dao.root;
import java.util.Set;
/**
* @author lvxinran
* @date 2021/6/11
* @discribe
*/
public class Recharge {
private String id;
private double rr;
private Set<Integer> serverId;
private int rewardServerId;
public Recharge() {
}
public Recharge(String id, double rr, Set<Integer> serverId) {
this.id = id;
this.rr = rr;
this.serverId = serverId;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public double getRr() {
return rr;
}
public void setRr(double rr) {
this.rr = rr;
}
public Set<Integer> getServerId() {
return serverId;
}
public void setServerId(Set<Integer> serverId) {
this.serverId = serverId;
}
public int getRewardServerId() {
return rewardServerId;
}
public void setRewardServerId(int rewardServerId) {
this.rewardServerId = rewardServerId;
}
}

View File

@ -217,7 +217,7 @@ public class GuildChallengeLogic {
Map<Integer, SGuildLevelConfig> levelConfigMap = STableManager.getConfig(SGuildLevelConfig.class);
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + config.getLegionExp() >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp() - levelConfigMap.get(guildInfo.getLevel()).getExp());
guildInfo.updateLevel(guildInfo.getLevel() + 1);
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), new GuildCache(GameApplication.serverId, guildInfo.getIcon(), guildInfo.getLevel(), guildInfo.getName()));
} else {
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());
@ -248,7 +248,7 @@ public class GuildChallengeLogic {
Map<Integer, SGuildLevelConfig> levelConfigMap = STableManager.getConfig(SGuildLevelConfig.class);
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + config.getLegionExp() >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp() - levelConfigMap.get(guildInfo.getLevel()).getExp());
guildInfo.updateLevel(guildInfo.getLevel() + 1);
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), new GuildCache(GameApplication.serverId, guildInfo.getIcon(), guildInfo.getLevel(), guildInfo.getName()));
} else {
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());

View File

@ -818,7 +818,7 @@ public class GuildFightLogic {
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_EXP,"",str,getExp);
if(guildInfo.getExp()+getExp>=levelConfigMap.get(guildInfo.getLevel()).getExp()){
guildInfo.updateExp(guildInfo.getExp()+getExp-levelConfigMap.get(guildInfo.getLevel()).getExp());
guildInfo.updateLevel(guildInfo.getLevel()+1);
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(guildInfo.getId()),new GuildCache(GameApplication.serverId,guildInfo.getIcon(),guildInfo.getLevel(),guildInfo.getName()));
}else{
guildInfo.updateExp(guildInfo.getExp()+getExp);

View File

@ -1248,21 +1248,28 @@ public class GuildLogic {
break;
case 3:
List<SGuildRedPackConfig> serise = SGuildRedPackConfig.welfareRedPackBySerise.get(config.getGroupId());
serise.stream().sorted((v1,v2)->{
if(v1.getId()>v2.getId()){
return -1;
}else{
return 1;
}
});
for(SGuildRedPackConfig c : serise){
if(redPacketsMap.containsKey(c.getId())){
if(redPacketsMap.get(c.getId())>-1){
if(c.getId() == config.getId()){
redPacketsMap.put(c.getId(),1);
break;
}
}else{
continue;
redPacketsMap.put(c.getId(),1);
}
if(c.getId() == config.getId()){
break;
}
continue;
}else{
if(c.getId() == config.getId()){
redPacketsMap.put(config.getId(),1);
}else{
break;
}else{
redPacketsMap.put(c.getId(),1);
}
}
}
@ -1727,4 +1734,14 @@ public class GuildLogic {
}
}
public static void upLevel(GuildInfo guildInfo,int level) throws Exception{
guildInfo.updateLevel(level);
for(int id : guildInfo.getMembers().get(GlobalsDef.CHAIRMAN)) {
User user = UserManager.getUser(id);
if (user == null)
continue;
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.state_level.getType(),level));
}
}
}

View File

@ -1,11 +1,14 @@
package com.ljsd.jieling.logic.mission.event;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.GameMisionType;
import com.ljsd.jieling.logic.mission.MissionType;
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
import com.ljsd.jieling.logic.redpacket.WelfareRedPackEvent;
import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.network.session.ISession;
@ -25,5 +28,6 @@ public class UserLevelEventProcessor implements BaseGameEventProcessor{
ISession session = OnlineUserManager.getSessionByUid(user.getId());
BuyGoodsNewLogic.openPush(session,user,3,upLevel,0);
BuyGoodsNewLogic.sendGiftGooodsIndication(user.getId());
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.player_level.getType(),upLevel));
}
}

View File

@ -8,6 +8,8 @@ public enum WelfareRedPacketType {
game_pokemon(5),
hero_star(6),
soul_demon(7),
player_level(8),
state_level(9),
;
private int type;
WelfareRedPacketType(int type){

View File

@ -831,6 +831,9 @@ public class BuyGoodsNewLogic {
int nowTime = (int)(System.currentTimeMillis()/1000);
for(int i = 1;i<=cDay;i++){
SLuxuryFund fund = SLuxuryFund.getByFoundIdAndDay(type,startDay+i);
if(fund == null){
break;
}
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(type);
String reward = ItemUtil.getMailReward(fund.getreward());
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_"+config.getType()+"_daily_title");

View File

@ -79,6 +79,8 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
public void refresh(){
super.refresh();
setStartTime(System.currentTimeMillis());
setBought(false);
setGetRewardTime(0);
}
private boolean bought ;

View File

@ -247,6 +247,7 @@ public class CBean2Proto {
CommonProto.Hero hero1 = getHero(hero);
CommonProto.Hero.Builder builder = hero1.toBuilder();
builder.setLevel(hero.getLevel(heroManager));
builder.setBreakId(hero.getBreakIdByHongMeng(heroManager));
return builder.build();
}