'use strict'; class AppBootHook { constructor(app) { this.app = app; } async willReady() { const data = await this.app.model.User.Admin.findOne(); if (!data) { // 没有管理员,初始化一个 const data = { phone: 'admin', password: { secret: '1qaz2wsx' }, }; await this.app.model.User.Admin.create(data); } } async serverDidReady() { // 应用已经启动完毕 // const ctx = await this.app.createAnonymousContext(); // 检查种子 // await ctx.service.install.index(); // await ctx.service.util.rabbitMq.mission(); } } module.exports = AppBootHook;