Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
5916e26239
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -30,6 +30,7 @@ public class SSpecialConfig implements BaseConfig {
|
||||||
public static final String FRIENDAPPLYAMOUNT_LIMIT = "FriendApplyAmount_limit";//好友申请上限
|
public static final String FRIENDAPPLYAMOUNT_LIMIT = "FriendApplyAmount_limit";//好友申请上限
|
||||||
public static final String Friend_Gift = "Friend_Gift";//好友赠送友情点
|
public static final String Friend_Gift = "Friend_Gift";//好友赠送友情点
|
||||||
public static final String Level_RankingShowNum = "Level_RankingShowNum";//关卡排行
|
public static final String Level_RankingShowNum = "Level_RankingShowNum";//关卡排行
|
||||||
|
public static final String FriendBlackAmount_limit = "FriendBlackAmount_limit";//黑名单上限
|
||||||
|
|
||||||
public static final String lamp_lottery_content_parm = "lamp_lottery_content_parm";//资质13及以上——系统消息
|
public static final String lamp_lottery_content_parm = "lamp_lottery_content_parm";//资质13及以上——系统消息
|
||||||
public static final String lamp_rankup_hero_content_parm = "lamp_rankup_hero_content_parm";//10星及以上——系统消息
|
public static final String lamp_rankup_hero_content_parm = "lamp_rankup_hero_content_parm";//10星及以上——系统消息
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ljsd.jieling.handler.friend;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.friend.FriendLogic;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
|
|
||||||
|
public class FriendBlackOptHandler extends BaseHandler<PlayerInfoProto.FriendBlackOptRequest> {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.FRIEND_BLACK_OPT_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processWithProto(ISession iSession, PlayerInfoProto.FriendBlackOptRequest proto) throws Exception {
|
||||||
|
FriendLogic.getInstance().optBlackFriend(iSession,proto.getType(),proto.getBlackUid());
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,6 +30,9 @@ public class GetFriendInfoHandler extends BaseHandler {
|
||||||
case 3: //申请列表
|
case 3: //申请列表
|
||||||
FriendLogic.getInstance().getApplyFriends(iSession);
|
FriendLogic.getInstance().getApplyFriends(iSession);
|
||||||
break;
|
break;
|
||||||
|
case 4: //黑名单列表
|
||||||
|
FriendLogic.getInstance().getBlackFriendInfos(iSession);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2223,7 +2223,7 @@ public class MapLogic {
|
||||||
o2.setRank(rank);
|
o2.setRank(rank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return o1.getFightId() - o2.getFightId();
|
return o2.getFightId()-o1.getFightId();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for(CommonProto.MainLevelRankInfo.Builder builder1 : mainLevelRankInfoList){
|
for(CommonProto.MainLevelRankInfo.Builder builder1 : mainLevelRankInfoList){
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
public class FriendManager extends MongoBase {
|
public class FriendManager extends MongoBase {
|
||||||
private List<Integer> friends = new CopyOnWriteArrayList<>();
|
private List<Integer> friends = new CopyOnWriteArrayList<>();
|
||||||
|
private List<Integer> blackFriends = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
private List<Integer> applyFriends = new CopyOnWriteArrayList<>(); // 申请列表信息
|
private List<Integer> applyFriends = new CopyOnWriteArrayList<>(); // 申请列表信息
|
||||||
//key: friendId value 状态 0:未赠送 1赠送过
|
//key: friendId value 状态 0:未赠送 1赠送过
|
||||||
|
@ -25,6 +26,16 @@ public class FriendManager extends MongoBase {
|
||||||
this.friends.add(friendId);
|
this.friends.add(friendId);
|
||||||
setFriends(this.friends);
|
setFriends(this.friends);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delBlackFriends(Integer friendId) {
|
||||||
|
this.blackFriends.remove(friendId);
|
||||||
|
setBlackFriends(this.blackFriends);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBlackFriendId(int friendId) {
|
||||||
|
this.blackFriends.add(friendId);
|
||||||
|
setBlackFriends(this.blackFriends);
|
||||||
|
}
|
||||||
public void delApplyFriend(Integer friendId){
|
public void delApplyFriend(Integer friendId){
|
||||||
this.applyFriends.remove(friendId);
|
this.applyFriends.remove(friendId);
|
||||||
setApplyFriends(this.applyFriends);
|
setApplyFriends(this.applyFriends);
|
||||||
|
@ -54,6 +65,11 @@ public class FriendManager extends MongoBase {
|
||||||
return friends;
|
return friends;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBlackFriends(List<Integer> blackFriends) {
|
||||||
|
updateString("blackFriends", friends);
|
||||||
|
this.blackFriends = blackFriends;
|
||||||
|
}
|
||||||
|
|
||||||
public void setFriends(List<Integer> friends) {
|
public void setFriends(List<Integer> friends) {
|
||||||
updateString("friends", friends);
|
updateString("friends", friends);
|
||||||
this.friends = friends;
|
this.friends = friends;
|
||||||
|
@ -85,4 +101,8 @@ public class FriendManager extends MongoBase {
|
||||||
updateString("haveRewardMap", haveRewardMap);
|
updateString("haveRewardMap", haveRewardMap);
|
||||||
this.haveRewardMap = haveRewardMap;
|
this.haveRewardMap = haveRewardMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Integer> getBlackFriends() {
|
||||||
|
return blackFriends;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,25 @@ public class FriendLogic {
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_FRIEND_INFO_REPONSE_VALUE, getFriendInfoResponse, true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_FRIEND_INFO_REPONSE_VALUE, getFriendInfoResponse, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取好友信息
|
||||||
|
*/
|
||||||
|
public void getBlackFriendInfos(ISession iSession) throws Exception {
|
||||||
|
int uid = iSession.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
FriendManager friendManager = user.getFriendManager();
|
||||||
|
List<Integer> blackFriends = friendManager.getBlackFriends();
|
||||||
|
List<CommonProto.Friend> friendList = new CopyOnWriteArrayList<>();
|
||||||
|
for (Integer friendId :blackFriends){
|
||||||
|
CommonProto.Friend friend = CBean2Proto.getFriendInfo(friendId,friendManager);
|
||||||
|
friendList.add(friend);
|
||||||
|
}
|
||||||
|
PlayerInfoProto.GetFriendInfoResponse getFriendInfoResponse = PlayerInfoProto.GetFriendInfoResponse
|
||||||
|
.newBuilder().addAllFriends(friendList)
|
||||||
|
.build();
|
||||||
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_FRIEND_INFO_REPONSE_VALUE, getFriendInfoResponse, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取推荐列表
|
* 获取推荐列表
|
||||||
* @param iSession
|
* @param iSession
|
||||||
|
@ -109,6 +128,9 @@ public class FriendLogic {
|
||||||
if(recommandFriends== null||recommandIdUser==null){
|
if(recommandFriends== null||recommandIdUser==null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(recommandIdUser.getFriendManager().getBlackFriends().contains(uid)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int minLevel = level - randomLevel;
|
int minLevel = level - randomLevel;
|
||||||
minLevel = minLevel <= 5 ? 5 : minLevel;
|
minLevel = minLevel <= 5 ? 5 : minLevel;
|
||||||
int maxLevel = level + randomLevel;
|
int maxLevel = level + randomLevel;
|
||||||
|
@ -155,12 +177,16 @@ public class FriendLogic {
|
||||||
|
|
||||||
private boolean checkIsAllowRecommandFriend(FriendManager friendManager,int commandUserId,Set<Integer> recommondIds ) {
|
private boolean checkIsAllowRecommandFriend(FriendManager friendManager,int commandUserId,Set<Integer> recommondIds ) {
|
||||||
List<Integer> friends = friendManager.getFriends();
|
List<Integer> friends = friendManager.getFriends();
|
||||||
|
List<Integer> blackFriends = friendManager.getBlackFriends();
|
||||||
if (friends.contains(commandUserId)){
|
if (friends.contains(commandUserId)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (recommondIds.contains(commandUserId)){
|
if (recommondIds.contains(commandUserId)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if(blackFriends.contains(commandUserId)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// todo 走配置
|
// todo 走配置
|
||||||
int maxSize = SSpecialConfig.getIntegerValue(SSpecialConfig.FRIENDAMOUNT_LIMIT);
|
int maxSize = SSpecialConfig.getIntegerValue(SSpecialConfig.FRIENDAMOUNT_LIMIT);
|
||||||
if (friends.size() >= maxSize) { //用户已达上限不推荐好友信息
|
if (friends.size() >= maxSize) { //用户已达上限不推荐好友信息
|
||||||
|
@ -227,6 +253,9 @@ public class FriendLogic {
|
||||||
if (applyFriends.contains(uid)){
|
if (applyFriends.contains(uid)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(friendManager.getBlackFriends().contains(uid)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (friends1.size() >= maxFriends){
|
if (friends1.size() >= maxFriends){
|
||||||
MessageUtil.sendErrorResponse(iSession,Global.SHOW_TIPS_ERROR,msgId,"对方好友已达上限");
|
MessageUtil.sendErrorResponse(iSession,Global.SHOW_TIPS_ERROR,msgId,"对方好友已达上限");
|
||||||
return;
|
return;
|
||||||
|
@ -300,6 +329,10 @@ public class FriendLogic {
|
||||||
MessageUtil.sendErrorResponse(iSession,Global.SHOW_TIPS_ERROR,msgId,"对方好友已达上限");
|
MessageUtil.sendErrorResponse(iSession,Global.SHOW_TIPS_ERROR,msgId,"对方好友已达上限");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(friendfriendManager.getBlackFriends().contains(uid)){
|
||||||
|
MessageUtil.sendErrorResponse(iSession,Global.SHOW_TIPS_ERROR,msgId,"对方已将你加入黑名单");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (applyFriends.contains(friendId)){
|
if (applyFriends.contains(friendId)){
|
||||||
friendManager.delApplyFriend(friendId);
|
friendManager.delApplyFriend(friendId);
|
||||||
}
|
}
|
||||||
|
@ -417,6 +450,35 @@ public class FriendLogic {
|
||||||
sendFriendStatedication(uid,friendId,1);
|
sendFriendStatedication(uid,friendId,1);
|
||||||
MessageUtil.sendMessage(iSession, 1, msgId, null, true);
|
MessageUtil.sendMessage(iSession, 1, msgId, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void optBlackFriend(ISession session,int optType,int friendId) throws Exception {
|
||||||
|
int uid = session.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
FriendManager friendManager = user.getFriendManager();
|
||||||
|
int msgId = MessageTypeProto.MessageType.FRIEND_BLACK_OPT_RESPONSE_VALUE;
|
||||||
|
if(optType == 1){
|
||||||
|
if(friendManager.getBlackFriends().size()>=SSpecialConfig.getIntegerValue(SSpecialConfig.FriendBlackAmount_limit)){
|
||||||
|
MessageUtil.sendErrorResponse(session,Global.SHOW_TIPS_ERROR, msgId, "黑名单列表已满");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(friendManager.getBlackFriends().contains(friendId)){
|
||||||
|
MessageUtil.sendErrorResponse(session,Global.SHOW_TIPS_ERROR, msgId, "已加入过黑名单");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Integer> friends = friendManager.getFriends();
|
||||||
|
if (friends.contains(friendId)){
|
||||||
|
User friendUser = UserManager.getUser(friendId);
|
||||||
|
FriendManager friendManager1 = friendUser.getFriendManager();
|
||||||
|
delFriendInfo(friendId, uid, friendManager, friendManager1);
|
||||||
|
sendFriendStatedication(uid,friendId,1);
|
||||||
|
}
|
||||||
|
friendManager.addBlackFriendId(friendId);
|
||||||
|
}else{
|
||||||
|
friendManager.delBlackFriends(friendId);
|
||||||
|
}
|
||||||
|
MessageUtil.sendMessage(session, 1, msgId, null, true);
|
||||||
|
|
||||||
|
}
|
||||||
//删除好友清除赠送领取体力信息
|
//删除好友清除赠送领取体力信息
|
||||||
private void delFriendInfo(int friendId, int uid, FriendManager friendManager, FriendManager friendManager1) {
|
private void delFriendInfo(int friendId, int uid, FriendManager friendManager, FriendManager friendManager1) {
|
||||||
friendManager1.delFriends(uid);
|
friendManager1.delFriends(uid);
|
||||||
|
|
|
@ -938,6 +938,7 @@ public class ItemUtil {
|
||||||
String reward = getLimitReward(equipMap,filter);
|
String reward = getLimitReward(equipMap,filter);
|
||||||
int nowTime =(int) (TimeUtils.now()/1000);
|
int nowTime =(int) (TimeUtils.now()/1000);
|
||||||
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,nowTime,Global.MAIL_EFFECTIVE_TIME);
|
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,nowTime,Global.MAIL_EFFECTIVE_TIME);
|
||||||
|
MessageUtil.nofityBagIsFull(user);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue