12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- 'use strict';
- const BaseService = require('./base.js');
- // 提现记录服务类
- class CashService extends BaseService {
- // 使用模型
- get useModel() {
- const that = this;
- return that.app.model.UsersCashLogs;
- }
- /**
- * 添加提现记录
- * @return {Promise<void>}
- */
- 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<void>}
- */
- 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;
|