| 
					
				 | 
			
			
				@@ -1,5 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.ym.mec.util.http; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.compress.ZipUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.beanutils.ConvertUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -39,15 +40,24 @@ public class HttpUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public static String getSortUrl(String url){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			Map<String,Object> paramMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			paramMap.put("format","json"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			paramMap.put("url",URLDecoder.decode(url,"UTF-8")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			paramMap.put("key","5dc941c5d3c3816ac84898d7@3d0e03b46a30f4fea51f038e5cd411c5"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			String s = get("http://mrw.so/api.htm", paramMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			String shortUrl=JSONObject.parseObject(s).getString("url"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if(StringUtils.isNotBlank(shortUrl)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			jsonObject.put("LongUrl",url); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			jsonObject.put("TermOfValidity","long-term"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			jsonArray.add(jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Map<String,String> HeadMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			HeadMap.put("Dwz-Token","0a9d3b34eae990d4355653d2ba6c8974"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			HeadMap.put("Content-Type","application/json; charset=UTF-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			HeadMap.put("Content-Language","zh"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			String s = postForHttps("https://dwz.cn/api/v3/short-urls", jsonArray.toJSONString(),HeadMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			JSONObject result = JSONObject.parseObject(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			String code=result.getString("Code"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(code.equals("0")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				String shortUrl = JSONArray.parseArray(result.getString("ShortUrls")).getJSONObject(0).getString("ShortUrl"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				return shortUrl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				String errorMsg = JSONArray.parseArray(result.getString("ShortUrls")).getJSONObject(0).getString("ErrMsg"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				System.out.println("短网址生成失败:" + errorMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				return url; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}catch (Exception e){ 
			 |