common.js 495 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const _ = require('lodash');
  3. const Controller = require('egg').Controller;
  4. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  5. // 共通方法管理
  6. class CommonController extends Controller {
  7. constructor(ctx) {
  8. super(ctx);
  9. this.service = this.ctx.service.util;
  10. }
  11. async findone() {
  12. const data = await this.service.findone(this.ctx.params, this.ctx.request.query);
  13. this.ctx.ok({ data });
  14. }
  15. }
  16. module.exports = CommonController;