'use strict'; const { CrudService } = require('naf-framework-mongoose-free/lib/service'); const { BusinessError, ErrorCode } = require('naf-core').Error; const _ = require('lodash'); const assert = require('assert'); // 展会合同备份 class DockTranscationService extends CrudService { constructor(ctx) { super(ctx, 'dock_transcation'); this.model = this.ctx.model.Dock.DockTranscation; } /** * 查该用户的供/需记录 * @param {Object} Object */ async getUserList({ skip = 0, limit = 0, ...query } = {}) { const { user_id, ...info } = query; const nquery = { ...info, $or: [{ s_id: user_id }, { d_id: user_id }] }; const data = await this.model.find(nquery).skip(parseInt(skip)).limit(parseInt(limit)); const total = await this.model.count(nquery); return { data, total }; } } module.exports = DockTranscationService;