'use strict'; const { CrudService } = require('naf-framework-mongoose-free/lib/service'); const _ = require('lodash'); // 订单表 class OrderService extends CrudService { constructor(ctx) { super(ctx, 'order'); this.model = this.ctx.model.Order; this.tableModel = this.ctx.model.Table; } async getOrder({ id }) { const table_id = _.get(this.ctx, 'table'); const order = await this.model.fetch(id); const table_num = await this.tableModel.fetch(table_id); const obj = { ...order, ...table_num }; return obj; } } module.exports = OrderService;