33 lines
986 B
Java
33 lines
986 B
Java
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);
|
||
}
|
||
}
|