Compare commits
No commits in common. "a5e726e8116bcc41bc81b27f1de7ecda40c27e5d" and "6ec6de4d568de257a1a6dfdcc6603ca2744ff44b" have entirely different histories.
a5e726e811
...
6ec6de4d56
@ -1,6 +1,6 @@
|
||||
import { ApiCall, WsClientStatus } from "tsrpc";
|
||||
import { ActionLog } from '../../public/actionLog/actionLog';
|
||||
import { ChatFun, getCrossChatGroupByOpenDay } from '../../public/chat';
|
||||
import { ChatFun } from '../../public/chat';
|
||||
import { ReqSend, ResSend } from "../../shared/protocols/chat/PtlSend";
|
||||
import { chatMsgLog } from "../../shared/protocols/type"
|
||||
import { getGud } from "../../public/gud";
|
||||
@ -40,8 +40,6 @@ export default async function (call: ApiCall<ReqSend, ResSend>) {
|
||||
|
||||
if (sendData.type == 'cross' && G.clientCross?.status == WsClientStatus.Opened) {
|
||||
//如果是跨服的话,调用跨服API的这条协议
|
||||
sendData.otherData.group = getCrossChatGroupByOpenDay();
|
||||
|
||||
G.clientCross.sendMsg('msg_cross/CrossChat', sendData);
|
||||
call.succ({});
|
||||
return;
|
||||
|
@ -3,7 +3,6 @@ import { ApiCall } from 'tsrpc';
|
||||
import { MsgChat } from '../shared/protocols/msg_s2c/MsgChat';
|
||||
import { player } from '../shared/protocols/user/type';
|
||||
import { chatLog, chatMsgLog } from '../shared/protocols/type'
|
||||
import { PublicShared } from '../shared/public/public';
|
||||
|
||||
const msgListLen = {
|
||||
'cross': 30,
|
||||
@ -11,20 +10,6 @@ const msgListLen = {
|
||||
'guild': 20
|
||||
};
|
||||
|
||||
/**
|
||||
* 通过开服天数,获取跨服聊天分组
|
||||
*/
|
||||
export function getCrossChatGroupByOpenDay(){
|
||||
let openday = PublicShared.getOpenServerDay();
|
||||
if(openday<=7){
|
||||
return 1;
|
||||
}else if(openday <= 30){
|
||||
return 2;
|
||||
}else{
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
export class ChatFun {
|
||||
/**新增消息 */
|
||||
static async newMsg(sendData: MsgChat) {
|
||||
@ -38,11 +23,7 @@ export class ChatFun {
|
||||
G.server.broadcastClusterMsg('msg_s2c/Chat', sendData,{ghId:(sendData.sender as player)?.ghId});
|
||||
}else if(sendData.type == 'cross'){
|
||||
//所有的子进程都会收到,不需要集群内分别广播
|
||||
if(sendData?.otherData?.group == getCrossChatGroupByOpenDay()){
|
||||
//如果时候同一个分组的
|
||||
delete sendData?.otherData?.group;
|
||||
G.server.broadcastMsg('msg_s2c/Chat', sendData);
|
||||
}
|
||||
G.server.broadcastMsg('msg_s2c/Chat', sendData);
|
||||
}else{
|
||||
G.server.broadcastClusterMsg('msg_s2c/Chat', sendData);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user