🐞 fix(判空): 根据后台错误日志添加空值判断

This commit is contained in:
luying
2023-05-13 19:49:35 +08:00
parent 7bebb83140
commit a7fa3cfb5c
8 changed files with 11 additions and 7 deletions

View File

@@ -202,7 +202,7 @@ export const STATUS = {
GUILD_MEMBER_MAX: { code: 20903, simStr: '军团人员已满' },
GUILD_NOT_REACH_CONDI: { code: 20903, simStr: '您未达到申请军团条件' },
GUILD_HAS_JOIN: { code: 20904, simStr: '已加入过其他军团' },
GUILD_NOT_FOUND: { code: 20905, simStr: '未获取到该军团' },
GUILD_NOT_FOUND: { code: 20905, simStr: '未获取到该军团或军团已解散' },
GUILD_DELETE_ERROR: { code: 20906, simStr: '军团已解散' },
GUILD_QUIT_ERROR: { code: 20907, simStr: '退出公会失败' },
GUILD_KICK_ERROR: { code: 20908, simStr: '未找到该成员或该成员已退出' },

View File

@@ -91,7 +91,7 @@ export default class UserGuildApply extends BaseModel {
let condition = { guildCode: code, type: GUILD_APPLY_TYPE.APPLY };
if(lastApplyCode) {
const lastApply = await this.findByCode(lastApplyCode);
condition["createdAt"] = { $lt: lastApply.createdAt };
if(lastApply) condition["createdAt"] = { $lt: lastApply.createdAt };
}
const list: UserGuildApplyType[] = await UserGuildApplyModel.find(condition)
.sort({ createdAt: -1 })
@@ -106,7 +106,7 @@ export default class UserGuildApply extends BaseModel {
let condition = { roleId, type: GUILD_APPLY_TYPE.INVITE };
if(lastApplyCode) {
const lastApply = await this.findByCode(lastApplyCode);
condition["createdAt"] = { $lt: lastApply.createdAt };
if(lastApply) condition["createdAt"] = { $lt: lastApply.createdAt };
}
const list: UserGuildApplyType[] = await UserGuildApplyModel.find(condition, {_id: 0})
.sort({ createdAt: -1 })