|
@@ -4,6 +4,8 @@ import cn.hutool.json.JSONObject;
|
|
import com.backendsys.modules.common.config.security.annotations.Anonymous;
|
|
import com.backendsys.modules.common.config.security.annotations.Anonymous;
|
|
import com.backendsys.modules.common.config.security.utils.HttpRequestUtil;
|
|
import com.backendsys.modules.common.config.security.utils.HttpRequestUtil;
|
|
import com.backendsys.modules.common.utils.Result;
|
|
import com.backendsys.modules.common.utils.Result;
|
|
|
|
+import com.backendsys.modules.sdk.tencentcloud.ems.entity.TencentEmsCallback;
|
|
|
|
+import com.backendsys.modules.sdk.tencentcloud.ems.entity.TencentEmsCallbackParams;
|
|
import com.backendsys.modules.sdk.tencentcloud.ems.service.TencentEmsService;
|
|
import com.backendsys.modules.sdk.tencentcloud.ems.service.TencentEmsService;
|
|
import com.backendsys.modules.sdk.tencentcloud.ems.service.TencentEmsCallbackService;
|
|
import com.backendsys.modules.sdk.tencentcloud.ems.service.TencentEmsCallbackService;
|
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
|
@@ -23,28 +25,15 @@ import java.util.Map;
|
|
@Tag(name = "腾讯云-邮件回调")
|
|
@Tag(name = "腾讯云-邮件回调")
|
|
public class TencentEmsController {
|
|
public class TencentEmsController {
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private HttpRequestUtil httpRequestUtil;
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private TencentEmsService tencentEmsService;
|
|
private TencentEmsService tencentEmsService;
|
|
@Autowired
|
|
@Autowired
|
|
private TencentEmsCallbackService tencentEmsCallbackService;
|
|
private TencentEmsCallbackService tencentEmsCallbackService;
|
|
|
|
|
|
-
|
|
|
|
@Anonymous
|
|
@Anonymous
|
|
@Operation(summary = "邮件推送 (测试)")
|
|
@Operation(summary = "邮件推送 (测试)")
|
|
@GetMapping("/api/ems/send")
|
|
@GetMapping("/api/ems/send")
|
|
public Result send(String email) {
|
|
public Result send(String email) {
|
|
-
|
|
|
|
- // 再尝试输出一下:来源地址、URL参数、headers
|
|
|
|
- System.out.println("===============================");
|
|
|
|
- System.out.println("邮件推送 (测试)");
|
|
|
|
- // 1. 打印所有请求头
|
|
|
|
- JSONObject headers = httpRequestUtil.getHeaders();
|
|
|
|
- System.out.println("headers 参数: " + headers);
|
|
|
|
- System.out.println("===============================");
|
|
|
|
-
|
|
|
|
String templateParamSet = "{ \"code\": \"123456\", \"minute\": \"5\" }";
|
|
String templateParamSet = "{ \"code\": \"123456\", \"minute\": \"5\" }";
|
|
return Result.success().put("data", tencentEmsService.send("邮件测试", 140698L, templateParamSet, email));
|
|
return Result.success().put("data", tencentEmsService.send("邮件测试", 140698L, templateParamSet, email));
|
|
}
|
|
}
|
|
@@ -56,30 +45,14 @@ public class TencentEmsController {
|
|
@Anonymous
|
|
@Anonymous
|
|
@Operation(summary = "邮件推送通知事件回调")
|
|
@Operation(summary = "邮件推送通知事件回调")
|
|
@PostMapping("/api/ems/callback")
|
|
@PostMapping("/api/ems/callback")
|
|
- //public Result receiveCallback(@RequestBody List<TencentEmsCallbackNew> emsCallbackList) {
|
|
|
|
- public Result receiveCallback(@RequestBody Object body) {
|
|
|
|
|
|
+ public Result receiveCallback(@RequestBody TencentEmsCallbackParams tencentEmsCallbackParams) {
|
|
|
|
|
|
System.out.println("===============================");
|
|
System.out.println("===============================");
|
|
System.out.println("邮件推送通知事件回调");
|
|
System.out.println("邮件推送通知事件回调");
|
|
- System.out.println("body 参数: " + body);
|
|
|
|
- System.out.println("===============================");
|
|
|
|
-
|
|
|
|
- HttpServletRequest request = httpRequestUtil.getRequest();
|
|
|
|
- // 1. 打印所有请求头
|
|
|
|
- JSONObject headers = httpRequestUtil.getHeaders();
|
|
|
|
- System.out.println("headers 参数: " + headers);
|
|
|
|
- System.out.println("===============================");
|
|
|
|
-
|
|
|
|
- System.out.println("url params 参数: ");
|
|
|
|
- // 1. 打印所有 URL 参数
|
|
|
|
- Map<String, String[]> params = request.getParameterMap();
|
|
|
|
- params.forEach((name, values) -> {
|
|
|
|
- // 同一个参数名可能有多个值
|
|
|
|
- System.out.println(name + " = " + String.join(",", values));
|
|
|
|
- });
|
|
|
|
|
|
+ System.out.println("body 参数: " + tencentEmsCallbackParams);
|
|
System.out.println("===============================");
|
|
System.out.println("===============================");
|
|
|
|
|
|
- // tencentEmsCallbackService.receiveCallback(emsCallbackList);
|
|
|
|
|
|
+ tencentEmsCallbackService.receiveCallback(tencentEmsCallbackParams);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
|
|
|