|
@@ -1,5 +1,6 @@
|
|
package com.backendsys.modules.sdk.tencentcloud.ems.controller;
|
|
package com.backendsys.modules.sdk.tencentcloud.ems.controller;
|
|
|
|
|
|
|
|
+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;
|
|
@@ -15,6 +16,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@Tag(name = "腾讯云-邮件回调")
|
|
@Tag(name = "腾讯云-邮件回调")
|
|
@@ -32,26 +35,18 @@ public class TencentEmsController {
|
|
@Anonymous
|
|
@Anonymous
|
|
@Operation(summary = "邮件推送 (测试)")
|
|
@Operation(summary = "邮件推送 (测试)")
|
|
@GetMapping("/api/ems/send")
|
|
@GetMapping("/api/ems/send")
|
|
- public Result send(Object body) {
|
|
|
|
|
|
+ public Result send(String email) {
|
|
|
|
|
|
// 再尝试输出一下:来源地址、URL参数、headers
|
|
// 再尝试输出一下:来源地址、URL参数、headers
|
|
System.out.println("===============================");
|
|
System.out.println("===============================");
|
|
System.out.println("邮件推送 (测试)");
|
|
System.out.println("邮件推送 (测试)");
|
|
- System.out.println("body参数: " + body);
|
|
|
|
- System.out.println("===============================");
|
|
|
|
// 1. 打印所有请求头
|
|
// 1. 打印所有请求头
|
|
- HttpServletRequest request = httpRequestUtil.getRequest();
|
|
|
|
- request.getHeaderNames()
|
|
|
|
- .asIterator()
|
|
|
|
- .forEachRemaining(name -> {
|
|
|
|
- String value = request.getHeader(name);
|
|
|
|
- System.out.println(name + " : " + value);
|
|
|
|
- });
|
|
|
|
|
|
+ JSONObject headers = httpRequestUtil.getHeaders();
|
|
|
|
+ System.out.println("headers 参数: " + headers);
|
|
System.out.println("===============================");
|
|
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, "405348097@qq.com"));
|
|
|
|
|
|
+ return Result.success().put("data", tencentEmsService.send("邮件测试", 140698L, templateParamSet, email));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -68,15 +63,20 @@ public class TencentEmsController {
|
|
System.out.println("邮件推送通知事件回调");
|
|
System.out.println("邮件推送通知事件回调");
|
|
System.out.println("body 参数: " + body);
|
|
System.out.println("body 参数: " + body);
|
|
System.out.println("===============================");
|
|
System.out.println("===============================");
|
|
- System.out.println("headers 参数: ");
|
|
|
|
|
|
+
|
|
HttpServletRequest request = httpRequestUtil.getRequest();
|
|
HttpServletRequest request = httpRequestUtil.getRequest();
|
|
// 1. 打印所有请求头
|
|
// 1. 打印所有请求头
|
|
- request.getHeaderNames()
|
|
|
|
- .asIterator()
|
|
|
|
- .forEachRemaining(name -> {
|
|
|
|
- String value = request.getHeader(name);
|
|
|
|
- System.out.println(name + " : " + value);
|
|
|
|
- });
|
|
|
|
|
|
+ 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("===============================");
|
|
System.out.println("===============================");
|
|
|
|
|
|
// tencentEmsCallbackService.receiveCallback(emsCallbackList);
|
|
// tencentEmsCallbackService.receiveCallback(emsCallbackList);
|