'use strict'; /** * 网证通电子签名记录数据模型 * * @author EllisRan * @date 2021/7/15 * @version */ module.exports = app => { class NetcasignLog extends app.BaseService { /** * 构造函数 * * @param {Object} ctx - egg全局变量 * @return {void} */ constructor(ctx) { super(ctx); this.tableName = 'netcasign_log'; } async add(uuid, role, uid, vid) { const insertData = { tid: this.ctx.tender.id, uid, role, uuid, versionid: vid, create_time: new Date(), }; const operate = await this.db.insert(this.tableName, insertData); return operate.affectedRows > 0; } async getLogList(tid) { const sql = 'SELECT a.*, pa.name FROM ?? as a LEFT JOIN ?? as pa ON a.uid = pa.id WHERE tid = ?'; const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tid]; return await this.db.query(sql, sqlParam); } async removeSign(uuid) { return await this.db.delete(this.tableName, { uuid }); } } return NetcasignLog; };