123456789101112131415161718192021222324252627282930313233343536 |
- 'use strict';
- const Controller = require('egg').Controller;
- class HomeController extends Controller {
- async index() {
- const { ctx } = this;
- ctx.body = '111';
- }
- async test() {
- const { ctx } = this;
- const url = 'https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=26_ltUEKUrKLYOaiDQ0s6H0L3Mis1A4xQEuYElcRrU93k9k8h0g_Eya349E-hwS9pRd66SxVnmIPVdkwfPN1OL4_kpMJdcwNUs2mo5vfBEeM0CPYNhWXdWM4mcsewDVQDoq0SNCkUqIxM4yLMqKWKHiAGACQN';
- const stus = await this.ctx.curl(url, {
- method: 'POST',
- body: { tagid: 100, next_openid: '' },
- });
- console.log('111--' + stus.toString());
- const res = JSON.stringify(stus);
- const obj2 = JSON.parse(res);
- console.log(obj2);
- console.log('111--' + obj2.data.data.toString());
- ctx.body = obj2.data.data.toString();
- }
- async sendmq() {
- // const msg = { userid: ctx.body.userid, name: ctx.body.name, createtime: ctx.body.createtime, type: ctx.body.type, content: ctx.body.content, remark: ctx.body.remark };
- const ex = 'sch_review';
- const routekey = '11';
- const parm = { durable: true, headers: { userId: '5da47c54a24aa17d33309ead', type: '1', name: '哈哈' } };
- await this.service.rabbitmq.sendQueueMsg(ex, routekey, 'hhhsss', parm);
- this.ctx.body = '发送成功';
- }
- }
- module.exports = HomeController;
|