短信服务集成
This commit is contained in:
@@ -3,7 +3,9 @@ package com.njcn.access.utils;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.njcn.access.pojo.dto.NoticeUserDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -21,12 +23,17 @@ import java.nio.charset.StandardCharsets;
|
||||
@Component
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class SendMessageUtil {
|
||||
|
||||
@Value("${app.sendUrl:https://fc-mp-ff7b310f-94c9-4468-8260-109111c0a6b2.next.bspapp.com/push}")
|
||||
private String appSendUrl;
|
||||
|
||||
//App客户端消息推送
|
||||
public void sendEventToUser(NoticeUserDto noticeUserDto) {
|
||||
try {
|
||||
// 创建一个URL对象,指定目标HTTPS接口地址
|
||||
URL url = new URL("https://fc-mp-ff7b310f-94c9-4468-8260-109111c0a6b2.next.bspapp.com/push");
|
||||
URL url = new URL(appSendUrl);
|
||||
// 打开HTTPS连接
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
// 设置请求方法为POST
|
||||
|
||||
Reference in New Issue
Block a user