async getBar() { try { this.ctx.body = await this.service.foo.bar(); } catch (e) { this.ctx.logger.error(e); } }
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); } }
await ctx.service.order.get_redirect_url(url); } catch (e) { ctx.body = { code: -1, data: '', msg: '补单失败,订单状态异常!' };
await ctx.service.order.update(); throw '订单金额的二维码不存在'; // 订单金额的二维码不存在 ctx.body = await ctx.service.order.createOrder(qr_data.get('qr_url'), qr_data.get('qr_price')); } else { const QrCodeResult = await ctx.service.order.find_more_price(newPrice, order_type); if (QrCodeResult.length !== 0) { QrCodeResult.forEach(item => { newPrice = filterNewPrice(newPrice); const alipay_url = await ctx.service.qrdecode.find_pay_url(newPrice, order_type); if (alipay_url.length === 0) { // 没有可用收款二维码 throw '系统火爆,请过1-3分钟后下单!'; ctx.body = await ctx.service.order.createOrder(alipay_url[index].dataValues.qr_url, alipay_url[index].dataValues.qr_price); ctx.body = await ctx.service.order.createOrder(alipays + encodeURIComponent(url + tempPrice), tempPrice); } else { const QrCodeResult = await ctx.service.order.find_more_price(newPrice, order_type); if (QrCodeResult.length !== 0) { QrCodeResult.forEach(item => { ctx.body = await ctx.service.order.createOrder(alipays + encodeURIComponent(url + newPrice[index]), newPrice[index]);
// 获得系统重启信息 async getSysDbErrorList() { const { ctx } = this; const result = await ctx.service.errors.getErrorList(); ctx.body = this.app.result({ data: result, }); }
async addEmail() { const { ctx } = this; const query = ctx.request.body; const email = query.email; const name = query.name; if (!email) throw new Error('新增邮件:邮件地址不能为空!'); if (!name) throw new Error('新增邮件:邮件所属人不能为空!'); const result = await ctx.service.emails.addEmail(email, name); ctx.body = this.app.result({ data: result, }); }
async getList() { const { ctx } = this; const query = ctx.request.query; const pageNo = query.pageNo; const pageSize = query.pageSize || this.app.config.pageSize; const email = query.email; const result = await ctx.service.emails.getList(pageNo, pageSize, email); ctx.body = this.app.result({ data: result, }); }
// 新增系统 async addNewSystem() { const { ctx } = this; return await ctx.service.system.saveSystemData(ctx); }
// 获得error分类列表 async getAverageErrorList() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; if (!appId) throw new Error('获得error分类列表:appId不能为空'); const result = await ctx.service.web.errors.getAverageErrorList(ctx); ctx.body = this.app.result({ data: result, }); }
// 删除用户 async delete() { const { ctx } = this; const query = ctx.request.body; const id = query.id || ''; const usertoken = query.usertoken || ''; if (!id) throw new Error('删除用户:id不能为空'); const result = await ctx.service.user.delete(id, usertoken); ctx.body = this.app.result({ data: result, }); }
// 根据用户id获取系统列表 async getSysForUserId() { const { ctx } = this; const result = await ctx.service.system.getSysForUserId(ctx); ctx.body = this.app.result({ data: result, }); }
// 获得历史概况 async getHistoryPvUvIplist() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; if (!appId) throw new Error('pvuvip获得历史概况:appId不能为空'); const result = await ctx.service.web.pvuvip.getHistoryPvUvIplist(appId); ctx.body = this.app.result({ data: result, }); }