军团:提取权限判断
This commit is contained in:
@@ -48,10 +48,10 @@ export async function getMyGuildInfo(roleId: string, sid: string, userGuild: Use
|
||||
* @param func 操作id
|
||||
* @param auth 权限
|
||||
*/
|
||||
export async function checkAuth(func: number, roleId: string, code?: string, userGuild?: UserGuildType) {
|
||||
const auth = await UserGuildModel.getMyAuth(roleId, code, userGuild);
|
||||
export async function checkAuth(func: number, roleId: string, targetCode?: string, userGuild?: UserGuildType) {
|
||||
const auth = await UserGuildModel.getMyAuth(roleId, targetCode, userGuild);
|
||||
const dicGuildAuth = gameData.guildAuth.get(func);
|
||||
// console.log('*checkAuth*', auth, dicGuildAuth)
|
||||
console.log('*checkAuth*', func, auth, dicGuildAuth)
|
||||
if (!dicGuildAuth) return false;
|
||||
|
||||
return dicGuildAuth.includes(auth);
|
||||
@@ -215,6 +215,11 @@ export async function getUserGuildWithRefActive(roleId: string, select?: string,
|
||||
let userGuild = await UserGuildModel.getMyGuild(roleId, select ? select + ' wishGoods +refTimeDaily' : '+refTimeDaily');
|
||||
// console.log(JSON.stringify(userGuild))
|
||||
if (!userGuild) return false;
|
||||
return await refreshUserGuild(userGuild, roleId, notPush);
|
||||
}
|
||||
|
||||
export async function refreshUserGuild(userGuild: UserGuildType, roleId: string, notPush?: boolean) {
|
||||
if(!userGuild) return false;
|
||||
let { receivedActive, refTimeDaily, activeDaily, activeRecord, wishGoods } = userGuild;
|
||||
|
||||
const now = new Date();
|
||||
@@ -236,7 +241,7 @@ export async function getUserGuildWithRefActive(roleId: string, select?: string,
|
||||
|
||||
receivedActive = []; refTimeDaily = now; activeDaily = 0; activeRecord = []; wishGoods = [];
|
||||
let receiveBoxs = [], wishDntCnt = 0, donateCnt = 0;
|
||||
userGuild = await UserGuildModel.updateInfo(roleId, { receivedActive, refTimeDaily, activeDaily, activeRecord, wishGoods, receiveBoxs, wishDntCnt, donateCnt }, {}, select);
|
||||
userGuild = await UserGuildModel.updateInfo(roleId, { receivedActive, refTimeDaily, activeDaily, activeRecord, wishGoods, receiveBoxs, wishDntCnt, donateCnt }, {});
|
||||
if (!userGuild) return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user