|
|
@@ -23,6 +23,7 @@ const Server = require('../model/ServerModel')
|
|
|
const Version = require('../model/VersionModel')
|
|
|
const CDK = require("../model/CDK")
|
|
|
const notice = require("../json/notice.json")
|
|
|
+const th_notice = require("../json/th_notice.json")
|
|
|
const logger = require('../utils/log')
|
|
|
const axios = require('axios');
|
|
|
|
|
|
@@ -786,28 +787,58 @@ class ApiController {
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
- const servers = (await Server.getServerList(tag, [1,3]))
|
|
|
- const serverInfo = servers[servers.length - 1]
|
|
|
- data.push({
|
|
|
- "channel": "Thailand", //渠道固定
|
|
|
- "minSid": 1, //最小服务器
|
|
|
- "maxSid": 10, //最大服务器 这里会控制 服务器列表显示的数量
|
|
|
- "isNewAccount": isNewAccount, //1为新号 会弹出用户协议
|
|
|
- //以下是最近登陆的服务器 (不可为空 如果没有参数可以填最后一个区)
|
|
|
- "sid": serverInfo.id || 1,
|
|
|
- "id": serverInfo.id || 1,
|
|
|
- "name": serverInfo.name || "1区",
|
|
|
- "tips": serverInfo.tips || "",
|
|
|
- "server": serverInfo.ip ? `ws://${serverInfo.ip}:${serverInfo.port}` : "",
|
|
|
- "status": serverInfo.status || 0,
|
|
|
- })
|
|
|
+ const servers = (await Server.getServerList(tag, 1))
|
|
|
+ if(servers.length > 0){
|
|
|
+ const serverInfo = servers[servers.length - 1]
|
|
|
+ data.push({
|
|
|
+ "channel": "Thailand", //渠道固定
|
|
|
+ "minSid": 1, //最小服务器
|
|
|
+ "maxSid": 10, //最大服务器 这里会控制 服务器列表显示的数量
|
|
|
+ "isNewAccount": isNewAccount, //1为新号 会弹出用户协议
|
|
|
+ //以下是最近登陆的服务器 (不可为空 如果没有参数可以填最后一个区)
|
|
|
+ "sid": serverInfo.id || 1,
|
|
|
+ "id": serverInfo.id || 1,
|
|
|
+ "name": serverInfo.name || "1区",
|
|
|
+ "tips": serverInfo.tips || "",
|
|
|
+ "server": serverInfo.ip ? `ws://${serverInfo.ip}:${serverInfo.port}` : "",
|
|
|
+ "status": serverInfo.status || 0,
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+
|
|
|
+ data.push({
|
|
|
+ "channel": "Thailand", //渠道固定
|
|
|
+ "minSid": 1, //最小服务器
|
|
|
+ "maxSid": 10, //最大服务器 这里会控制 服务器列表显示的数量
|
|
|
+ "isNewAccount": isNewAccount, //1为新号 会弹出用户协议
|
|
|
+ //以下是最近登陆的服务器 (不可为空 如果没有参数可以填最后一个区)
|
|
|
+ "sid": 1,
|
|
|
+ "id": 1,
|
|
|
+ "name": "1区",
|
|
|
+ "tips": "",
|
|
|
+ "server": "",
|
|
|
+ "status": 0,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
ctx.body = data
|
|
|
}
|
|
|
|
|
|
async getNotice(ctx) {
|
|
|
- ctx.body = notice
|
|
|
+ let data = ctx.request.body
|
|
|
+ let platform = data.platform || '360'
|
|
|
+
|
|
|
+ switch (platform) {
|
|
|
+ case 'th':
|
|
|
+ ctx.body = th_notice
|
|
|
+ break;
|
|
|
+ case '360':
|
|
|
+ ctx.body = notice
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ ctx.body = notice
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
async genCDK(ctx) {
|