@RequestMapping("/sendPostToRoot") @ResponseBody public String qwRoot() { //推送消息到企业邮箱的机器人。 JSONObject j=new JSONObject(); j.put("msgtype", "text"); JSONObject j1=new JSONObject(); j1.put("content","本地项目推送信息"); j1.put("mentioned_list","[\"@all\"]"); j.put("text", j1); System.out.println(j.toString()); HttpClientUtil h=new HttpClientUtil(); String s=h.doPost("https://qyapi.weixin.qq.com/", j); return s; }
上述doPost方法再我博客Java分栏的项目下面有源码,