好友:拉黑对方聊天也屏蔽

This commit is contained in:
luying
2022-06-13 16:55:58 +08:00
parent 68e5d11230
commit 106fb3ce39
6 changed files with 39 additions and 16 deletions
@@ -27,6 +27,7 @@ import { checkTask, checkTaskInComBattleStart } from '../../../services/task/tas
import { gameData, getWarByBlueprtId } from '../../../pubUtils/data';
import { HeroModel } from '../../../db/Hero';
import { addUserToTeamChannel, delTeamChannel, removeFromTeamChannel, sendMessageToTeam, sendMessageToUsersWithSuc, sendMessageToUserWithSuc } from '../../../services/pushService';
import { getFriendRelationType } from '../../../services/friendService';
export default function(app: Application) {
return new ComBattleHandler(app);
@@ -706,7 +707,8 @@ export class ComBattleHandler {
let teamStatus = this.teamMap.get(teamCode);
if(!teamStatus) return resResult(STATUS.WRONG_PARMS);
const msgData = await pushFriendTeamInviteMsg(roleId, roleName, teamCode, teamStatus.blueprtId, targetRoleId);
let relation = await getFriendRelationType(roleId, targetRoleId);
const msgData = await pushFriendTeamInviteMsg(roleId, roleName, teamCode, teamStatus.blueprtId, targetRoleId, relation);
if (!msgData) return resResult(STATUS.WRONG_PARMS);
const roleInfo = await getSimpleRoleInfo(targetRoleId);
@@ -6,6 +6,7 @@ import { createAccuseData, createGroupMsg, createPrivateMsg, getPrivateMessages,
import { getSimpleRoleInfo } from '../../../services/roleService';
import { checkTask } from '../../../services/task/taskService';
import { RoleModel } from '../../../db/Role';
import { getFriendRelationType } from '../../../services/friendService';
export default function (app: Application) {
@@ -58,7 +59,8 @@ export class ChatHandler {
const roleName = session.get('roleName');
const sid = session.get('sid');
const msgData = await createPrivateMsg(roleId, roleName, type, MSG_SOURCE.ROLE_SEND_TEXT, content, targetRoleId, targetMsgCode);
let relation = await getFriendRelationType(roleId, targetRoleId);
const msgData = await createPrivateMsg(roleId, roleName, type, MSG_SOURCE.ROLE_SEND_TEXT, content, targetRoleId, targetMsgCode, relation);
await pushMsgToRole(msgData);
if (!msgData) return resResult(STATUS.WRONG_PARMS);
@@ -17,13 +17,14 @@ import { FriendPresentLogModel } from '../../../db/FriendPresentLog';
import { HeroModel, EPlace } from "../../../db/Hero";
import { FRIEND } from "../../../pubUtils/dicParam";
import { PlayerDetail, PlayerDetailHero } from "../../../domain/battleField/guild";
import { createPrivateMsg, pushMsgToRole, pushPresent } from "../../../services/chatService";
import { createPrivateMsg, delPrivateMsg, privateRoomId, pushMsgToRole, pushPresent } from "../../../services/chatService";
import { Rank } from "../../../services/rankService";
import { checkTaskWithRoles, checkTask } from "../../../services/task/taskService";
import { ComBattleTeamModel } from "../../../db/ComBattleTeam";
import { JewelModel } from "../../../db/Jewel";
import { getHeroesAttributes } from "../../../services/playerCeService";
import { sendMessageToUsersWithSuc, sendMessageToUserWithSuc } from "../../../services/pushService";
import { PrivateMessageModel } from "../../../db/PrivateMessage";
export default function (app: Application) {
@@ -346,6 +347,9 @@ export class FriendHandler {
await FriendRelationModel.moveFromFriend(hisRoleId, role, friendShip, false, !!curFriend); //从对方好友删除
await FriendRelationModel.moveFromFriend(roleId, friend, friendShip, true, !!curFriend); // 删除好友关系并拉黑
await PrivateMessageModel.blockMsg(privateRoomId(roleId, hisRoleId)); // 屏蔽掉双方对话
await delPrivateMsg(roleId, hisRoleId);
let { myRecApplyCount, hisRecApplyCount } = await FriendApplyModel.deleteApplyByRoles(roleId, hisRoleId); // 删除双方的申请
if(myRecApplyCount > 0) await RoleModel.increaseFriendApplyCnt(roleId, -1 * myRecApplyCount, FRIEND.FRIEND_MANAGE_APPLICATION);
if(hisRecApplyCount > 0) await RoleModel.increaseFriendApplyCnt(roleId, -1 * hisRecApplyCount, FRIEND.FRIEND_MANAGE_APPLICATION);
@@ -601,10 +605,10 @@ export class FriendHandler {
let result = await FriendShipModel.addFriendValue(roleId, hisRoleId, friendValueInc);
if (!result) return resResult(STATUS.FRIEND_NOT_FOUND);
// TODO 日志可以转到log服
await FriendPresentLogModel.createRecord(roleId, hisRoleId, items);
for (let { id, count } of items) {
const msgData = await createPrivateMsg(roleId, roleName, MSG_TYPE.RICH_TEXT, MSG_SOURCE.PRIVATE_SEND_GIFT, JSON.stringify({ id, count }), hisRoleId, null);
let relation = getRecommendType(myRelation, roleId, hisRoleId);
const msgData = await createPrivateMsg(roleId, roleName, MSG_TYPE.RICH_TEXT, MSG_SOURCE.PRIVATE_SEND_GIFT, JSON.stringify({ id, count }), hisRoleId, null, relation);
await pushMsgToRole(msgData);
let hisRole = <RoleType>curFriend.role;
await pushPresent(roleId, roleName, serverId, hisRole.roleName, id);