install.js 513 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. const { CrudService } = require('naf-framework-mongoose/lib/service');
  3. // 初始化
  4. class InstallService extends CrudService {
  5. constructor(ctx) {
  6. super(ctx, 'install');
  7. this.redis = this.app.redis;
  8. }
  9. async index() {
  10. await this.initProject();
  11. }
  12. /**
  13. * 初始化redis中,项目名的缓存
  14. */
  15. async initProject() {
  16. const project = [ 'platlive', 'zhwl', 'live' ];
  17. await this.redis.set('project', JSON.stringify(project));
  18. }
  19. }
  20. module.exports = InstallService;