登录优化:gate可变为短链接

This commit is contained in:
luying
2021-09-03 10:36:11 +08:00
parent e3f3b5f2a1
commit 4069220698
24 changed files with 141 additions and 14 deletions
+20 -1
View File
@@ -3,7 +3,7 @@ import * as Redis from 'redis';
import {REDIS_KEY} from '../consts'
import { GameModel } from "../db/Game";
import { promisifyAll } from 'bluebird';
import { pinus } from 'pinus';
import { pinus, ServerInfo } from 'pinus';
import { GuildRankParam, GuildLeader, RankParam, LineupParam } from '../domain/rank';
import { comBtlRanges } from '../pubUtils/data';
import { setRankRedisFromDb } from './rankService';
@@ -446,3 +446,22 @@ export function redisClient() {
}
/**************** 数据库表end */
/*************** 将connector服插入redis *******/
export async function setConnectors(servers: ServerInfo[]) {
for(let server of servers) {
if(server.serverType == 'connector') {
let { serverType, clientHost, clientPort, id } = server;
await redisClient().hsetAsync(REDIS_KEY.SYS_SERVER, server.id, JSON.stringify({ serverType, clientHost, clientPort, id }));
}
}
}
export async function removeConnectors(servers: string[]) {
for(let server of servers) {
let hasServer = await redisClient().hgetAsync(REDIS_KEY.SYS_SERVER, server);
if(!!hasServer) await redisClient().hdelAsync(REDIS_KEY.SYS_SERVER, server);
}
}