const utils = require('j7/utils'); const app = require('j7/app'); class Session { constructor(req, rsp) { this.req = req; this.rsp = rsp; this.nowTime = utils.getUtcTime(); } destory() { } getNowTime() { return this.nowTime; } getNowDaySeconds() { return this.getNowDaySeconds(this.getNowTime()); } getDaySeconds(utcTime) { } rspErr(errCode, errMsg) { utils.rspErr(this.rsp, errCode, errMsg); } rspOk() { utils.rspOk(this.rsp); } rspData(data) { utils.rspData(this.rsp, data); } dieErr(errCode, errMsg) { this.rspErr(errCode, errMsg); } request(name, defVal = null) { return name in this.req.query ? this.req.query[name] : defVal; } requestToJson() { return utils.jsonEncode(this.req.query); } } module.exports = Session;