fix: echo丢失问题

This commit is contained in:
手瓜一十雪
2024-09-03 18:37:28 +08:00
parent 6699ff38a1
commit 8647c5c607
2 changed files with 2 additions and 2 deletions

View File

@@ -54,7 +54,7 @@ abstract class BaseAction<PayloadType, ReturnDataType> {
public async websocketHandle(payload: PayloadType, echo: any): Promise<OB11Return<ReturnDataType | null>> { public async websocketHandle(payload: PayloadType, echo: any): Promise<OB11Return<ReturnDataType | null>> {
const result = await this.check(payload); const result = await this.check(payload);
if (!result.valid) { if (!result.valid) {
return OB11Response.error(result.message, 1400); return OB11Response.error(result.message, 1400, echo);
} }
try { try {
const resData = await this._handle(payload); const resData = await this._handle(payload);

View File

@@ -147,7 +147,7 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
this.checkStateAndReply<any>(OB11Response.error('不支持的api ' + receiveData.action, 1404, echo)); this.checkStateAndReply<any>(OB11Response.error('不支持的api ' + receiveData.action, 1404, echo));
return; return;
} }
const retdata = await action?.websocketHandle(receiveData.params, echo ?? ''); const retdata = await action.websocketHandle(receiveData.params, echo ?? '');
const packet = Object.assign({}, retdata); const packet = Object.assign({}, retdata);
this.checkStateAndReply<any>(packet); this.checkStateAndReply<any>(packet);
} }