| | |
| | | * @throws Exception |
| | | */ |
| | | public static String informWebHook(String webHook, String content) { |
| | | return informWebHook(webHook, content,"text"); |
| | | } |
| | | |
| | | /** |
| | | * 推送群消息 |
| | | * |
| | | * @param webHook 企业微信机器人地址 |
| | | * @param content 数据 |
| | | * @param msgType 消息类型 |
| | | * @throws Exception |
| | | */ |
| | | public static String informWebHook(String webHook, String content,String msgType) { |
| | | JSONObject jsonObject = new JSONObject() |
| | | .accumulate("msgtype", "text") |
| | | .accumulate("text", new JSONObject() |
| | | .accumulate("msgtype", msgType) |
| | | .accumulate(msgType, new JSONObject() |
| | | .accumulate("content", content)); |
| | | return HttpRequest.post(webHook).header("Content-Type", "application/json").body(jsonObject.toString()).execute().body(); |
| | | } |