后台:修改白名单

This commit is contained in:
luying
2021-12-08 17:35:23 +08:00
parent fc38485f94
commit 46108f90f2
14 changed files with 56 additions and 43 deletions
+5 -13
View File
@@ -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