1
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
package cn.van.business.util;
|
package cn.van.business.util;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -22,15 +25,15 @@ public class WxtsUtil {
|
|||||||
|
|
||||||
public void sendNotify(String content) {
|
public void sendNotify(String content) {
|
||||||
try {
|
try {
|
||||||
String url = SERVER_URL + "/wx/send/jd?vanToken=" + TOKEN + "&source=XZJ_UBUNTU";
|
String url = SERVER_URL + "/wx/send/jd";
|
||||||
HashMap<String, Object> paramMap = new HashMap<>();
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
paramMap.put("title", "JD机器人微信推送");
|
paramMap.put("title", "JD机器人微信推送");
|
||||||
content = content.replaceAll("\\n", "<br>");
|
content = content.replaceAll("\\n", "<br>");
|
||||||
String common = "192.168.8.88 (微信机器人), 信息 : ";
|
String common = "192.168.8.88 (微信机器人), 信息 : ";
|
||||||
content = common + content + "<br><br>";
|
content = common + content + "<br><br>";
|
||||||
paramMap.put("text", content);
|
paramMap.put("text", content);
|
||||||
String post = HttpUtil.post(url, paramMap);
|
HttpResponse execute = HttpRequest.post(url).header("vanToken", TOKEN).header("source", "XZJ_UBUNTU").body(JSON.toJSONString(paramMap)).execute();
|
||||||
logger.info("企业微信推送结果:{}", post);
|
logger.info("企业微信推送结果:{}", execute);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("企业微信推送失败:{}", e.getMessage());
|
logger.error("企业微信推送失败:{}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user