更新:接口
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
## 运行 web-server
|
||||
`cd web-server && node app`
|
||||
|
||||
cd 到 web-server下面
|
||||
`npm run stop && npm run tsc && npm run start`
|
||||
|
||||
## 扩容事项
|
||||
1.master.ts对应环境的主机host填写内网ip地址,新服务器host填写主机host地址
|
||||
2.config/database.ts填写对应环境下的配置
|
||||
@@ -24,4 +27,4 @@
|
||||
7.手输命令示例如下:
|
||||
`pm2 start ./dist/app.js --name="activity-server-2" -x -- env=dev id=activity-server-2 host=172.26.145.171 port=9061 serverType=activity`
|
||||
`pm2 start ./dist/app.js --name="connector-server-4" -x -- env=alpha id=connector-server-4 host=172.26.145.171 port=9062 clientHost=121.89.211.172 clientPort=3050 serverType=connector frontend=true`
|
||||
8.主机部分的server.ts内的server如果需要做rpc remote,host需要从127.0.0.1改为私网地址
|
||||
8.主机部分的server.ts内的server如果需要做rpc remote,host需要从127.0.0.1改为私网地址
|
||||
|
||||
10
web-server/app/controller/update.ts
Normal file
10
web-server/app/controller/update.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Controller } from 'egg';
|
||||
|
||||
export default class UpdateController extends Controller {
|
||||
public async getversion() {
|
||||
const { ctx } = this;
|
||||
const { version } = ctx.request.body;
|
||||
ctx.body = await ctx.service.update.getVersion(version);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,5 +19,6 @@ export default (app: Application) => {
|
||||
router.post('/user/checkversion', tokenParser, controller.game.checkVersion);
|
||||
router.post('/game/getserverlist', tokenParser, controller.game.getServerList);
|
||||
router.post('/game/getnotice', tokenParser, controller.game.getnotice);
|
||||
router.post('/update/getversion', controller.update.getversion);
|
||||
router.post('/web/reloadresource', app.middleware.gmTokenParser(), controller.game.reloadResource);
|
||||
};
|
||||
|
||||
26
web-server/app/service/Update.ts
Normal file
26
web-server/app/service/Update.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { STATUS, } from '@consts';
|
||||
import { Service } from 'egg';
|
||||
// let fs = require("fs");
|
||||
|
||||
// const HOT_URL = 'http://zyz-hot-update.trgame.cn/version.manifest'
|
||||
/**
|
||||
* UpdateRes Service
|
||||
*/
|
||||
export default class Update extends Service {
|
||||
|
||||
/**
|
||||
* 获取版本号
|
||||
* @param version - 客户端版本号
|
||||
*/
|
||||
|
||||
public async getVersion(version: string) {
|
||||
const ctx = this.ctx;
|
||||
console.log('client version: ', version);
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
packageUrl: 'http://zyz-hot-update.trgame.cn/',
|
||||
remoteManifestUrl: 'http://zyz-hot-update.trgame.cn/project.manifest',
|
||||
remoteVersionUrl: 'http://zyz-hot-update.trgame.cn/version.manifest'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
2
web-server/typings/app/controller/index.d.ts
vendored
2
web-server/typings/app/controller/index.d.ts
vendored
@@ -5,11 +5,13 @@ import 'egg';
|
||||
import ExportAccount from '../../../app/controller/account';
|
||||
import ExportGame from '../../../app/controller/game';
|
||||
import ExportHome from '../../../app/controller/home';
|
||||
import ExportUpdate from '../../../app/controller/update';
|
||||
|
||||
declare module 'egg' {
|
||||
interface IController {
|
||||
account: ExportAccount;
|
||||
game: ExportGame;
|
||||
home: ExportHome;
|
||||
update: ExportUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
2
web-server/typings/app/service/index.d.ts
vendored
2
web-server/typings/app/service/index.d.ts
vendored
@@ -11,6 +11,7 @@ import ExportGame from '../../../app/service/Game';
|
||||
import ExportTest from '../../../app/service/Test';
|
||||
import ExportTurboCore from '../../../app/service/TurboCore';
|
||||
import ExportUtils from '../../../app/service/Utils';
|
||||
import ExportUpdate from '../../../app/service/Update';
|
||||
|
||||
declare module 'egg' {
|
||||
interface IService {
|
||||
@@ -19,5 +20,6 @@ declare module 'egg' {
|
||||
test: AutoInstanceType<typeof ExportTest>;
|
||||
turboCore: AutoInstanceType<typeof ExportTurboCore>;
|
||||
utils: AutoInstanceType<typeof ExportUtils>;
|
||||
update: AutoInstanceType<typeof ExportUpdate>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user