This commit is contained in:
van
2026-05-09 23:53:28 +08:00
parent 83dc41f3a5
commit e93b5960cb

View File

@@ -95,11 +95,15 @@ public class WxSendWeComPushClient {
/**
* 在被动回复返回后再发,保证企微侧先出现首条被动消息。
* 无分段(如「开/慢开」仅异步 TG、被动已单独回执时不调度避免空列表告警。
*/
public void scheduleActivePushes(String toUser, String wecomCallbackAgentId, List<String> contents) {
final String userId = toUser != null ? toUser.trim() : "";
final String agentPass = wecomCallbackAgentId != null ? wecomCallbackAgentId.trim() : "";
final List<String> list = contents != null ? new ArrayList<>(contents) : Collections.emptyList();
if (list.isEmpty()) {
return;
}
final String userId = toUser != null ? toUser.trim() : "";
CompletableFuture.runAsync(() -> {
boolean ok = pushAfterPassiveDelaySync(
userId, StringUtils.hasText(agentPass) ? agentPass : null, list);
@@ -147,6 +151,22 @@ public class WxSendWeComPushClient {
log.error("wxSend active-push HTTP {} url={} body={}", code, url, resp);
return false;
}
if (StringUtils.hasText(resp)) {
try {
JSONObject jo = JSONObject.parseObject(resp);
if (jo != null && jo.containsKey("code")) {
Integer biz = jo.getInteger("code");
if (biz != null && biz != 200) {
log.error(
"wxSend active-push 业务失败 http={} code={} msg={} body={}",
code, biz, jo.getString("msg"), resp);
return false;
}
}
} catch (Exception parseSkip) {
// 非 JSON 则仅以 HTTP 为准
}
}
log.debug("wxSend active-push OK http={} resp={}", code, resp);
return true;
} catch (Exception e) {