12345678910111213141516171819202122232425262728293031323334 |
- 'use strict';
- const Controller = require('egg').Controller;
- const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
- //
- class ChatController extends Controller {
- constructor(ctx) {
- super(ctx);
- this.mq = this.ctx.mq;
- this.redis = this.app.redis;
- }
- async online() {
- const query = this.ctx.query;
- const { person } = query;
- console.log(person);
- if (this.mq) {
- console.log('mq ojbk!');
- }
- if (this.redis) {
- console.log('redis ojbk!');
- const p = await this.redis.get(person);
- // if(p) await this.redis.set(person,'')
- }
- this.ctx.ok();
- }
- async send() {
- const body = this.ctx.request.body;
- console.log(body);
- this.ctx.ok();
- }
- }
- module.exports = CrudController(ChatController, {});
|