financial_pay_tender.js 926 B

12345678910111213141516171819202122232425262728293031323334353637
  1. 'use strict';
  2. /**
  3. * Created by EllisRan on 2020/3/3.
  4. */
  5. const BaseService = require('../base/base_service');
  6. module.exports = app => {
  7. class FinancialPayTender extends BaseService {
  8. /**
  9. * 构造函数
  10. *
  11. * @param {Object} ctx - egg全局变量
  12. * @return {void}
  13. */
  14. constructor(ctx) {
  15. super(ctx);
  16. this.tableName = 'financial_pay_tender';
  17. this.dataId = 'id';
  18. }
  19. async savePayTender(spid, data) {
  20. if (data.id === 0) {
  21. delete data.id;
  22. data.spid = spid;
  23. const result = await this.db.insert(this.tableName, data);
  24. return await this.getDataById(result.insertId);
  25. }
  26. await this.db.update(this.tableName, data);
  27. return await this.getDataById(data.id);
  28. }
  29. }
  30. return FinancialPayTender;
  31. };