'use strict'; /** * 初始化控制器 * * @author CaiAoLin * @date 2017/11/24 * @version */ module.exports = app => { class BootController extends app.BaseController { /** * 初始化用户信息页面 * * @param {Object} ctx - egg全局变量 * @return {void} */ async index(ctx) { const rule = ctx.service.customer.rule('boot'); const jsValidator = await this.jsValidator.convert(rule).build(); const renderData = { jsValidator, }; await ctx.render('boot/index.ejs', renderData); } /** * 初始化用户 * * @param {Object} ctx - egg全局变量 * @return {void} */ async boot(ctx) { try { const rule = ctx.service.customer.rule('boot'); ctx.validate(rule); const result = await ctx.service.customer.boot(ctx.request.body); } catch (error) { this.log(err); } ctx.body = 'test'; } } return BootController; };