home.js 479 B

123456789101112131415161718192021
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. class HomeController extends Controller {
  4. async index() {
  5. const { ctx } = this;
  6. ctx.body = 'hi, egg';
  7. }
  8. async exitroom() {
  9. const { ctx } = this;
  10. const { uid, roomid } = this.ctx.query;
  11. await this.ctx.controller.chat.index();
  12. const newdata = { uid, roomid };
  13. this.ctx.socket.emit('message', JSON.stringify(newdata));
  14. ctx.body = 'hi, egg';
  15. }
  16. }
  17. module.exports = HomeController;