fix(push): add OPPO delivery diagnostics
这个提交包含在:
父节点
71975e8b7c
当前提交
b20bb12091
@ -59,6 +59,7 @@ public class OppoPushProvider implements PushProvider {
|
|||||||
String messageId = appKey + "_" + System.currentTimeMillis();
|
String messageId = appKey + "_" + System.currentTimeMillis();
|
||||||
Map<String, Object> notification = new java.util.LinkedHashMap<>();
|
Map<String, Object> notification = new java.util.LinkedHashMap<>();
|
||||||
notification.put("app_message_id", messageId);
|
notification.put("app_message_id", messageId);
|
||||||
|
notification.put("style", 1);
|
||||||
notification.put("title", title);
|
notification.put("title", title);
|
||||||
notification.put("content", body);
|
notification.put("content", body);
|
||||||
notification.put("click_action_type", 0);
|
notification.put("click_action_type", 0);
|
||||||
@ -86,6 +87,9 @@ public class OppoPushProvider implements PushProvider {
|
|||||||
JsonNode json = objectMapper.readTree(response.body());
|
JsonNode json = objectMapper.readTree(response.body());
|
||||||
int code = json.path("code").asInt(-1);
|
int code = json.path("code").asInt(-1);
|
||||||
if (response.statusCode() == 200 && code == 0) {
|
if (response.statusCode() == 200 && code == 0) {
|
||||||
|
String vendorMessageId = json.path("data").path("messageId").asText("");
|
||||||
|
log.info("OPPO push accepted: appMessageId={} vendorMessageId={} channelId={} target={} response={}",
|
||||||
|
messageId, vendorMessageId, channelId, maskToken(token), response.body());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
log.error("OPPO push rejected: httpStatus={} code={} message={}",
|
log.error("OPPO push rejected: httpStatus={} code={} message={}",
|
||||||
@ -139,6 +143,13 @@ public class OppoPushProvider implements PushProvider {
|
|||||||
return java.util.HexFormat.of().formatHex(digest);
|
return java.util.HexFormat.of().formatHex(digest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String maskToken(String token) {
|
||||||
|
if (token == null || token.length() <= 16) {
|
||||||
|
return "***";
|
||||||
|
}
|
||||||
|
return token.substring(0, 8) + "..." + token.substring(token.length() - 8);
|
||||||
|
}
|
||||||
|
|
||||||
private String normalizeActionParameters(String payload) throws Exception {
|
private String normalizeActionParameters(String payload) throws Exception {
|
||||||
JsonNode parsed = runCatchingJson(payload);
|
JsonNode parsed = runCatchingJson(payload);
|
||||||
if (parsed != null && parsed.isObject()) {
|
if (parsed != null && parsed.isObject()) {
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户