军团:修改信息
This commit is contained in:
@@ -40,7 +40,7 @@ export enum GUILD_OPERATE {
|
||||
RECEIVE_INVITAION = 7, // 接受邀请
|
||||
GET_MEMBER_LIST_MAIN = 8, // 查看成员主要信息
|
||||
GET_MEMBER_LIST_DETAIL = 9, // 查看团内成员信息
|
||||
GET_MEMBER_LIST_MANAGE = 10, // 管理信息
|
||||
SET_AUTH = 10, // 设置权限
|
||||
SET_INFO = 11, // 修改军团信息
|
||||
GET_APPLY_LIST = 12, // 查看申请列表
|
||||
RECEIVE_APPLY = 13, // 接受申请
|
||||
@@ -57,6 +57,7 @@ export enum GUILD_OPERATE {
|
||||
OPEN_BOSS = 24, // 开启演武台
|
||||
EQUIP_PRODUCE = 25, // 炼器堂研发
|
||||
BE_KICKED = 26, // 被踢出军团
|
||||
BE_SET_AUTH = 27, // 被授权头衔
|
||||
}
|
||||
|
||||
// 军团状态
|
||||
|
||||
@@ -134,7 +134,9 @@ export const STATUS = {
|
||||
GUILD_QUIT_ERROR: { code: 20907, simStr: '退出公会失败' },
|
||||
GUILD_KICK_ERROR: { code: 20908, simStr: '未找到该成员或该成员已退出' },
|
||||
GUILD_QUIT_TIME: { code: 20909, simStr: '退出军团1小时后才可以申请' },
|
||||
GUILD_INVITE_NOT_FOUND: { code: 20910, simStr: '该邀请未找到' },
|
||||
GUILD_INVITE_NOT_FOUND: { code: 20910, simStr: '该邀请未找到' },
|
||||
GUILD_AUTH_NOT_CHANGE: { code: 20911, simStr: '权限未发生变化' },
|
||||
GUILD_MEMBER_NOT_FOUND: { code: 20912, simStr: '未找到该成员' },
|
||||
|
||||
// 通用 30000 - 30099
|
||||
DIC_DATA_NOT_FOUND: { code: 30000, simStr: '数据表未找到' },
|
||||
|
||||
+9
-5
@@ -114,8 +114,9 @@ export default class Guild extends BaseModel {
|
||||
return guildList;
|
||||
}
|
||||
|
||||
public static async findByCode(code: string, serverId: number) {
|
||||
public static async findByCode(code: string, serverId: number, select?: string) {
|
||||
const result = await GuildModel.findOne({ code, status: GUILD_STATUS.RUNNING, serverId })
|
||||
.select(select)
|
||||
.populate('leader', 'roleName sHid headHid lv loginTime ce', 'Role')
|
||||
.lean();
|
||||
return result;
|
||||
@@ -131,14 +132,17 @@ export default class Guild extends BaseModel {
|
||||
|
||||
public static async dismiss(code: string, serverId: number) {
|
||||
const result = await GuildModel.findOneAndUpdate({ code, status: GUILD_STATUS.RUNNING, serverId }, { status: GUILD_STATUS.DISMISSED }, { new: true })
|
||||
.select('+members')
|
||||
.lean();
|
||||
.select('+members').lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async quit(code: string, roleId: string, serverId: number) {
|
||||
const result = await GuildModel.findOneAndUpdate({ code, serverId }, { $inc: { memberCnt: -1}, $pull: { members: roleId }, isMemberMax: false }, { new: true })
|
||||
.lean();
|
||||
const result = await GuildModel.findOneAndUpdate({ code, serverId }, { $inc: { memberCnt: -1}, $pull: { members: roleId }, isMemberMax: false }, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async updateInfo(code: string, update: GuildUpdateParam, incParam: { managerCnt?: number }, select?: string) {
|
||||
const result = await GuildModel.findOneAndUpdate({ code }, { $set: update, $inc: incParam }, { new: true }).select(select).lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ export default class UserGuild extends BaseModel {
|
||||
public static async getListByGuild(guildCode: string, select?: string) {
|
||||
const userGuilds: UserGuildType[] = await UserGuildModel.find({ guildCode, status: USER_GUILD_STATUS.ON })
|
||||
.select(select)
|
||||
.sort({ auth: 1 })
|
||||
.populate('role', 'roleId roleName ce headHid sHid lv title loginTime', 'Role')
|
||||
.lean();
|
||||
return userGuilds;
|
||||
@@ -93,6 +94,11 @@ export default class UserGuild extends BaseModel {
|
||||
const result = await UserGuildModel.findOneAndUpdate({ guildCode, roleId, status: USER_GUILD_STATUS.ON }, {status: USER_GUILD_STATUS.QUIT}, {new: true});
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async updateInfo(roleId: string, update: UserGuildUpdateParam, select?: string) {
|
||||
const result = await UserGuildModel.findOneAndUpdate({ roleId, status: USER_GUILD_STATUS.ON }, { $set: update }, { new: true }).select(select).lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export const UserGuildModel = getModelForClass(UserGuild);
|
||||
|
||||
@@ -22,5 +22,6 @@
|
||||
{"id": 21, "auths": "2&3"},
|
||||
{"id": 22, "auths": "1&2"},
|
||||
{"id": 23, "auths": "1&2&3"},
|
||||
{"id": 26, "auths": "2&3"}
|
||||
{"id": 26, "auths": "2&3"},
|
||||
{"id": 27, "auths": "2&3"}
|
||||
]
|
||||
Reference in New Issue
Block a user