netcasign_log.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use strict';
  2. /**
  3. * 网证通电子签名记录数据模型
  4. *
  5. * @author EllisRan
  6. * @date 2021/7/15
  7. * @version
  8. */
  9. module.exports = app => {
  10. class NetcasignLog extends app.BaseService {
  11. /**
  12. * 构造函数
  13. *
  14. * @param {Object} ctx - egg全局变量
  15. * @return {void}
  16. */
  17. constructor(ctx) {
  18. super(ctx);
  19. this.tableName = 'netcasign_log';
  20. }
  21. async add(uuid, role, uid, vid) {
  22. const insertData = {
  23. tid: this.ctx.tender.id,
  24. uid,
  25. role,
  26. uuid,
  27. versionid: vid,
  28. create_time: new Date(),
  29. };
  30. const operate = await this.db.insert(this.tableName, insertData);
  31. return operate.affectedRows > 0;
  32. }
  33. async getLogList(tid) {
  34. const sql = 'SELECT a.*, pa.name FROM ?? as a LEFT JOIN ?? as pa ON a.uid = pa.id WHERE tid = ?';
  35. const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tid];
  36. return await this.db.query(sql, sqlParam);
  37. }
  38. async removeSign(uuid) {
  39. return await this.db.delete(this.tableName, { uuid });
  40. }
  41. }
  42. return NetcasignLog;
  43. };