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