好友:好友信息
This commit is contained in:
@@ -88,8 +88,8 @@ export class GuildTrainHandler {
|
||||
* @param msg
|
||||
* @param session
|
||||
*/
|
||||
async trainBattleStart(msg: guildInter & { hid: number, trainId: number, difficulty: number }, session: BackendSession) {
|
||||
const { hid, difficulty, trainId, myUserGuild } = msg;
|
||||
async trainBattleStart(msg: guildInter & { hid: number, trainId: number, difficulty: number, battleId: number }, session: BackendSession) {
|
||||
const { hid, difficulty, trainId, myUserGuild, battleId } = msg;
|
||||
const roleId = session.get('roleId');
|
||||
const roleName = session.get('roleName');
|
||||
const serverId = parseInt(session.get('serverId'));
|
||||
@@ -118,7 +118,7 @@ export class GuildTrainHandler {
|
||||
const battleCode = genCode(8); // 关卡唯一值
|
||||
await BattleRecordModel.updateBattleRecordByCode(battleCode, {
|
||||
$set: {
|
||||
roleId, roleName, battleId: instance.warId,
|
||||
roleId, roleName, battleId,
|
||||
status: 0,
|
||||
record: { heroes: [], trainId, hid, guildCode: code, difficulty },
|
||||
}
|
||||
|
||||
@@ -244,8 +244,8 @@ export class FriendHandler {
|
||||
resultApplyCodeList = applyCodeList;
|
||||
}
|
||||
|
||||
await FriendApplyModel.deleteApply(resultApplyCodeList);
|
||||
role = await RoleModel.increaseFriendApplyCnt(roleId, -1 * resultApplyCodeList.length, 50);
|
||||
let deleteCount = await FriendApplyModel.deleteApply(resultApplyCodeList);
|
||||
role = await RoleModel.increaseFriendApplyCnt(roleId, -1 * deleteCount, FRIEND.FRIEND_MANAGE_APPLICATION);
|
||||
roles.push(role);
|
||||
// 任务
|
||||
await checkTaskWithRoles(serverId, roleId, sid, TASK_TYPE.FRIEND_NUM, roles);
|
||||
@@ -342,8 +342,9 @@ export class FriendHandler {
|
||||
|
||||
await FriendRelationModel.moveFromFriend(hisRoleId, role, friendShip, false, !!curFriend); //从对方好友删除
|
||||
await FriendRelationModel.moveFromFriend(roleId, friend, friendShip, true, !!curFriend); // 删除好友关系并拉黑
|
||||
await FriendApplyModel.deleteApplyByRoles(roleId, hisRoleId); // 删除双方的申请
|
||||
await RoleModel.increaseFriendApplyCnt(roleId, -1, 50);
|
||||
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);
|
||||
|
||||
let param = new BlackListParam(friend);
|
||||
let isOnline = await isRoleOnline(friend.roleId);
|
||||
@@ -615,7 +616,7 @@ export class FriendHandler {
|
||||
let { roleId: targetRoleId } = msg;
|
||||
let isRobot = checkRoleIsRobot(targetRoleId);
|
||||
if(isRobot) {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let role = await RoleModel.findByRoleId(roleId, null, true);
|
||||
let sysType = getRobotSysType(targetRoleId);
|
||||
let addObj: any = { roleId: makeRobotId(''), roleName: '', guildName: '' };
|
||||
if(sysType == ROBOT_SYS_TYPE.COM_BTL) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import { outputCnt } from '../pubUtils/friendUtil';
|
||||
import { isRoleOnline, getServerName, getRoleOnlineInfo } from "./redisService";
|
||||
import { FriendApplyModel } from "../db/FriendApply";
|
||||
import { FriendApplyParams, FriendListParam } from "../domain/roleField/friend";
|
||||
import { FRIEND } from "../pubUtils/dicParam";
|
||||
import { FriendPointModel } from "../db/FriendPoint";
|
||||
|
||||
export async function getFriendList(role: RoleType) {
|
||||
@@ -89,8 +90,8 @@ export async function getApplyList(roleId: string) {
|
||||
|
||||
result.push(param);
|
||||
}
|
||||
await FriendApplyModel.deleteApply(delApplyCodeList);
|
||||
await RoleModel.increaseFriendApplyCnt(roleId, -1 * delApplyCodeList.length, 50);
|
||||
let deleteCount = await FriendApplyModel.deleteApply(delApplyCodeList);
|
||||
await RoleModel.increaseFriendApplyCnt(roleId, -1 * deleteCount, FRIEND.FRIEND_MANAGE_APPLICATION);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,14 +60,15 @@ export default class FriendApply extends BaseModel {
|
||||
|
||||
// 删除申请
|
||||
public static async deleteApply(applyCodeList: string[]) {
|
||||
const result = await FriendApplyModel.deleteMany({ applyCode: { $in: applyCodeList } });
|
||||
return result;
|
||||
const { deletedCount } = await FriendApplyModel.deleteMany({ applyCode: { $in: applyCodeList } });
|
||||
return deletedCount;
|
||||
}
|
||||
|
||||
// 拉黑时删除申请
|
||||
public static async deleteApplyByRoles(roleId: string, frdRoleId: string) {
|
||||
const result = await FriendApplyModel.deleteMany({ $or: [{ roleId, frdRoleId}, {roleId: frdRoleId, frdRoleId: roleId}] });
|
||||
return result;
|
||||
const { deletedCount: hisRecApplyCount } = await FriendApplyModel.deleteMany({ roleId, frdRoleId });
|
||||
const { deletedCount: myRecApplyCount } = await FriendApplyModel.deleteMany({ roleId: frdRoleId, frdRoleId: roleId });
|
||||
return { hisRecApplyCount, myRecApplyCount };
|
||||
}
|
||||
|
||||
public static async deleteAccount(roleId: string) {
|
||||
|
||||
Reference in New Issue
Block a user