🐞 fix(判空): 根据后台错误日志添加空值判断
This commit is contained in:
@@ -213,6 +213,8 @@ export class EntryHandler {
|
||||
let ip = session.get('ip');
|
||||
|
||||
let role = await Role.findByRoleId(roleId, 'lv');
|
||||
if(!role) return resResult(STATUS.ROLE_NOT_FOUND);
|
||||
|
||||
let apJson = await getAp(roleId, ip, role.lv);
|
||||
return resResult(STATUS.SUCCESS, { apJson });
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ export class GuildHandler {
|
||||
const roleId: string = session.get('roleId');
|
||||
const roleName: string = session.get('roleName');
|
||||
const serverId: number = parseInt(session.get('serverId'));
|
||||
if(!userGuild) return resResult(STATUS.GUILD_NOT_FOUND);
|
||||
const { guildCode } = userGuild;
|
||||
let flag = await checkBossBattleMemberExists(guildCode, serverId, roleId, battleCode);
|
||||
if (!flag) {
|
||||
|
||||
@@ -182,6 +182,7 @@ export class GuildHandler {
|
||||
|
||||
const select = ['code', 'name', 'notice', 'ceLimit', 'isAuto', 'icon', 'lv', 'memberCnt', 'guildCe'];
|
||||
const guild = await GuildModel.findByCode(code, null, select.join(' '));
|
||||
if(!guild) return resResult(STATUS.GUILD_NOT_FOUND);
|
||||
let leader = <RoleType>guild.leader;
|
||||
delete guild.leader;
|
||||
// 返回
|
||||
|
||||
@@ -229,8 +229,8 @@ export async function getUserGuildWithRefActive(roleId: string, select?: string)
|
||||
userGuild = await UserGuildModel.resetDailyInfoByRefTimeDaily(roleId, refTimeDaily);
|
||||
if (refTimeDaily && userGuild) {
|
||||
await sendUnreceivedWishPool(wishGoods, roleId);
|
||||
await sendUnreceivedActiveBox(roleId, guildCode, refTimeDaily, receivedActive);
|
||||
await sendUnreceivedDonateBox(roleId, guildCode, refTimeDaily, receiveBoxs);
|
||||
await sendUnreceivedActiveBox(roleId, guildCode, refTimeDaily, receivedActive||[]);
|
||||
await sendUnreceivedDonateBox(roleId, guildCode, refTimeDaily, receiveBoxs||[]);
|
||||
await sendUnreceivedBossWar(roleId, refTimeDaily);
|
||||
}
|
||||
if (!userGuild) {
|
||||
|
||||
@@ -140,7 +140,7 @@ export async function sendMessageToTeam(teamCode: string, route: string, data: a
|
||||
*/
|
||||
export function addUserToTeamChannel(teamCode: string, isCreate: boolean, roleId: string, sid: string) {
|
||||
let channel = pinus.app.get('channelService').getChannel(teamCode, isCreate);
|
||||
addUserToChannel(channel, roleId, sid);
|
||||
if(channel) addUserToChannel(channel, roleId, sid);
|
||||
return channel
|
||||
}
|
||||
|
||||
|
||||
@@ -1331,7 +1331,7 @@ export async function getRankInHandler(redisKey: REDIS_KEY, type: RANK_TYPE, key
|
||||
} else if (type == RANK_TYPE.GUILD_LV) {
|
||||
if(role.hasGuild) {
|
||||
let guild = await GuildModel.findByCode(guildCode, serverId);
|
||||
myRank = await r.generMyRankWithGuild2(roleId, guild.lv, guild.activeWeekly, guild.lvUpdateTime, guild);
|
||||
if(guild) myRank = await r.generMyRankWithGuild2(roleId, guild.lv, guild.activeWeekly, guild.lvUpdateTime, guild);
|
||||
}
|
||||
} else if (type == RANK_TYPE.GUILD_FUND) {
|
||||
if(role.hasGuild) {
|
||||
|
||||
@@ -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: '未找到该成员或该成员已退出' },
|
||||
|
||||
@@ -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