19 lines
445 B
JavaScript
19 lines
445 B
JavaScript
'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 = '';
|
|
if (data === null || data === undefined) data = {};
|
|
|
|
ctx.body = {
|
|
code: errno,
|
|
msg: errmsg,
|
|
data: data,
|
|
stime: Moment().format('YYYY-MM-DD HH:mm:ss SSS')
|
|
};
|
|
}
|
|
|
|
module.exports = ctxresp;
|