/
system.ts
38 lines (36 loc) · 1.04 KB
/
system.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { BaseContext, Context } from 'koa';
import { config } from '../config';
import { getCount, updateCount } from '../parse';
export default class SystemController {
public static async getSystemStatus(ctx: BaseContext) {
ctx.status = 200;
ctx.body = {
'code': 200,
'status': 'running',
};
}
public static async getMetaInfo (ctx: BaseContext) {
ctx.status = 200;
ctx.body = {
'code': 200,
'version': config.version,
'port': config.port
};
}
public static async getStatInfo (ctx: Context) {
const body = ctx.request.query;
ctx.status = 200;
ctx.body = {
'code': 200,
'results': await getCount(+body.limit)
};
}
public static async putStatInfo (ctx: Context) {
const body = ctx.request.body;
ctx.status = 200;
ctx.body = {
'code': 200,
'request': await updateCount(+body.user, +body.registry, +body.model)
};
}
}