好友:推送申请增加列表
This commit is contained in:
@@ -8,7 +8,7 @@ import { FriendListParam, FriendRecommendParams, BlackListParam, FriendValueList
|
|||||||
import { FriendShipModel, FriendShipType } from "../../../db/FriendShip";
|
import { FriendShipModel, FriendShipType } from "../../../db/FriendShip";
|
||||||
import { FriendRelationModel, Relation } from "../../../db/FriendRelation";
|
import { FriendRelationModel, Relation } from "../../../db/FriendRelation";
|
||||||
import { isRoleOnline, getServerName, getRoleOnlineInfo } from "../../../services/redisService";
|
import { isRoleOnline, getServerName, getRoleOnlineInfo } from "../../../services/redisService";
|
||||||
import { increaseFrdCnt, getRecommendType, sortByBeSentHeart, getApplyList, getFriendList } from "../../../services/friendService";
|
import { increaseFrdCnt, getRecommendType, sortByBeSentHeart, getApplyList, getFriendList, getMyApplyParam, getMyParamAsFriend } from "../../../services/friendService";
|
||||||
import { FriendPointModel } from "../../../db/FriendPoint";
|
import { FriendPointModel } from "../../../db/FriendPoint";
|
||||||
import { gameData, getDicFriendByLv } from "../../../pubUtils/data";
|
import { gameData, getDicFriendByLv } from "../../../pubUtils/data";
|
||||||
import { addItems, handleCost } from "../../../services/rewardService";
|
import { addItems, handleCost } from "../../../services/rewardService";
|
||||||
@@ -130,7 +130,6 @@ export class FriendHandler {
|
|||||||
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
||||||
|
|
||||||
let str = '', resultRoleIds = new Array<string>();
|
let str = '', resultRoleIds = new Array<string>();
|
||||||
let uids = [];
|
|
||||||
for (let hisRoleId of roleIds) {
|
for (let hisRoleId of roleIds) {
|
||||||
let type = getRecommendType(myFriendRelation, roleId, hisRoleId);
|
let type = getRecommendType(myFriendRelation, roleId, hisRoleId);
|
||||||
if (type == FRIEND_RELATION_TYPE.HAS_FRIEND) {
|
if (type == FRIEND_RELATION_TYPE.HAS_FRIEND) {
|
||||||
@@ -146,16 +145,17 @@ export class FriendHandler {
|
|||||||
str = getResStr(STATUS.FRIEND_HIS_APPLY_MAX); continue;
|
str = getResStr(STATUS.FRIEND_HIS_APPLY_MAX); continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
await FriendApplyModel.createApply(hisRoleId, role);
|
let apply = await FriendApplyModel.createApply(hisRoleId, role);
|
||||||
resultRoleIds.push(hisRoleId);
|
resultRoleIds.push(hisRoleId);
|
||||||
let hisOnlineInfo = await getRoleOnlineInfo(hisRoleId);
|
let hisOnlineInfo = await getRoleOnlineInfo(hisRoleId);
|
||||||
|
let uids = [];
|
||||||
if (hisOnlineInfo.isOnline) {
|
if (hisOnlineInfo.isOnline) {
|
||||||
uids.push({ uid: hisRoleId, sid: hisOnlineInfo.sid });
|
uids.push({ uid: hisRoleId, sid: hisOnlineInfo.sid });
|
||||||
|
let myApply = await getMyApplyParam(apply.applyCode, role);
|
||||||
|
this.channelService.pushMessageByUids('onFriendApply', resResult(STATUS.SUCCESS, { apply: myApply }), uids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.channelService.pushMessageByUids('onFriendApply', resResult(STATUS.SUCCESS, { roleId }), uids);
|
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS, {
|
return resResult(STATUS.SUCCESS, {
|
||||||
isSuccess: str == '',
|
isSuccess: str == '',
|
||||||
msg: str,
|
msg: str,
|
||||||
@@ -232,7 +232,8 @@ export class FriendHandler {
|
|||||||
param.setType(FRIEND_RELATION_TYPE.HAS_FRIEND);
|
param.setType(FRIEND_RELATION_TYPE.HAS_FRIEND);
|
||||||
list.push(param);
|
list.push(param);
|
||||||
if (hisOnlineInfo.isOnline) {
|
if (hisOnlineInfo.isOnline) {
|
||||||
this.channelService.pushMessageByUids('onFriendAdd', resResult(STATUS.SUCCESS, { friend: param }), [{ uid: friend.roleId, sid: hisOnlineInfo.sid }]);
|
let myParam = await getMyParamAsFriend(friendShip, role, friend.roleId);
|
||||||
|
this.channelService.pushMessageByUids('onFriendAdd', resResult(STATUS.SUCCESS, { friend: myParam }), [{ uid: friend.roleId, sid: hisOnlineInfo.sid }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
resultApplyCodeList.push(apply.applyCode);
|
resultApplyCodeList.push(apply.applyCode);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { getResStr, shouldRefresh } from "../pubUtils/util";
|
|||||||
import { STATUS, FRIEND_RELATION_TYPE, POPULATE_TYPE, FRIEND_DROP_TYPE } from "../consts";
|
import { STATUS, FRIEND_RELATION_TYPE, POPULATE_TYPE, FRIEND_DROP_TYPE } from "../consts";
|
||||||
import { FriendShipType, FriendShipModel } from "../db/FriendShip";
|
import { FriendShipType, FriendShipModel } from "../db/FriendShip";
|
||||||
import { outputCnt } from '../pubUtils/friendUtil';
|
import { outputCnt } from '../pubUtils/friendUtil';
|
||||||
import { isRoleOnline, getServerName } from "./redisService";
|
import { isRoleOnline, getServerName, getRoleOnlineInfo } from "./redisService";
|
||||||
import { FriendApplyModel } from "../db/FriendApply";
|
import { FriendApplyModel } from "../db/FriendApply";
|
||||||
import { FriendApplyParams, FriendListParam } from "../domain/roleField/friend";
|
import { FriendApplyParams, FriendListParam } from "../domain/roleField/friend";
|
||||||
import { FriendPointModel } from "../db/FriendPoint";
|
import { FriendPointModel } from "../db/FriendPoint";
|
||||||
@@ -94,6 +94,30 @@ export async function getApplyList(roleId: string) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getMyApplyParam(applyCode: string, role: RoleType) {
|
||||||
|
let param = new FriendApplyParams(applyCode, role);
|
||||||
|
|
||||||
|
let { serverId, userInfo: { serverType } } = role;
|
||||||
|
let serverName = await getServerName(serverType, serverId);
|
||||||
|
param.setServerName(serverId, serverName);
|
||||||
|
param.setType(FRIEND_RELATION_TYPE.NORMAL);
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function getMyParamAsFriend(friendShip: FriendShipType, role: RoleType, friendRoleId: string) {
|
||||||
|
let param = new FriendListParam(role, friendRoleId, friendShip);
|
||||||
|
let hisOnlineInfo = await getRoleOnlineInfo(role.roleId);
|
||||||
|
param.setOnline(hisOnlineInfo.isOnline);
|
||||||
|
|
||||||
|
let { serverId, userInfo: { serverType } } = role;
|
||||||
|
let serverName = await getServerName(serverType, serverId);
|
||||||
|
param.setServerName(serverId, serverName);
|
||||||
|
|
||||||
|
param.setType(FRIEND_RELATION_TYPE.HAS_FRIEND);
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加双方好友数
|
* 增加双方好友数
|
||||||
* @param role1 我方
|
* @param role1 我方
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export enum ROLE_SELECT {
|
|||||||
HANDLE_APPLY = 'roleId friendCnt lv',
|
HANDLE_APPLY = 'roleId friendCnt lv',
|
||||||
ATTR = 'attr',
|
ATTR = 'attr',
|
||||||
GET_LV = 'lv',
|
GET_LV = 'lv',
|
||||||
GET_ROLE_ID = 'roleId',
|
GET_ROLE_ID = 'roleId roleName lv head frame spine ce title friendCnt serverId userInfo.serverType',
|
||||||
GET_MY_SERVER = 'lv serverId userInfo.serverType',
|
GET_MY_SERVER = 'lv serverId userInfo.serverType',
|
||||||
COM_BATTLE = 'lv head frame spine topLineupCe',
|
COM_BATTLE = 'lv head frame spine topLineupCe',
|
||||||
GET_HEADS = 'heads head frames frame spines spine',
|
GET_HEADS = 'heads head frames frame spines spine',
|
||||||
|
|||||||
Reference in New Issue
Block a user