ledger_audit_content.js 1015 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date 2018/6/1
  7. * @version
  8. */
  9. module.exports = app => {
  10. class LedgerAuditContent extends app.BaseService {
  11. /**
  12. * 构造函数
  13. *
  14. * @param {Object} ctx - egg全局变量
  15. * @return {void}
  16. */
  17. constructor(ctx) {
  18. super(ctx);
  19. this.tableName = 'ledger_audit_content';
  20. }
  21. async add(tender, auditId, data) {
  22. const newContent = {
  23. tender_id: tender.id,
  24. audit_id: auditId,
  25. times: tender.times,
  26. in_time: new Date(),
  27. content: data.opinion,
  28. };
  29. const relaBills = await this.ctx.service.ledger.getDataByNodeIds(tender.id, data.bills);
  30. newContent.rela_bills = JSON.stringify(relaBills);
  31. const result = await this.db.insert(this.tableName, newContent);
  32. return result.effectRows = 1;
  33. }
  34. }
  35. return LedgerAuditContent;
  36. };