install.js 547 B

12345678910111213141516171819
  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 InstallService extends CrudService {
  8. constructor(ctx) {
  9. super(ctx, 'install');
  10. }
  11. async index() {
  12. const config = await this.ctx.model.Config.findOne();
  13. if (config) return;
  14. await this.ctx.model.Config.create({ proportion: [], exam_proportion: [] });
  15. }
  16. }
  17. module.exports = InstallService;