ctxresp add stime
This commit is contained in:
parent
eee4614161
commit
3306db1ff8
@ -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')
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ehason/utils",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.2",
|
||||
"description": "Utils for ehason develope",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -9,6 +9,7 @@
|
||||
"author": "likeagle <likeagle@163.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"amqplib": "^0.5.5"
|
||||
"amqplib": "^0.5.5",
|
||||
"moment": "^2.24.0"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user