| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.apache.commons.fileupload.FileItem; |
| | | import org.apache.commons.fileupload.FileItemFactory; |
| | | import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
| | | import org.apache.http.entity.ContentType; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile; |
| | | |
| | | import java.io.*; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | String content = JSON.toJSONString(map); |
| | | return HttpClientUtil.httpPost(kf_url+"?access_token="+access_token,content); |
| | | } |
| | | |
| | | public static String sendKfImagesMessage(String openid,String access_token,String mediaId)throws Exception{ |
| | | Map<String,Object> map_content = new HashMap<>(); |
| | | map_content.put("media_id",mediaId); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("touser",openid); |
| | | map.put("msgtype","image"); |
| | | map.put("image",map_content); |
| | | String content = JSON.toJSONString(map); |
| | | return HttpClientUtil.httpPost(kf_url+"?access_token="+access_token,content); |
| | | } |
| | | |
| | | } |