1
This commit is contained in:
@@ -95,11 +95,15 @@ public class WxSendWeComPushClient {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 在被动回复返回后再发,保证企微侧先出现首条被动消息。
|
* 在被动回复返回后再发,保证企微侧先出现首条被动消息。
|
||||||
|
* 无分段(如「开/慢开」仅异步 TG、被动已单独回执)时不调度,避免空列表告警。
|
||||||
*/
|
*/
|
||||||
public void scheduleActivePushes(String toUser, String wecomCallbackAgentId, List<String> contents) {
|
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 String agentPass = wecomCallbackAgentId != null ? wecomCallbackAgentId.trim() : "";
|
||||||
final List<String> list = contents != null ? new ArrayList<>(contents) : Collections.emptyList();
|
final List<String> list = contents != null ? new ArrayList<>(contents) : Collections.emptyList();
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final String userId = toUser != null ? toUser.trim() : "";
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
boolean ok = pushAfterPassiveDelaySync(
|
boolean ok = pushAfterPassiveDelaySync(
|
||||||
userId, StringUtils.hasText(agentPass) ? agentPass : null, list);
|
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);
|
log.error("wxSend active-push HTTP {} url={} body={}", code, url, resp);
|
||||||
return false;
|
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);
|
log.debug("wxSend active-push OK http={} resp={}", code, resp);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user