diff --git a/mall-common/src/main/java/com/suisung/mall/common/service/impl/UniCloudPushServiceImpl.java b/mall-common/src/main/java/com/suisung/mall/common/service/impl/UniCloudPushServiceImpl.java index 0e1e7ccd..e60f7288 100644 --- a/mall-common/src/main/java/com/suisung/mall/common/service/impl/UniCloudPushServiceImpl.java +++ b/mall-common/src/main/java/com/suisung/mall/common/service/impl/UniCloudPushServiceImpl.java @@ -4,7 +4,6 @@ package com.suisung.mall.common.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.suisung.mall.common.service.UniCloudPushService; @@ -100,6 +99,8 @@ public class UniCloudPushServiceImpl implements UniCloudPushService { payload ); + log.debug("[推送服务] 构建请求体成功, 请求体: {}", requestBody); + // 2. 执行HTTP请求 ResponseEntity response = restTemplate.exchange( pushMessageUrl, @@ -125,10 +126,22 @@ public class UniCloudPushServiceImpl implements UniCloudPushService { private HttpHeaders buildHeaders() { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); - headers.add("Cookie", "aliyungf_tc=3a871d6048f74707aa0ac71c13f654c4d0fba0471c40625f4c120b6aca248dcf; acw_tc=ac11000117529234975193385ec4f96c1ae4ef16d52f0cde7fce5a0a95eb92"); // 新增:应用标识 - headers.add("Host", "fc-mp-39e3d50a-2d2b-415a-9664-2e48974bcfbd.next.bspapp.com"); // 新增:请求唯一标识 +// headers.add("Cookie", "aliyungf_tc=3a871d6048f74707aa0ac71c13f654c4d0fba0471c40625f4c120b6aca248dcf; acw_tc=ac11000117529234975193385ec4f96c1ae4ef16d52f0cde7fce5a0a95eb92"); // 新增:应用标识 +// headers.add("Host", "fc-mp-39e3d50a-2d2b-415a-9664-2e48974bcfbd.next.bspapp.com"); // 新增:请求唯一标识 +// headers.add("Authorization", "Basic ZWxhc3RpYzpQQjI1NkZFTjBPaDY0cFZV"); +// headers.add("User-Agent", "Apifox/1.0.0 (https://apifox.com)"); return headers; + +// HttpHeaders headers = new HttpHeaders(); +// headers.setContentType(MediaType.APPLICATION_JSON); // Content-Type: application/json +// headers.add("Accept", "*/*"); +// headers.add("Host", "fc-mp-39e3d50a-2d2b-415a-9664-2e48974bcfbd.next.bspapp.com"); +// headers.add("Connection", "keep-alive"); +// headers.add("Authorization", "Basic ZWxhc3TiYzpQQjI1NkZFTjBPaDY0cFZV"); +// headers.add("User-Agent", "Apifox/1.0.0 (https://apifox.com)"); +// headers.add("Cookie", "aliyungf_tc=3a871d6048f74707aa0ac71c13f654c4d0fba0471c40625f4c120b6aca248dcf; acw_tc=ac11000117529360358682662e17bea869dfc6fb823bd2d372dbf9eca1c342"); +// return headers; } /** @@ -153,13 +166,14 @@ public class UniCloudPushServiceImpl implements UniCloudPushService { } // 设置平台和有效期 - JSONArray platforms = new JSONArray(); - platforms.add("web"); - platforms.add("app-ios"); - platforms.add("app-android"); - platforms.add("mp-weixin"); - request.put("platform", platforms) - .put("settings", new JSONObject().set("ttl", DEFAULT_TTL)); +// JSONArray platforms = new JSONArray(); +// platforms.add("web"); +// platforms.add("app-ios"); +// platforms.add("app-android"); +// platforms.add("mp-weixin"); +// request.put("platform", platforms) + + request.put("settings", new JSONObject().set("ttl", DEFAULT_TTL)); log.debug("[推送服务] 请求参数: {}", request); diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/message/service/impl/PushMessageServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/message/service/impl/PushMessageServiceImpl.java index 7fe28e85..973138da 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/message/service/impl/PushMessageServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/message/service/impl/PushMessageServiceImpl.java @@ -64,7 +64,7 @@ public class PushMessageServiceImpl implements PushMessageService { * - Boolean: 发送是否成功 * - String: 成功为"", 失败为错误信息 */ - @Async("asyncExecutor") +// @Async("asyncExecutor") @Override public CompletableFuture> sendMessage(List pushClientId, String title, String content, JSONObject payload) { // 参数校验