登录优化:gate可变为短链接
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user