async test() { this.ctx.locals.test.localsCheckAny(); this.app.config.keys.configKeysCheckAny(); this.app.appCheckAny(); }
async getData() { try { this.ctx.logger.info('getData'); this.ctx.helper.test(); this.ctx.body = await this.ctx.service.foo.bar(); this.ctx.proxy.foo.bar(); } catch (e) { const body: RequestObjectBody = this.ctx.request.body; this.app.logger.info(e.name, body.foo); } }
async httpclient() { await this.app.httpclient.request('url', { method: 'POST', }); await this.ctx.curl('url', { method: 'POST', }); await this.app.curl('url', { method: 'POST', }); }
async find_pay_url(data, qr_type) { const { ctx, app } = this; const { Op } = app.Sequelize; return ctx.model.Qrcodes.findAll({ where: { qr_price: { [Op.or]: data, }, qr_type, }, }); }
constructor(ctx: Context) { super(ctx); this.appHttpClient = ctx.app.httpclient; this.ctxHttpClient = ctx.httpclient; this.fooLogger = ctx.getLogger('foo'); }
async bar() { return { env: this.config.env }; }
app.on('egg-ready', () => {});
async testViewRenderString() { this.ctx.body = await this.ctx.view.renderString('test'); }
async update() { // 更新未支付订单 const { ctx, app, config: { orderValidity } } = this; const { Op } = app.Sequelize; await ctx.model.Orders.update({ pay_status: '已过期', }, { where: { created_at: { [Op.lt]: +new Date() - parseInt(orderValidity) * 60 * 1000, }, pay_status: '未支付', }, }); }
async test() { this.ctx.locals.test.serviceLocalCheckAny(); this.app.config.keys.serviceConfigCheckAny(); this.app.serviceAppCheckAny(); }
async test() { this.ctx.logger.info(this.app.config.keys); await this.app.controller.myctrl.test(); }
async find_more_price(data, order_type) { const { ctx, app } = this; const { Op } = app.Sequelize; return ctx.model.Orders.findAll({ where: { qr_price: { [Op.or]: data, }, order_type, pay_status: '未支付', }, }); }