'use strict'; const Service = require('egg').Service; const _ = require("lodash"); class ExportDataService extends Service { async index(params) { let { ctx } = this let modelLocal = ctx.model[params.model] let subType = params.subType let paramsLocal = _.omit(params, ["subType", "url", "model"]) let msgObj = { exportS6: "成功导出S6订单", exportxiaoshou: "成功导出销售订单", } let ParamsLocalNotDel = { ...paramsLocal, isExit: 1 } let res = await modelLocal.find(ParamsLocalNotDel).sort({ update_at: -1 }) let count = await modelLocal.find(ParamsLocalNotDel).count() let returnData = { hasError: false, msg: msgObj[subType], subType, list: res, count } return returnData } } module.exports = ExportDataService;