后台:修改白名单
This commit is contained in:
+5
-13
@@ -11,7 +11,6 @@ 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');
|
||||
@@ -659,20 +658,13 @@ export function getFloorStatus(gachaId: number, floor: Floor[]) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function checkWhiteListWithUid(uid: number) {
|
||||
let user = await UserModel.findUserByUid(uid);
|
||||
if(!user) return false;
|
||||
let { tel, ip } = user;
|
||||
return await checkWhiteList(tel, ip);
|
||||
}
|
||||
|
||||
export async function checkWhiteList(tel: string, ip: string) {
|
||||
if(tel) {
|
||||
let result = await WhiteListModel.checkTel(tel);
|
||||
export async function checkWhiteList(env: string, ip: string, uid: number, serverId: number) {
|
||||
if(ip) {
|
||||
let result = await WhiteListModel.checkIp(env, ip);
|
||||
if(!!result) return true;
|
||||
}
|
||||
if(ip) {
|
||||
let result = await WhiteListModel.checkIp(ip);
|
||||
if(uid && serverId) {
|
||||
let result = await WhiteListModel.checkUid(env, serverId, uid);
|
||||
if(!!result) return true;
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user