客服推送处理+后台操作
This commit is contained in:
1 parent
b652132957
commit
a81c637a98
11 files changed
+302
-54
No files matched your search
@@ -1,7 +1,13 @@
|
||||
import { Controller, Get, Logger, Post, Query, Req, Res } from '@nestjs/common';
|
||||
import type { Request, Response } from 'express';
|
||||
import { Public } from '../../common/auth';
|
||||
import { decryptWechatMessage, sameHex, wechatSignature, xmlField } from '../../common/wechat-msg';
|
||||
import {
|
||||
decryptWechatMessage,
|
||||
isCustomerServicePush,
|
||||
sameHex,
|
||||
wechatSignature,
|
||||
xmlField,
|
||||
} from '../../common/wechat-msg';
|
||||
import { InjectConfig, type AppConfig } from '../../config/config';
|
||||
import { PaymentsService } from './payments.service';
|
||||
|
||||
@@ -73,6 +79,12 @@ export class PaymentsController {
|
||||
res.type(body.trimStart().startsWith('<') ? 'application/xml' : 'application/json').send(answer);
|
||||
return;
|
||||
}
|
||||
// 客服消息走的也是这个地址:用户点客服按钮(user_enter_tempsession)或给客服发消息。
|
||||
// 不单独分流的话,这些推送只会被记成「未识别的事件」,用户也等不到任何回应。
|
||||
if (isCustomerServicePush(body)) {
|
||||
res.type('text/plain').send(await this.payments.handleCustomerService(body));
|
||||
return;
|
||||
}
|
||||
// 地址会收到全部事件(投诉、风控、代币等),其余统一回 success 表示已收到。
|
||||
// 先落一条日志,否则这类事件事后完全查不到痕迹。
|
||||
await this.payments.logIgnoredNotify(body);
|
||||
|
||||
Reference in new issue
Block a user