系统:停服维护逻辑
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user