'use strict'; /** * Created by EllisRan on 2020/3/3. */ const BaseService = require('../base/base_service'); module.exports = app => { class FinancialPayTender extends BaseService { /** * 构造函数 * * @param {Object} ctx - egg全局变量 * @return {void} */ constructor(ctx) { super(ctx); this.tableName = 'financial_pay_tender'; this.dataId = 'id'; } async savePayTender(spid, data) { if (data.id === 0) { delete data.id; data.spid = spid; const result = await this.db.insert(this.tableName, data); return await this.getDataById(result.insertId); } await this.db.update(this.tableName, data); return await this.getDataById(data.id); } } return FinancialPayTender; };