|
|
@@ -3,6 +3,7 @@ import {
|
|
|
RefreshToken,
|
|
|
PackageName,
|
|
|
ProductId,
|
|
|
+ IosUrl,
|
|
|
SandboxIosUrl,
|
|
|
Account,
|
|
|
ClientSecret,
|
|
|
@@ -658,38 +659,7 @@ class ApiController {
|
|
|
async getServerList(ctx) {
|
|
|
let tag = ctx.query.tag || 'default'
|
|
|
const servers = (await Server.getServerList(tag))
|
|
|
- let data = []
|
|
|
- let ip = ctx.request.ip
|
|
|
- if (ip.startsWith('::ffff:')) {
|
|
|
- ip = ip.substring('::ffff:'.length);
|
|
|
- }
|
|
|
-
|
|
|
- logger.info("区服接口", { "ip": ctx.request.ip })
|
|
|
- if (servers.length > 0) {
|
|
|
- servers.forEach(function (element) {
|
|
|
- let status = element.status
|
|
|
- if (status == 0 && element.white_list) {
|
|
|
- const list = element.white_list.split(",");
|
|
|
-
|
|
|
- if (list.length > 0) {
|
|
|
- if (list.includes(ip)) {
|
|
|
- status = 1
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- data.push({
|
|
|
- "id": element.id,
|
|
|
- "name": element.name,
|
|
|
- "ip": element.ip,
|
|
|
- "port": element.port,
|
|
|
- "tips": element.tips,
|
|
|
- "status": status,
|
|
|
- })
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- ctx.body = data
|
|
|
+ ctx.body = servers
|
|
|
}
|
|
|
|
|
|
async getAllServerList(ctx) {
|
|
|
@@ -898,6 +868,32 @@ class ApiController {
|
|
|
msg: "success"
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 维护服务器,踢掉所有玩家
|
|
|
+ async maintenance(ctx) {
|
|
|
+ let data = ctx.request.body
|
|
|
+ let url = await getServerList(data.serverId, 'default')
|
|
|
+ if (!url) {
|
|
|
+ ctx.body = {
|
|
|
+ code: 1,
|
|
|
+ msg: `区服id错误: serverId ${data.serverId}`
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let param = JSON.stringify({
|
|
|
+ type: "kickAllUser"
|
|
|
+ })
|
|
|
+ Msg.connect(url, Account);
|
|
|
+ new Promise((resolve) => {
|
|
|
+ setTimeout(async () => {
|
|
|
+ Msg.CG_TEST_PROTO(data.account, param)
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+ ctx.body = {
|
|
|
+ code: 0,
|
|
|
+ msg: "success"
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = new ApiController()
|