ctxresp add stime

This commit is contained in:
lik
2020-04-28 17:21:07 +08:00
parent eee4614161
commit 3306db1ff8
2 changed files with 7 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
'use strict';
const Moment = require('moment');
function ctxresp(ctx, data, errno, errmsg) {
if (errno === null || errno === undefined) errno = 0;
if (errmsg === null || errmsg === undefined) errmsg = '';
@@ -8,7 +10,8 @@ function ctxresp(ctx, data, errno, errmsg) {
ctx.body = {
result: errno === 0 ? 'ok' : 'fail',
error: { code: errno, msg: errmsg },
data: data
data: data,
stime: Moment().format('YYYY-MM-DD HH:mm:ss')
};
}