Merge remote-tracking branch 'origin/master'
| | |
| | | public static final String EXTERNAL_CONTACT_LIST = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/list"; |
| | | |
| | | /** |
| | | * 创建获客链接url |
| | | */ |
| | | public static final String CUSTOMER_ACQUISITION_CREATE_LINK = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_acquisition/create_link?access_token="; |
| | | |
| | | /** |
| | | * 获取获客客户列表 |
| | | */ |
| | | public static final String CUSTOMER_ACQUISITION_CUSTOMER_LIST = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_acquisition/customer?access_token="; |
| | | |
| | | /** |
| | | * 生成企业成员联系我的id-单人 |
| | | * |
| | | * @param accessToken 企业的accessToken |
| | |
| | | |
| | | return HttpURLUtil(CREATE_CONTACT_ID_URL+accessToken,data.toString()); |
| | | } |
| | | |
| | | /** |
| | | * 创建获客链接 |
| | | * |
| | | * @param accessToken 企业的accessToken |
| | | * @param linkName 链接名称 |
| | | * @param userList 员工用户userId |
| | | * @return 返回 |
| | | */ |
| | | public static JSONObject createCustomerAcquisitionLink(String accessToken, String linkName, JSONArray userList) { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("link_name", linkName); |
| | | JSONObject subData = new JSONObject(); |
| | | subData.accumulate("user_list", userList); |
| | | data.put("range", subData); |
| | | /** 返回数据 |
| | | * { |
| | | * "link_id":"LINK_ID", |
| | | * "link_name":"获客链接1号", |
| | | * "range": |
| | | * { |
| | | * "user_list":["zhangsan","lisi"], |
| | | * "department_list":[2,3] |
| | | * }, |
| | | * "skip_verify":true |
| | | * } |
| | | */ |
| | | return HttpURLUtil(CUSTOMER_ACQUISITION_CREATE_LINK + accessToken, data.toString()); |
| | | } |
| | | |
| | | /** |
| | | * 获取获客客户列表 |
| | | * |
| | | * @param accessToken 企业的accessToken |
| | | * @param linkId 链接id |
| | | * @return 返回 |
| | | */ |
| | | public static JSONObject getCustomerAcquisitionCustomerList(String accessToken, String linkId) { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("link_id", linkId); |
| | | /** 返回数据 |
| | | * { |
| | | * "errcode": 0, |
| | | * "errmsg": "ok", |
| | | * "customer_list": |
| | | * [ |
| | | * { |
| | | * "external_userid":"woAJ2GCAAAXtWyujaWJHDDGi0mACAAA", |
| | | * "userid":"zhangsan", |
| | | * "chat_status":0, |
| | | * "state":"CHANNEL_A" |
| | | * } |
| | | * ], |
| | | * "next_cursor":"CURSOR" |
| | | * } |
| | | */ |
| | | return HttpURLUtil(CUSTOMER_ACQUISITION_CUSTOMER_LIST + accessToken, data.toString()); |
| | | } |
| | | } |
| | |
| | | data.put("env_version", env_version); |
| | | return HttpMethodUtil.HttpURLUtilJson("https://api.weixin.qq.com/wxa/generate_urllink", data.toString(), map, null, "POST"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 公众号发送小程序卡片客户消息 |
| | | * @param access_token access_token |
| | | * @param toUser 用户openid |
| | | * @param title 标题 |
| | | * @param appid 小程序appid |
| | | * @param pagepath 跳转页面路径 |
| | | * @param thumb_media_id 缩略图/小程序卡片图片的媒体ID,小程序卡片图片建议大小为520*416 |
| | | * @return |
| | | */ |
| | | public static String sendMpMsg(String access_token, String toUser, String title,String appid,String pagepath,String thumb_media_id) { |
| | | String result = "fail"; |
| | | |
| | | try { |
| | | JSONObject obj = new JSONObject(); |
| | | obj.put("touser", toUser); |
| | | obj.put("msgtype", "miniprogrampage"); |
| | | |
| | | JSONObject pObj = new JSONObject(); |
| | | pObj.put("title", title); |
| | | pObj.put("appid", appid); |
| | | pObj.put("pagepath", pagepath); |
| | | pObj.put("thumb_media_id", thumb_media_id); |
| | | obj.put("miniprogrampage", pObj); |
| | | |
| | | JSONObject rObj = HttpURLUtil(URL_SEND_KF_MSG + access_token, obj.toString()); |
| | | if (rObj != null) { |
| | | if (rObj.optInt("errcode", -1) == 0) { |
| | | result = "suc"; |
| | | } else { |
| | | result = rObj.optString("errmsg"); |
| | | } |
| | | } |
| | | rObj = null; |
| | | obj = null; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | } |