async getBar() { try { this.ctx.body = await this.service.foo.bar(); } catch (e) { this.ctx.logger.error(e); } }
async httpclient() { await this.app.httpclient.request('url', { method: 'POST', }); await this.ctx.curl('url', { method: 'POST', }); await this.app.curl('url', { method: 'POST', }); }
test(this: IHelper) { this.test2(); }
agent.httpclient.request('http://127.0.0.1', { method: 'GET' }).catch(() => {});
agent.on('egg-ready', () => {});
app.controller.test().then(() => {});
// single process mode start({ baseDir: __dirname,ignoreWarning: true}).then(app=>{ const port= 1002; app.logger.info('123'); app.on('egg-ready', () => {}); app.emit('egg-ready'); app.getLogger('test').info('123'); app.inspect(); app.listen(port); app.logger.info(app.locals.test); const ctxHttpClient = new app.ContextHttpClient({} as Context); ctxHttpClient.request('http://127.0.0.1', { method: 'GET' }); const appHttpClient = new app.HttpClient(app); appHttpClient.request('http://127.0.0.1', { method: 'GET' }); app.httpclient.request('http://127.0.0.1', { method: 'GET' }).catch(() => {}); app.logger.info(app.Service); app.logger.info(app.Controller); app.controller.test().then(() => {}); });
await ctx.service.order.get_redirect_url(url); } catch (e) { ctx.body = { code: -1, data: '', msg: '补单失败,订单状态异常!' };
try { let type = '.png'; switch (stream.mime) { case 'image/jpeg': type = '.jpeg'; try { await awaitWriteStream(stream.pipe(writerStream)); } catch (err) { const qrInfo = await ctx.service.baidu.index(imageBase64.toString('base64')); if (!qrInfo) { ctx.body = { code: -1, data: '', msg: '请上传微信定额收款二维码!' }; const qrCurl = await ctx.service.qrdecode.index(imageBase64); qrInfo.qr_url = qrCurl;
async test() { this.ctx.logger.info(this.app.config.keys); await this.app.controller.myctrl.test(); }
app.httpclient.request('http://127.0.0.1', { method: 'GET' }).catch(() => {});