'use strict'; const BaseService = require('./base.js'); // 提现记录服务类 class CashService extends BaseService { // 使用模型 get useModel() { const that = this; return that.app.model.UsersCashLogs; } /** * 添加提现记录 * @return {Promise} */ async addCashLog(data, transaction) { const that = this; const orderBean = await that.app.comoBean.instance(data, { transaction }); await that.service.base.create(orderBean, that.useModel, '提现记录创建失败'); } /** * 查询状态正在提现中的记录 * @return {Promise} */ async getCommissionCashingLog() { const that = this; const seq = that.app.Sequelize; const result = await that.useModel.findAll({ where: { type: { [seq.Op.eq]: 2 }, partner_id: -1 }, }); const cashingRes = JSON.parse(JSON.stringify(result)); return cashingRes; } async getCoinsCashingLog() { const that = this; const seq = that.app.Sequelize; const result = await that.useModel.findAll({ where: { type: { [seq.Op.eq]: 2 }, partner_id: { [seq.Op.gt]: 0 } }, }); const cashingRes = JSON.parse(JSON.stringify(result)); return cashingRes; } } module.exports = CashService;