huanghongfa
2021-04-23 ec382a737f59877abe9fce022a9124a7897e5dd5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.panzhihua.common.utlis;
 
import com.alibaba.fastjson.JSON;
 
import java.util.HashMap;
import java.util.Map;
 
public class WxUtil {
 
    //客服消息推送地址
    public final static String kf_url = "https://api.weixin.qq.com/cgi-bin/message/custom/send";
 
    public static String sendKfLinkMessage(String openid,String url,String thumbUrl,String access_token)throws Exception{
        Map<String,Object> map_content = new HashMap<>();
        map_content.put("title","社区福利一分购");
        map_content.put("description","点击参与社区一分钱抢购活动");
        map_content.put("url",url);//跳转地址
        map_content.put("thumb_url",thumbUrl);//图片地址
        Map<String,Object> map = new HashMap<>();
        map.put("touser",openid);
        map.put("msgtype","link");
        map.put("link",map_content);
        String content = JSON.toJSONString(map);
        return HttpClientUtil.httpPost(kf_url+"?access_token="+access_token,content);
    }
}