|
@@ -2,7 +2,7 @@ import { App, Inject, OnWSConnection, OnWSDisConnection, OnWSMessage, WSControll
|
|
import { Context } from '@midwayjs/ws';
|
|
import { Context } from '@midwayjs/ws';
|
|
import * as http from 'http';
|
|
import * as http from 'http';
|
|
import get = require('lodash/get');
|
|
import get = require('lodash/get');
|
|
-import group = require('lodash/group');
|
|
|
|
|
|
+import groupBy = require('lodash/groupBy');
|
|
import { Application } from '@midwayjs/ws';
|
|
import { Application } from '@midwayjs/ws';
|
|
import last = require('lodash/last');
|
|
import last = require('lodash/last');
|
|
import { Types } from 'mongoose';
|
|
import { Types } from 'mongoose';
|
|
@@ -41,7 +41,7 @@ export class WsSocketController {
|
|
if (!to) return;
|
|
if (!to) return;
|
|
let list = await this.model.find({ to }).lean();
|
|
let list = await this.model.find({ to }).lean();
|
|
list = list.map(i => ({ ...i, type: get(i, 'msg.type') }));
|
|
list = list.map(i => ({ ...i, type: get(i, 'msg.type') }));
|
|
- const groups = group(list, 'type');
|
|
|
|
|
|
+ const groups = groupBy(list, 'type');
|
|
for (const key in groups) {
|
|
for (const key in groups) {
|
|
const list = groups[key];
|
|
const list = groups[key];
|
|
const type = get(last(list), 'type');
|
|
const type = get(last(list), 'type');
|