🐞 fix(判空): 根据后台错误日志添加空值判断
This commit is contained in:
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user