| | |
| | | actionCard.setTitle("异常消息"); |
| | | actionCard.setBtnOrientation("0"); |
| | | actionCard.setText(StrUtil.format(text, title, msg)); |
| | | actionCard.setSingleURL("http://123.60.45.251/common/getExceptionMsg?id=" + id); |
| | | actionCard.setSingleURL("http://api.topclouds.cc/common/getExceptionMsg?id=" + id); |
| | | actionCard.setSingleTitle("查询详情"); |
| | | |
| | | request.setActionCard(actionCard); |
| | |
| | | } |
| | | } |
| | | |
| | | public static void sendOrderMsg() { |
| | | ApplicationProperties properties = SpringContextHolder.getBean(ApplicationProperties.class); |
| | | try { |
| | | DingTalkClient client = initClient(URL, SECRET); |
| | | OapiRobotSendRequest request = new OapiRobotSendRequest(); |
| | | request.setMsgtype("actionCard"); |
| | | OapiRobotSendRequest.Actioncard actionCard = new OapiRobotSendRequest.Actioncard(); |
| | | actionCard.setTitle(properties.getProject() + "--" + "老板开门啊"); |
| | | actionCard.setBtnOrientation("1"); |
| | | actionCard.setText(properties.getProject() + "--" + "老板关门不好吧"); |
| | | List<OapiRobotSendRequest.Btns> btns = new ArrayList<>(); |
| | | OapiRobotSendRequest.Btns btn1 = new OapiRobotSendRequest.Btns(); |
| | | btn1.setTitle("查看详情"); |
| | | btn1.setActionURL("http://baidu.com"); |
| | | btns.add(btn1); |
| | | actionCard.setBtns(btns); |
| | | |
| | | request.setActionCard(actionCard); |
| | | client.execute(request); |
| | | } catch (Exception e) { |
| | | log.error("#dingtalk send error#", e); |
| | | } |
| | | } |
| | | |
| | | |
| | | private static String generateSign(Long timestamp, String secret) throws Exception { |
| | | String stringToToken = timestamp + "\n" + secret; |