config.js 457 B

123456789101112131415161718
  1. 'use strict';
  2. const { CrudService } = require('naf-framework-mongoose-free/lib/service');
  3. const { BusinessError, ErrorCode } = require('naf-core').Error;
  4. const _ = require('lodash');
  5. const assert = require('assert');
  6. // 设置
  7. class ConfigService extends CrudService {
  8. constructor(ctx) {
  9. super(ctx, 'config');
  10. this.model = this.ctx.model.Config;
  11. }
  12. async fetch() {
  13. return await this.model.findOne();
  14. }
  15. }
  16. module.exports = ConfigService;