12345678910111213141516171819202122 |
- 'use strict';
- const Controller = require('egg').Controller;
- class HomeController extends Controller {
- async index() {
- const { ctx } = this;
- ctx.body = 'hi, egg';
- }
- async sendmq() {
- const { ctx } = this;
- // 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 = 'schedule';
- const routekey = '11';
- const parm = { durable: true, headers: { userId: '2', type: '1', name: '哈哈' } };
- await this.service.rabbitmq.sendQueueMsg(ex, routekey, 'hhhsss', parm);
- this.ctx.body = '发送成功';
- }
- }
- module.exports = HomeController;
|