fire_point/src/main/java/com/xkrs/straw/utilsnew/WeiXinMessageUtils.java
2023-03-08 11:59:44 +08:00

33 lines
986 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.xkrs.straw.utilsnew;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.HashMap;
import java.util.Map;
import static com.xkrs.straw.utilsold.WDHttpClientUtils.sendHttpPost;
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);
}
}