系统:停服维护逻辑

This commit is contained in:
luying
2021-07-15 14:31:29 +08:00
parent 352aecfb56
commit 0028c9b992
26 changed files with 348 additions and 50 deletions

View File

@@ -9,6 +9,8 @@ import { HERO_CE_RATIO, ABI_STAGE, GACHA_TO_FLOOR, REFRESH_TIME } from '../const
import { findIndex } from 'underscore';
import { getTimeFunM } from './timeUtil';
import { Floor } from '../domain/activityField/gachaField';
import { WhiteListModel } from '../db/WhiteList';
import { UserModel } from '../db/User';
const randomName = require("chinese-random-name");
const moment = require('moment');
const crypto = require('crypto');
@@ -580,4 +582,26 @@ export function getFloorStatus(gachaId: number, floor: Floor[]) {
count: floorMap.get(id) || 0
}
});
}
export async function checkWhiteListWithUid(uid: number) {
let user = await UserModel.findUserByUid(uid);
if(!user) return false;
let { tel, ip, auth } = user;
return await checkWhiteList(tel, ip, auth);
}
export async function checkWhiteList(tel: string, ip: string, auth: number) {
if(auth == 1) {
return true;
}
if(tel) {
let result = await WhiteListModel.checkTel(tel);
if(!!result) return true;
}
if(ip) {
let result = await WhiteListModel.checkIp(ip);
if(!!result) return true;
}
return false
}