|
|
@@ -1,10 +1,17 @@
|
|
1
|
1
|
package ink.mifi.fe.tools;
|
|
2
|
2
|
|
|
|
3
|
+import java.io.BufferedReader;
|
|
|
4
|
+import java.io.DataOutputStream;
|
|
|
5
|
+import java.io.IOException;
|
|
|
6
|
+import java.io.InputStreamReader;
|
|
|
7
|
+import java.net.URL;
|
|
3
|
8
|
import java.security.MessageDigest;
|
|
4
|
9
|
import java.security.NoSuchAlgorithmException;
|
|
5
|
10
|
import java.util.*;
|
|
6
|
11
|
import java.util.Map.Entry;
|
|
7
|
12
|
|
|
|
13
|
+import com.alibaba.fastjson.JSON;
|
|
|
14
|
+import com.nianzai.util.CodecUtil;
|
|
8
|
15
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
9
|
16
|
import org.apache.commons.logging.Log;
|
|
10
|
17
|
import org.apache.commons.logging.LogFactory;
|
|
|
@@ -15,6 +22,8 @@ import com.nianzai.util.DateTimeUtil;
|
|
15
|
22
|
|
|
16
|
23
|
import cn.hutool.http.HttpUtil;
|
|
17
|
24
|
|
|
|
25
|
+import javax.net.ssl.HttpsURLConnection;
|
|
|
26
|
+
|
|
18
|
27
|
public class CTAPI
|
|
19
|
28
|
{
|
|
20
|
29
|
|
|
|
@@ -22,12 +31,7 @@ public class CTAPI
|
|
22
|
31
|
|
|
23
|
32
|
public static void main(String[] args)
|
|
24
|
33
|
{
|
|
25
|
|
- String token=getToken(80);
|
|
26
|
|
- String content=quicksm(token,"898604431625D1665436",80,"1");
|
|
27
|
|
- System.out.println(content);
|
|
28
|
|
-
|
|
29
|
|
-// String content=zyquicksm("898604F61925C0225986");
|
|
30
|
|
-// System.out.println(content);
|
|
|
34
|
+ bwquicksm("89860441192580181043");
|
|
31
|
35
|
}
|
|
32
|
36
|
|
|
33
|
37
|
public static String getToken(int index)
|
|
|
@@ -432,4 +436,65 @@ public class CTAPI
|
|
432
|
436
|
}
|
|
433
|
437
|
return re;
|
|
434
|
438
|
}
|
|
|
439
|
+ //北纬快速实名
|
|
|
440
|
+ public static String bwquicksm(String iccid)
|
|
|
441
|
+ {
|
|
|
442
|
+ String re="";
|
|
|
443
|
+ String url="https://ntf-oc.hb-vpc-prod.bwae.org/open-api/query/getRealNameUrl";
|
|
|
444
|
+ String timestamp=DateTimeUtil.longtime();
|
|
|
445
|
+ String appid="ju5duzoyvjne8kro";
|
|
|
446
|
+ String secret="buwl34s7zot82j2n";
|
|
|
447
|
+ String sign= CodecUtil.str2md5(appid+secret+timestamp);
|
|
|
448
|
+ Map<String,Object> m=new HashMap<String,Object>();
|
|
|
449
|
+ m.put("cardType", "0");
|
|
|
450
|
+ m.put("cardId", iccid);
|
|
|
451
|
+ String param= JSON.toJSONString(m);;
|
|
|
452
|
+ String content="";
|
|
|
453
|
+ try {
|
|
|
454
|
+ content = getContentByPost(url, param, timestamp, appid, sign);
|
|
|
455
|
+ } catch (IOException e) {
|
|
|
456
|
+ e.printStackTrace();
|
|
|
457
|
+ }
|
|
|
458
|
+ log.info(url+"===>"+content);
|
|
|
459
|
+ JSONObject resJson = JSONObject.parseObject(content);
|
|
|
460
|
+ JSONObject respStatus = JSONObject.parseObject(resJson.getString("respStatus"));
|
|
|
461
|
+ String resCode = respStatus.getString("code");
|
|
|
462
|
+ if(resCode.equals("0000"))
|
|
|
463
|
+ {
|
|
|
464
|
+ JSONObject respBody = JSONObject.parseObject(resJson.getString("respBody"));
|
|
|
465
|
+ re=respBody.getString("realNameUrl");
|
|
|
466
|
+ }
|
|
|
467
|
+ return re;
|
|
|
468
|
+ }
|
|
|
469
|
+ public static String getContentByPost(String urlStr,String param,String timestamp,String appid,String sign) throws IOException
|
|
|
470
|
+ {
|
|
|
471
|
+ URL url = new URL(urlStr);
|
|
|
472
|
+ HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
|
|
|
473
|
+ conn.setRequestProperty("User-Agent","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)");
|
|
|
474
|
+ conn.setDoOutput(true);
|
|
|
475
|
+ conn.setDoInput(true);
|
|
|
476
|
+ conn.setRequestMethod("POST");
|
|
|
477
|
+ conn.setRequestProperty("Content-Type", "application/json");
|
|
|
478
|
+ conn.setRequestProperty("timestamp", timestamp);
|
|
|
479
|
+ conn.setRequestProperty("appid", appid);
|
|
|
480
|
+ conn.setRequestProperty("sign", sign);
|
|
|
481
|
+
|
|
|
482
|
+ conn.connect();
|
|
|
483
|
+ DataOutputStream out = new DataOutputStream(conn.getOutputStream());
|
|
|
484
|
+ out.write(param.getBytes());
|
|
|
485
|
+ out.flush();
|
|
|
486
|
+ out.close();
|
|
|
487
|
+ BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(),"utf-8"));
|
|
|
488
|
+ StringBuilder tempStr = new StringBuilder();
|
|
|
489
|
+ String fileLine="";
|
|
|
490
|
+ while((fileLine=br.readLine())!=null)
|
|
|
491
|
+ {
|
|
|
492
|
+ tempStr.append(fileLine);
|
|
|
493
|
+ tempStr.append("\r\n");
|
|
|
494
|
+ }
|
|
|
495
|
+ br.close();
|
|
|
496
|
+ conn.disconnect();
|
|
|
497
|
+
|
|
|
498
|
+ return new String(tempStr);
|
|
|
499
|
+ }
|
|
435
|
500
|
}
|