fire_point/src/main/java/com/xkrs/straw/utilsnew/WeiXinMessageUtils.java

33 lines
986 B
Java
Raw Normal View History

2023-03-08 11:59:44 +08:00
package com.xkrs.straw.utilsnew;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.HashMap;
import java.util.Map;
2023-03-08 11:21:59 +08:00
import static com.xkrs.straw.utilsold.WDHttpClientUtils.sendHttpPost;
2023-03-08 11:59:44 +08:00
public class WeiXinMessageUtils {
/**
* 通过udp通信调用发送微信消息服务发送微信消息
*
* @param wxid 微信id
* @param text 信息
* @param type 类型0文本1文档
* @throws Exception
*/
public static void sendMsg(String wxid, String text, Integer type) throws Exception {
String url = "http://118.24.27.47:10721/winxin_api/msg";
Map<String, Object> map = new HashMap<>();
map.put("wxid", wxid);
map.put("text", text);
map.put("type", type);
sendHttpPost(url, new ObjectMapper().writeValueAsString(map));
}
public static void main(String[] args) throws Exception {
sendMsg("18447024917@chatroom", "微信发消息测试", 0);
}
}