parent
0367a54aca
commit
628edce335
|
|
@ -89,31 +89,6 @@ public interface GlobalsDef {
|
|||
int ARENA_ROBOT_TYPE=0;
|
||||
int ARENA_PLAYER_TYPE=1;
|
||||
|
||||
//队伍 以后队伍id全部道【TeamEnum】类去配置
|
||||
// int FORMATION_NORMAL = 1;//主线编队
|
||||
// int TEAM_ARENA_DEFENSE =101;//竞技场防御编队
|
||||
// int TEAM_ARENA_ATTACH =201;//竞技场进攻编队
|
||||
// int TRIAL_TEAM = 301;//森罗环境编队
|
||||
// int ENDLESS_TEAM = 401;//无尽编队
|
||||
// int BLOODY_TEAM =701; //血战队伍
|
||||
// int CHAMPION_ATTACK_TEAM =801; //
|
||||
// int EXPEDITION_TEAM =1001; //
|
||||
// int CAR_DELAY_TEAM =1101; //车迟斗法
|
||||
// int DEATH_PATH_TEAM = 1201;//十绝阵
|
||||
// int CHAMPION_TEAM = 1301; //巅峰赛
|
||||
// int WORLD_TEAM_ARENA_DEFENSE =1601;//跨服竞技场防御编队
|
||||
// int HARD_STAGE_TEAM = 1701;//山河社稷图队伍
|
||||
// int VICE_HARD_STAGE_TEAM =1801;//山河社稷图副关卡
|
||||
// int TASUILINGXIAO_CHALLENGE = 1901;//踏碎凌霄挑战记录
|
||||
// int CROSS_YU_XU_LUN_DAO_ONE =2001;//玉虚论道第一编队
|
||||
// int CROSS_YU_XU_LUN_DAO_TWO =2002;//玉虚论道第二编队
|
||||
// int CROSS_YU_XU_LUN_DAO_THREE =2003;//玉虚论道第三编队
|
||||
// // 四灵试炼
|
||||
// int FOURCHALLENGE_PEOPLE_TEAM = 3001;
|
||||
// int FOURCHALLENGE_BUDDHA_TEAM = 3002;
|
||||
// int FOURCHALLENGE_MONSTER_TEAM = 3003;
|
||||
// int FOURCHALLENGE_MORALITY_TEAM = 3004;
|
||||
|
||||
//特权解锁类型
|
||||
int LEVEL_UNLOCK_PRIVILEGE = 1;
|
||||
int MAIN_LEVEL_UNLOCK_PRIVILEGE = 2;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
|||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/23
|
||||
* @discribe
|
||||
*/
|
||||
public class ArenaFunction implements FunctionManager {
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import com.ljsd.jieling.jbean.gm.GmActivity;
|
|||
import com.ljsd.jieling.jbean.gm.GmActivityManager;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.AiWanPlayerInfoUpload;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
|
|
@ -26,6 +25,7 @@ import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
|||
import com.ljsd.jieling.logic.activity.ChoiceDrawCardActivity;
|
||||
import com.ljsd.jieling.logic.activity.LimitRandomSpecialMonsterActivityNew;
|
||||
import com.ljsd.jieling.logic.activity.activityLogic.GmActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
|
|
@ -281,7 +281,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.addAllFaBaoSoulInfos(faBaoSoulInfos)
|
||||
.addAllLifeGridInfos(getLifeGridInfos(heroManager))
|
||||
.build();
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
|
||||
|
||||
try {
|
||||
Poster.getPoster().dispatchEvent(new HomeEvent(user.getId()));// 家园建筑解锁
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),SuperBoxEvent.default_id));// 惊喜礼盒
|
||||
|
|
@ -290,21 +290,19 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
endLessTreasureHandler(user);// 无尽秘宝处理
|
||||
expeditionTreasureHandler(user);// 天宫秘宝刷新
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,0,user);
|
||||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.WorldLevelIndication_VALUE, PlayerInfoProto.WorldLevelIndication.newBuilder().setWorldLeve(GlobleSystemLogic.getGlobalWorldLevelCache()).build(), true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
|
||||
// 爱玩信息上报
|
||||
AiWanPlayerInfoUpload.getInstance().upload(user,AiWanPlayerInfoUpload.entersvr);
|
||||
|
||||
if(playerInfoManager.getIsdayFirst()==0){
|
||||
playerInfoManager.setIsdayFirst(1);
|
||||
}
|
||||
RedisUtil.getInstence().set(RedisKey.USER_LOGIN_URL + userId, RPCServerTask.userCallBackUrl);
|
||||
RedisUtil.getInstence().expire(RedisKey.USER_LOGIN_URL + userId, 86400 * 30);
|
||||
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//登陆更新数据
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.WorldLevelIndication_VALUE, PlayerInfoProto.WorldLevelIndication.newBuilder().setWorldLeve(GlobleSystemLogic.getGlobalWorldLevelCache()).build(), true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
}
|
||||
|
||||
private static Map<Integer, Integer> map = new HashMap<>(6);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import org.springframework.data.redis.core.ZSetOperations;
|
|||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.world.WorldProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
|
@ -185,7 +186,7 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
|||
builder.setResult(fightResult.getResult());
|
||||
String s = KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD, iSession.getUid());
|
||||
builder.setRecordId(s);
|
||||
builder.setAttackTime((int)(System.currentTimeMillis()/1000));
|
||||
builder.setAttackTime(TimeUtils.nowInt());
|
||||
//record
|
||||
builder.setRedEnemy(arenaAttack);
|
||||
builder.setBlueEnemy(arenaEnemys);
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ public class CrossServiceLogic {
|
|||
csPlayer.setSex(p.getSex());
|
||||
csPlayer.setUserMount(p.getUserMount());
|
||||
csPlayer.setGuildId(p.getGuildId());
|
||||
csPlayer.setOffLineTime(p.getOffLineTime());
|
||||
//玉虚三个队伍总战力
|
||||
int force1 = user.getTeamPosManager().getTeamForceMap().getOrDefault(TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId(),0L).intValue();
|
||||
int force2 = user.getTeamPosManager().getTeamForceMap().getOrDefault(TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId(),0L).intValue();
|
||||
|
|
@ -121,16 +122,6 @@ public class CrossServiceLogic {
|
|||
return csPlayer;
|
||||
}
|
||||
|
||||
|
||||
public static void updateCsPlayer(int uid){
|
||||
User user = PlayerLogic.getInstance().getUserByRpc(uid);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
CSPlayer player = formatUserToPlayer(user);
|
||||
RedisUtil.getInstence().setObject(getKey(player.getUserId()), player, EXPIRE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 跨服获取玩家信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class ArenaLogic {
|
|||
return viewSeason;
|
||||
}
|
||||
|
||||
public List<CommonProto.ArenaEnemy> getArenaEnemyList(List<ArenaEnemy> arenaEnemies) throws Exception {
|
||||
public List<CommonProto.ArenaEnemy> getArenaEnemyList(List<ArenaEnemy> arenaEnemies) {
|
||||
List<CommonProto.ArenaEnemy> arenaEnemyList = new ArrayList<>(arenaEnemies.size());
|
||||
for(ArenaEnemy arenaEnemy : arenaEnemies){
|
||||
int enemyId = arenaEnemy.getEnemyId();
|
||||
|
|
@ -89,9 +89,7 @@ public class ArenaLogic {
|
|||
arenaEnemyList.add(getArenaEnemy(enemyId,enemyType));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
return arenaEnemyList;
|
||||
}
|
||||
|
|
@ -168,37 +166,35 @@ public class ArenaLogic {
|
|||
|
||||
}
|
||||
|
||||
|
||||
public CommonProto.ArenaEnemy getUserArenaEnemy(int enemyId ,int teamId) throws Exception {
|
||||
|
||||
User user = UserManager.getUser(enemyId);
|
||||
int totalForce = HeroLogic.getInstance().calTeamTotalForce(user, teamId,false);
|
||||
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||
List<Integer> heroTids = new ArrayList<>(teamPosHeroInfoList.size());
|
||||
for(TeamPosHeroInfo teamPosHeroInfo:teamPosHeroInfoList){
|
||||
heroTids.add(heroMap.get(teamPosHeroInfo.getHeroId()).getTemplateId());
|
||||
}
|
||||
CommonProto.Team teamBuild = CommonProto.Team.newBuilder().addAllHeroTid(heroTids).build();
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
int score = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK, Integer.toString(curSeason), Integer.toString(enemyId)).intValue();
|
||||
if(score == -1){
|
||||
score = SArenaSetting.getSArenaSetting().getScore();
|
||||
}
|
||||
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
|
||||
.setUid(enemyId)
|
||||
.setLevel(playerInfoManager.getLevel())
|
||||
.setName(playerInfoManager.getNickName())
|
||||
.setScore(score)
|
||||
.setHead(playerInfoManager.getHead())
|
||||
.setTotalForce(totalForce)
|
||||
.build();
|
||||
return CommonProto.ArenaEnemy.newBuilder()
|
||||
.setPersonInfo(personInfoBuild)
|
||||
.setTeam(teamBuild)
|
||||
.build();
|
||||
|
||||
}
|
||||
// public CommonProto.ArenaEnemy getUserArenaEnemy(int enemyId ,int teamId) throws Exception {
|
||||
// User user = UserManager.getUser(enemyId);
|
||||
// int totalForce = HeroLogic.getInstance().calTeamTotalForce(user, teamId,false);
|
||||
// List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
// Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||
// List<Integer> heroTids = new ArrayList<>(teamPosHeroInfoList.size());
|
||||
// for(TeamPosHeroInfo teamPosHeroInfo:teamPosHeroInfoList){
|
||||
// heroTids.add(heroMap.get(teamPosHeroInfo.getHeroId()).getTemplateId());
|
||||
// }
|
||||
// CommonProto.Team teamBuild = CommonProto.Team.newBuilder().addAllHeroTid(heroTids).build();
|
||||
// PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
// int score = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK, Integer.toString(curSeason), Integer.toString(enemyId)).intValue();
|
||||
// if(score == -1){
|
||||
// score = SArenaSetting.getSArenaSetting().getScore();
|
||||
// }
|
||||
// CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
|
||||
// .setUid(enemyId)
|
||||
// .setLevel(playerInfoManager.getLevel())
|
||||
// .setName(playerInfoManager.getNickName())
|
||||
// .setScore(score)
|
||||
// .setHead(playerInfoManager.getHead())
|
||||
// .setTotalForce(totalForce)
|
||||
// .build();
|
||||
// return CommonProto.ArenaEnemy.newBuilder()
|
||||
// .setPersonInfo(personInfoBuild)
|
||||
// .setTeam(teamBuild)
|
||||
// .build();
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
public void setMyArenaEnemys(int uid,User user){
|
||||
|
|
@ -482,9 +478,6 @@ public class ArenaLogic {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Sa: 实际胜负值, 胜 = 1 负=0
|
||||
|
|
@ -513,10 +506,6 @@ public class ArenaLogic {
|
|||
* 3:boss记录
|
||||
* 4:四灵试炼战斗记录,【fightId格式为:类型#层数#类别(0:首次,1:最低)】
|
||||
* 例子:人塔1层首通:1#1#0,佛塔1层最低:2#1#1
|
||||
* @param iSession
|
||||
* @param type
|
||||
* @param fightId
|
||||
* @throws Exception
|
||||
*/
|
||||
public void getFightReplayData(ISession iSession,int type,String fightId) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
|
|
@ -558,8 +547,6 @@ public class ArenaLogic {
|
|||
|
||||
/**
|
||||
* 发送结算奖励
|
||||
* @param type
|
||||
* @throws Exception
|
||||
*/
|
||||
public void sendReward(int type) throws Exception {
|
||||
if(curSeason == 0){
|
||||
|
|
@ -573,17 +560,25 @@ public class ArenaLogic {
|
|||
}else{
|
||||
title = SErrorCodeEerverConfig.getI18NMessage("arena_season_reward_title");
|
||||
}
|
||||
|
||||
Set<ZSetOperations.TypedTuple<String>> arenaRankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.ARENA_RANK,Integer.toString(curSeason), 0, -1);
|
||||
if(type == GlobalsDef.ARENA_SEASON_REWARD){
|
||||
curSeason=0;
|
||||
}
|
||||
int rank = 1;
|
||||
int maxRank = getMaxRank();
|
||||
for(ZSetOperations.TypedTuple<String> item : arenaRankInfo){
|
||||
if (rank > maxRank){
|
||||
break;
|
||||
}
|
||||
String value = item.getValue();
|
||||
int uid = Integer.parseInt(value);
|
||||
// 超7天未登录玩家,不再发奖励
|
||||
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(uid);
|
||||
if (csPlayer.getOffLineTime() != 0 && TimeUtils.now() > (csPlayer.getOffLineTime() + GlobalsDef.REDIS_OVER_TIME_DAY * 7 * 1000L) ){
|
||||
if (csPlayer == null){
|
||||
continue;
|
||||
}
|
||||
// 超7天未登录玩家,不再发奖励
|
||||
if (csPlayer.getOffLineTime() == 0 || TimeUtils.now() > (csPlayer.getOffLineTime() + GlobalsDef.REDIS_OVER_TIME_DAY * 7 * 1000L)){
|
||||
String recordKey = RedisUtil.getInstence().getKey(RedisKey.ARENA_RRECORD, Integer.toString(uid));
|
||||
RedisUtil.getInstence().del(recordKey);
|
||||
continue;
|
||||
|
|
@ -599,7 +594,6 @@ public class ArenaLogic {
|
|||
if(sessionByUid!=null){
|
||||
MissionEventDistributor.requestEnd(sessionByUid,true);
|
||||
}
|
||||
|
||||
}
|
||||
if(type == GlobalsDef.ARENA_DAILY_REWARD){
|
||||
content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("arena_daily_reward_txt",new Object[]{rank},new int[0],"#");
|
||||
|
|
@ -608,7 +602,6 @@ public class ArenaLogic {
|
|||
user.getPlayerInfoManager().removeRed(GlobalsDef.ARENA_CHALLENGE_TYPE);
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.ARENA_RRECORD, Integer.toString(uid));
|
||||
RedisUtil.getInstence().del(key);
|
||||
|
||||
}
|
||||
if(rank == 1 && type == GlobalsDef.ARENA_SEASON_REWARD){
|
||||
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.arena_rank.getType(),1));
|
||||
|
|
@ -640,6 +633,15 @@ public class ArenaLogic {
|
|||
return "";
|
||||
}
|
||||
|
||||
public int getMaxRank(){
|
||||
Map<Integer, SArenaReward> config = STableManager.getConfig(SArenaReward.class);
|
||||
OptionalInt optionalInt = config.values().stream().mapToInt(SArenaReward::getMaxRank).max();
|
||||
if (optionalInt.isPresent()){
|
||||
return optionalInt.getAsInt();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void updateArenaSeason(int curSeason){
|
||||
this.curSeason = curSeason;
|
||||
//初始化竞技场新周期数据
|
||||
|
|
@ -715,8 +717,7 @@ public class ArenaLogic {
|
|||
int reason = fightResult == 1?BIReason.ARENA_WIN_REWARD:BIReason.ARENA_LOSE_REWARD;
|
||||
int[] dropList = new int[1];
|
||||
dropList[0]=rewardGroupId;
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropList,1,0, reason);
|
||||
return drop;
|
||||
return ItemUtil.drop(user, dropList,1,0, reason);
|
||||
}
|
||||
|
||||
public void worldSendReward(){
|
||||
|
|
@ -769,9 +770,9 @@ public class ArenaLogic {
|
|||
Map.Entry<Integer, SMServerArenaReward> entry = rewardMapByRank.floorEntry(index);
|
||||
SMServerArenaReward value = entry.getValue();
|
||||
int[][] titleReward = value.getTitleReward();
|
||||
if(titleReward !=null&& titleReward.length>0){
|
||||
if(titleReward != null){
|
||||
for(int[] reward:titleReward){
|
||||
long time = TimeUtils.getBeginOfDay(TimeUtils.now() + reward[1]*1000)+TimeUtils.DAY;
|
||||
long time = TimeUtils.getBeginOfDay(TimeUtils.now() + reward[1] * 1000L)+TimeUtils.DAY;
|
||||
user.getPlayerInfoManager().putUserTitleValidTime(reward[0],time);
|
||||
PlayerInfoProto.UserTitleAddIndication.Builder builder = PlayerInfoProto.UserTitleAddIndication.newBuilder().setDecorationId(reward[0]).setTime((int) (time / 1000));
|
||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()),1, MessageTypeProto.MessageType.USER_TITLE_ADD_INDICATION_VALUE,builder.build(),true);
|
||||
|
|
@ -961,19 +962,17 @@ public class ArenaLogic {
|
|||
public static List<CommonProto.ArenaEnemy> randomRank(int uid, int myRank,int crossGroup) {
|
||||
//缓存每次匹配结果
|
||||
TreeSet<Integer> matchRank = getMatchID(myRank==9999?1000:myRank);
|
||||
|
||||
AbstractRank rankEnum = RankContext.getRankEnum(RankEnum.CROSS_SERVICE_ARENA.getType());
|
||||
List<Integer> ids = new ArrayList<>(4);
|
||||
|
||||
// AbstractRank rankEnum = RankContext.getRankEnum(RankEnum.CROSS_SERVICE_ARENA.getType());
|
||||
// List<Integer> ids = new ArrayList<>(4);
|
||||
// RedisUtil.getInstence().set(RedisKey.WORLD_ARENA_RANK_MY_MATH, String.valueOf(uid), matchRank);
|
||||
// RedisUtil.getInstence().expire(RedisUtil.getInstence().getKey(RedisKey.WORLD_ARENA_RANK_MY_MATH, String.valueOf(uid)),TimeUtils.DAY*2/1000);
|
||||
matchRank.forEach(rank -> {
|
||||
Set<ZSetOperations.TypedTuple<String>> rankByKey = rankEnum.getRankByKey(String.valueOf(crossGroup),rank-1,rank-1);
|
||||
if(rankByKey.iterator().hasNext()){
|
||||
ZSetOperations.TypedTuple<String> next = rankByKey.iterator().next();
|
||||
ids.add(Integer.parseInt(next.getValue()));
|
||||
}
|
||||
});
|
||||
// matchRank.forEach(rank -> {
|
||||
// Set<ZSetOperations.TypedTuple<String>> rankByKey = rankEnum.getRankByKey(String.valueOf(crossGroup),rank-1,rank-1);
|
||||
// if(rankByKey.iterator().hasNext()){
|
||||
// ZSetOperations.TypedTuple<String> next = rankByKey.iterator().next();
|
||||
// ids.add(Integer.parseInt(next.getValue()));
|
||||
// }
|
||||
// });
|
||||
return ArenaLogic.getInstance().getCrossArenaEnemyList(uid,matchRank,crossGroup);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.logic.friend;
|
||||
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
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;
|
||||
|
|
@ -150,6 +151,24 @@ public class FriendLogic {
|
|||
}
|
||||
}
|
||||
|
||||
Collections.shuffle(recommandFriends);
|
||||
List<User> cUsers = MongoUtil.getInstence().getRandomUsers(selectSize, uid, playerInfoManager.getLevel());
|
||||
if (cUsers != null){
|
||||
Collections.shuffle(cUsers);
|
||||
for (User cUser1 : cUsers) {
|
||||
int recommandId = cUser1.getId();
|
||||
if (!checkIsAllowRecommandFriend(friendManager, recommandId,recommondIds)){
|
||||
continue;
|
||||
}
|
||||
recommondIds.add(recommandId);
|
||||
recommandFriends.add(recommandId);
|
||||
selectSize--;
|
||||
if(selectSize<=0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// todo 跨服加好友逻辑
|
||||
for (Integer commondUid : recommandFriends){
|
||||
CommonProto.Friend friend = CBean2Proto.getFriendInfo(commondUid,friendManager);
|
||||
|
|
@ -182,7 +201,6 @@ public class FriendLogic {
|
|||
if(blackFriends.contains(commandUserId)){
|
||||
return false;
|
||||
}
|
||||
// todo 走配置
|
||||
int maxSize = SSpecialConfig.getIntegerValue(SSpecialConfig.FRIENDAMOUNT_LIMIT);
|
||||
//用户已达上限不推荐好友信息
|
||||
return friends.size() < maxSize;
|
||||
|
|
@ -196,9 +214,17 @@ public class FriendLogic {
|
|||
User user = UserManager.getUser(uid);
|
||||
FriendManager friendManager = user.getFriendManager();
|
||||
List<Integer> applyFriends = friendManager.getApplyFriends();
|
||||
List<Integer> blackFriends = friendManager.getBlackFriends();
|
||||
List<CommonProto.Friend> friendList = new CopyOnWriteArrayList<>();
|
||||
for (Integer applyFriendId :applyFriends){
|
||||
CommonProto.Friend friend = CBean2Proto.getFriendInfo(applyFriendId,friendManager);
|
||||
Iterator<Integer> iterator = applyFriends.iterator();
|
||||
while (iterator.hasNext()){
|
||||
Integer id = iterator.next();
|
||||
if (blackFriends.contains(id)){
|
||||
iterator.remove();
|
||||
friendManager.delApplyFriend(id);
|
||||
continue;
|
||||
}
|
||||
CommonProto.Friend friend = CBean2Proto.getFriendInfo(id,friendManager);
|
||||
if (friend == null) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue