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

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
@@ -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);