军团:权限判断函数提取
This commit is contained in:
@@ -91,23 +91,6 @@ export default class UserGuild extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
wishDntCnt: number;//今天许愿池捐献次数
|
||||
|
||||
|
||||
|
||||
public static async getMyAuth(roleId: string, guildCode?: string, userGuild?: UserGuildType) {
|
||||
let myGuild: UserGuildType;
|
||||
if(!userGuild) {
|
||||
myGuild = await this.getMyGuild(roleId, 'auth');
|
||||
} else {
|
||||
myGuild = userGuild;
|
||||
}
|
||||
|
||||
if(guildCode && userGuild && userGuild.guildCode != guildCode) {
|
||||
return GUILD_AUTH.OTHERS;
|
||||
}
|
||||
|
||||
return myGuild?myGuild.auth: GUILD_AUTH.OTHERS;
|
||||
}
|
||||
|
||||
public static async getMyGuild(roleId: string, select?: string) {
|
||||
|
||||
const myGuild: UserGuildType = await UserGuildModel.findOne({ roleId, status: USER_GUILD_STATUS.ON })
|
||||
|
||||
Reference in New Issue
Block a user