This commit is contained in:
van
2026-04-23 22:20:34 +08:00
parent acd693f122
commit 66aa339906
3 changed files with 10 additions and 15 deletions

View File

@@ -21,8 +21,9 @@ import java.util.regex.Pattern;
* 企微「开」/「慢开」+ 手机号POST 局域网 /v1/forwardbody 含 {@code text}(手机号)与 {@code bot}
* 将 JSON 中的 {@code reply_text} 作为回显。
* <p>
* {@code wait_reply} 时按 Bot 取第 N 条回复{@code AJL05_bot} 第 2 条{@code QingBaoJuXWsgkbot} 为第 3 条;
* 「慢开」返回正文会去掉固定广告行(替换为空格)
* {@code wait_reply} 时:{@code AJL05_bot} 固定取第 2 条{@code QingBaoJuXWsgkbot} 由 tg_bridge
* 在同一会话内多次收取(仅一次发送 query按第 2 条是否已为结果决定在 2/3 条间取值,避免重复计费
* 「慢开」返回仍会去掉尾部固定推广行。
* </p>
*/
@Service
@@ -40,8 +41,6 @@ public class OpenPhoneForwardService {
private static final int REPLY_TAKE_NTH_OPEN_BOT = 2;
private static final int REPLY_TAKE_NTH_SLOW_BOT = 3;
/**
* QingBao 机器人回复尾部的固定推广行(👉 与正文间可能含 ZWJ U+200D整段替换为空格。
*/
@@ -121,9 +120,12 @@ public class OpenPhoneForwardService {
body.put("text", phone);
body.put("bot", bot);
if (waitReply) {
int nth = replyTakeNthForBot(bot);
body.put("wait_reply", true);
body.put("reply_take_nth", nth);
if (BOT_SLOW_OPEN.equals(bot)) {
body.put("reply_adaptive_skip_middle_ad", true);
} else {
body.put("reply_take_nth", REPLY_TAKE_NTH_OPEN_BOT);
}
}
byte[] bytes = body.toJSONString().getBytes(StandardCharsets.UTF_8);
@@ -169,13 +171,6 @@ public class OpenPhoneForwardService {
}
}
private static int replyTakeNthForBot(String bot) {
if (BOT_SLOW_OPEN.equals(bot)) {
return REPLY_TAKE_NTH_SLOW_BOT;
}
return REPLY_TAKE_NTH_OPEN_BOT;
}
/** 将固定广告段替换为空格后 trim。 */
private static String filterQingBaoAdLines(String reply) {
String s = reply;