|
|
|
@ -156,8 +156,36 @@ function getClusterInfo(opts) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function getRestfulInfo(opts) { |
|
|
|
return async function (ctx, next) { |
|
|
|
const models = ctx.fs.dc.models; |
|
|
|
try { |
|
|
|
let todayTotal = await models.RestfulApiRecord.Count({ |
|
|
|
where: { |
|
|
|
visitTime: { [Op.between]: [moment().startOf('day'), moment().endOf('day')] } |
|
|
|
} |
|
|
|
}) |
|
|
|
let total = await models.RestfulApiRecord.Count({ |
|
|
|
where: { |
|
|
|
id: { [$.gt]: 0 } |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
ctx.body = { total, todayTotal }; |
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
|
|
ctx.status = 400; |
|
|
|
ctx.body = { message: '查询后端同步数据库数据量总量和top5' } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
getNodeResources, |
|
|
|
getDataTotalTop5, |
|
|
|
getClusterInfo |
|
|
|
getClusterInfo, |
|
|
|
getRestfulInfo |
|
|
|
} |
|
|
|
|