统一推送格式

This commit is contained in:
luying
2020-12-30 11:03:45 +08:00
parent 3677d99d60
commit d6b4f1d62d
9 changed files with 44 additions and 40 deletions

View File

@@ -1,4 +1,6 @@
import {Application, BackendSession} from 'pinus';
import { resResult } from '../../../pubUtils/util';
import { STATUS } from '../../../consts';
export default function(app: Application) {
@@ -29,13 +31,13 @@ export class ChatHandler {
// the target is all users
if (msg.target === '*') {
channel.pushMessage('onChat', param);
channel.pushMessage('onChat', resResult(STATUS.SUCCESS, param));
}
// the target is specific user
else {
let tuid = msg.target + '*' + rid;
let tsid = channel.getMember(tuid)['sid'];
channelService.pushMessageByUids('onChat', param, [{
channelService.pushMessageByUids('onChat', resResult(STATUS.SUCCESS, param), [{
uid: tuid,
sid: tsid
}]);
@@ -55,13 +57,13 @@ export class ChatHandler {
// the target is all users
if (msg.target === '*') {
channel.pushMessage('onChat', param);
channel.pushMessage('onChat', resResult(STATUS.SUCCESS, param));
}
// the target is specific user
else {
let tuid = msg.target + '*' + rid;
let tsid = channel.getMember(tuid)['sid'];
channelService.pushMessageByUids('onChat', param, [{
channelService.pushMessageByUids('onChat', resResult(STATUS.SUCCESS, param), [{
uid: tuid,
sid: tsid
}]);