package Practice_test;

import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Random;

import com.offcn.api.nwn.md5.LMFMD5;
import com.offcn.process.NWN;

import sun.net.www.http.HttpClient;

public class test1 {

	
//	public static void main(String[] args) {
//
//		String a1=null;
//		String a2="";
//		
//		if("0".equals(a1)){
//			System.out.println(1);
//		}else{
//			System.out.println(2);
//		}
//	}
	
	public static void main(String[] args) {
		String parameter = "\\\"package_id\\\":4027482,\\\"pack_name\\\":\\\"飞飞班级\\\",\\\"for_year\\\":2019,\\\"intro\\\":\\\"飞飞班级11111\\\",\\\"remark\\\":\\\"飞飞班级22222\\\",\\\"cover\\\":\\\"s.eoffcn.com/tss/cover/201906/71561018287000.png\\\",\\\"appid\\\":\\\"jiaowu\\\",\\\"timestamp\\\":\\\"1561338910\\\"";
		
		StringBuffer stringBuffer = new StringBuffer();
		
		String arr[] = parameter.split(",");
		Arrays.sort(arr);
		for (int i = 0; i < arr.length; i++) {
			
			arr[i] = arr[i].substring(arr[i].indexOf(":")+1);
			stringBuffer.append(arr[i]);
		}
		stringBuffer.toString().replaceAll("[^0-9a-zA-Z\u4e00-\u9fa5.，,。？“”]+", "");
		System.out.println(stringBuffer);
		
		String str = stringBuffer.toString();
  		
  		str = str + "bf2h3%^j?ljkj3706kji88697"; //教务的加密，规则固定需要加 
  		
//      System.out.println("str===" + str);
  		NWN.suprise_str = str;
  		
  		String res = new LMFMD5().MD5(str);
  	    System.out.println("res===" +res);
	}
	
//	public static void main(String[] args) {
//		StringBuffer sortstring=new StringBuffer();
//	 	//方法1
//	    	
//	    String parameter = "appid=jiaowu&template_id=[473,475]&timestamp="+NWN.timestamp;
//
//	    String arr[]=parameter.split("&");
//		Arrays.sort(arr);
//		for (int i = 0; i < arr.length; i++) {
//			
//			//System.out.println(arr[i].substring(arr[i].indexOf("=")+1));
//	  		arr[i]=arr[i].substring(arr[i].indexOf("=")+1);
//	  		
//	  		sortstring.append(arr[i]);
//	  		//System.out.println(sortstring);
//				
//			}
//		sortstring.toString();
//			System.out.println("sortstring====" + sortstring);
//		String str = sortstring.toString();
//		
//		  		
//		str = str + "bf2h3%^j?ljkj3706kji88697"; //教务的加密，规则固定需要加 
//		//	System.out.println("str===" + str);
//		NWN.suprise_str = str;
//		//String str1 = "appid=tiku&avatar=http://thirdqq.qlogo.cn/qqapp/1106773681/5B50BBF83A00DC46B16B708F720A5D46/100&device_id=861837034477409&login_type=qq&nickname=hobo&open_id=1&platform=Android&version=1"+"&123456"; 
//		String res = new LMFMD5().MD5(str);
//		System.out.println("res===" +res);
//	}
//	
//
}

//SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmmss");
//String dateStr = dateformat.format(System.currentTimeMillis());
//System.out.println(dateStr);
//System.out.println(new Random().nextInt(90000000)+ 10000000);
