|
1
|
-<!DOCTYPE html>
|
|
|
|
2
|
-<html lang="en">
|
|
|
|
3
|
-<head>
|
|
|
|
4
|
- <meta charset="UTF-8">
|
|
|
|
5
|
- <title>Title</title>
|
|
|
|
6
|
-</head>
|
|
|
|
7
|
-<body>
|
|
|
|
8
|
-
|
|
|
|
9
|
-<style>
|
|
|
|
10
|
- pre{
|
|
|
|
11
|
- background-color: #f0f0f0;
|
|
|
|
12
|
- }
|
|
|
|
13
|
-</style>
|
|
|
|
14
|
-<h3><div style="text-align:center">深圳国际贸易单一窗口业务对接创贸集团技术方案</div></h3>
|
|
|
|
15
|
-<p>> 一. 签名</p>
|
|
|
|
16
|
-<ol>
|
|
|
|
17
|
- <li>签名采用rsa 2048</li>
|
|
|
|
18
|
-</ol>
|
|
|
|
19
|
-
|
|
|
|
20
|
-<pre>
|
|
|
|
21
|
- <code class="language-injectablephp">
|
|
|
|
22
|
- /**
|
|
|
|
23
|
- * rsa 签名
|
|
|
|
24
|
- * @param array $data 请求的参数
|
|
|
|
25
|
- * @return string 签名字符串
|
|
|
|
26
|
- */
|
|
|
|
27
|
- function rsaEnSign(array $data){
|
|
|
|
28
|
- ksort($data);
|
|
|
|
29
|
- $dataString = http_build_query($data);
|
|
|
|
30
|
- if (openssl_sign($dataString, $signature, 'private_key', OPENSSL_ALGO_SHA1)) {
|
|
|
|
31
|
- return base64_encode($signature);
|
|
|
|
32
|
- } else {
|
|
|
|
33
|
- return '';
|
|
|
|
34
|
- }
|
|
|
|
35
|
- }
|
|
|
|
36
|
- </code>
|
|
|
|
37
|
-</pre>
|
|
|
|
38
|
-
|
|
|
|
39
|
-<ol start="2">
|
|
|
|
40
|
- <li>验证数据</li>
|
|
|
|
41
|
-</ol>
|
|
|
|
42
|
-
|
|
|
|
43
|
-<pre>
|
|
|
|
44
|
- <code class="language-injectablephp">
|
|
|
|
45
|
- /**
|
|
|
|
46
|
- * 验证数据来源
|
|
|
|
47
|
- * @param array $data
|
|
|
|
48
|
- * @param string $sign
|
|
|
|
49
|
- */
|
|
|
|
50
|
- function rsaVerify(array $data, string $sign){
|
|
|
|
51
|
- ksort($data);
|
|
|
|
52
|
- $dataString = http_build_query($data);
|
|
|
|
53
|
- $verified = openssl_verify($dataString, base64_decode($sign), 'public_key', OPENSSL_ALGO_SHA1);
|
|
|
|
54
|
- if ($verified === 1) {
|
|
|
|
55
|
- // 验证成功
|
|
|
|
56
|
- } elseif ($verified === 0) {
|
|
|
|
57
|
- // 验证失败
|
|
|
|
58
|
- } else {
|
|
|
|
59
|
- // 签名错误
|
|
|
|
60
|
- $errorMsg = openssl_error_string();
|
|
|
|
61
|
- }
|
|
|
|
62
|
- }
|
|
|
|
63
|
- </code>
|
|
|
|
64
|
-</pre>
|
|
|
|
65
|
-<p>> 二. 接口</p>
|
|
|
|
66
|
-<ol>
|
|
|
|
67
|
- <li><p>用户授权</p>
|
|
|
|
68
|
- <ul>
|
|
|
|
69
|
- <li>请求地址 /api/southern/auth</li>
|
|
|
|
70
|
-
|
|
|
|
71
|
- <li>请求类型 POST</li>
|
|
|
|
72
|
-
|
|
|
|
73
|
- <li>签名规则 rsa</li>
|
|
|
|
74
|
-
|
|
|
|
75
|
- <li>请求示例</li>
|
|
|
|
76
|
-
|
|
|
|
77
|
- </ul>
|
|
|
|
78
|
-
|
|
|
|
79
|
- <pre>
|
|
|
|
80
|
- <code class="language-injectablephp">
|
|
|
|
81
|
- $postData = [
|
|
|
|
82
|
- 'payload' => [
|
|
|
|
83
|
- "serviceFlowId" => "本次业务操作流水id",
|
|
|
|
84
|
- "uniCode" => "南方电子口岸给对接方分配的 唯一ID号",
|
|
|
|
85
|
- "mobile" => "手机",
|
|
|
|
86
|
- "userId" => "用户 ID",
|
|
|
|
87
|
- "userName" => "用户名称",
|
|
|
|
88
|
- "entName" => "企业名称",
|
|
|
|
89
|
- "scCode" => "企业统一社会信用代码"
|
|
|
|
90
|
- ],
|
|
|
|
91
|
- 'sign' => '',
|
|
|
|
92
|
- ];
|
|
|
|
93
|
- $postData['sign'] = rsaEnSign($postData['payload']);
|
|
|
|
94
|
- $result = Http::post('url', $postData);
|
|
|
|
95
|
- if($result['code']===200){
|
|
|
|
96
|
- // 成功
|
|
|
|
97
|
- }else{
|
|
|
|
98
|
- // 失败
|
|
|
|
99
|
- }
|
|
|
|
100
|
- </code>
|
|
|
|
101
|
- </pre>
|
|
|
|
102
|
-
|
|
|
|
103
|
- <ul>
|
|
|
|
104
|
- <li>返回结果 成功</li>
|
|
|
|
105
|
- </ul>
|
|
|
|
106
|
-
|
|
|
|
107
|
- <pre>
|
|
|
|
108
|
- <code class="language-json">
|
|
|
|
109
|
- {
|
|
|
|
110
|
- "code": 200,
|
|
|
|
111
|
- "message": "SUCCESS",
|
|
|
|
112
|
- "data": {
|
|
|
|
113
|
- "url": [
|
|
|
|
114
|
- {
|
|
|
|
115
|
- "name": "ai搜索",
|
|
|
|
116
|
- "url": "https://fob.ai.cc/ai_search?iframe_sign=xxxxx"
|
|
|
|
117
|
- },
|
|
|
|
118
|
- {
|
|
|
|
119
|
- "name": "企业洞察",
|
|
|
|
120
|
- "url": "https://fob.ai.cc/ai_company_search?iframe_sign=xxxxx"
|
|
|
|
121
|
- },
|
|
|
|
122
|
- ...
|
|
|
|
123
|
- ],
|
|
|
|
124
|
- "uniCode": "1",
|
|
|
|
125
|
- "firstLogin": true //是否第一次登录
|
|
|
|
126
|
- },
|
|
|
|
127
|
- "success": true
|
|
|
|
128
|
- }
|
|
|
|
129
|
- </code></pre>
|
|
|
|
130
|
-
|
|
|
|
131
|
- <ul>
|
|
|
|
132
|
- <li>失败信息</li>
|
|
|
|
133
|
-
|
|
|
|
134
|
- </ul>
|
|
|
|
135
|
-
|
|
|
|
136
|
- <pre>
|
|
|
|
137
|
- <code class="language-json">
|
|
|
|
138
|
- {
|
|
|
|
139
|
- "code": 500,
|
|
|
|
140
|
- "message": "签名验证失败",
|
|
|
|
141
|
- "success": false
|
|
|
|
142
|
- }
|
|
|
|
143
|
- </code>
|
|
|
|
144
|
- </pre>
|
|
|
|
145
|
-
|
|
|
|
146
|
- </li>
|
|
|
|
147
|
-
|
|
|
|
148
|
- <li><p>意向登记</p>
|
|
|
|
149
|
- <ul>
|
|
|
|
150
|
- <li>请求地址 /api/southern/intention</li>
|
|
|
|
151
|
-
|
|
|
|
152
|
- <li>请求类型 POST</li>
|
|
|
|
153
|
-
|
|
|
|
154
|
- <li>签名规则 rsa</li>
|
|
|
|
155
|
-
|
|
|
|
156
|
- <li>请求示例</li>
|
|
|
|
157
|
-
|
|
|
|
158
|
- </ul>
|
|
|
|
159
|
-
|
|
|
|
160
|
- <pre><code class="language-injectablephp">
|
|
|
|
161
|
- $postData = [
|
|
|
|
162
|
- "guid"=>"166970C4-AF54-470A-87E4-D598463783A2",
|
|
|
|
163
|
- "busiCode"=> "CMJT04",
|
|
|
|
164
|
- "senderId"=> "XXXXXX",
|
|
|
|
165
|
- "version"=> "1.0",
|
|
|
|
166
|
- 'payload' => [
|
|
|
|
167
|
- "serviceFlowId"=> "F2310011420000001",
|
|
|
|
168
|
- "orgName"=>"xxx",
|
|
|
|
169
|
- "orgCode"=>"xxx",
|
|
|
|
170
|
- "userId"=>"xxx",
|
|
|
|
171
|
- "userName"=>"xxxxx 有限公司",
|
|
|
|
172
|
- "contactAddress"=> "xxxxxxxxxxxxxxxxxx",
|
|
|
|
173
|
- "contactMan"=> "xxx",
|
|
|
|
174
|
- "contactTel"=> "xxx",
|
|
|
|
175
|
- "email"=> "xxx",
|
|
|
|
176
|
- "position"=> "xxx",
|
|
|
|
177
|
- "notes"=> "xxx"
|
|
|
|
178
|
- ],
|
|
|
|
179
|
- 'sign' => '',
|
|
|
|
180
|
- ];
|
|
|
|
181
|
- $postData['sign'] = rsaEnSign($postData['payload']);
|
|
|
|
182
|
- $result = Http::post('url', $postData);
|
|
|
|
183
|
- if($result['code']===200){
|
|
|
|
184
|
- // 成功
|
|
|
|
185
|
- }else{
|
|
|
|
186
|
- // 失败
|
|
|
|
187
|
- }
|
|
|
|
188
|
- </code></pre>
|
|
|
|
189
|
-
|
|
|
|
190
|
- <ul>
|
|
|
|
191
|
- <li>返回结果 成功</li>
|
|
|
|
192
|
-
|
|
|
|
193
|
- </ul>
|
|
|
|
194
|
-
|
|
|
|
195
|
- <pre>
|
|
|
|
196
|
- <code class="language-json">
|
|
|
|
197
|
- {
|
|
|
|
198
|
- "code": 200,
|
|
|
|
199
|
- "message": "SUCCESS",
|
|
|
|
200
|
- "data": {
|
|
|
|
201
|
- "serviceFlowId": "F2310011420000001",
|
|
|
|
202
|
- "status": "11",
|
|
|
|
203
|
- "statusTime": "20230818081331",
|
|
|
|
204
|
- "statusDetail": ""
|
|
|
|
205
|
- },
|
|
|
|
206
|
- "success": true
|
|
|
|
207
|
- }
|
|
|
|
208
|
- </code>
|
|
|
|
209
|
- </pre>
|
|
|
|
210
|
-
|
|
|
|
211
|
- <ul>
|
|
|
|
212
|
- <li>失败信息</li>
|
|
|
|
213
|
- </ul>
|
|
|
|
214
|
-
|
|
|
|
215
|
- <pre><code class="language-json">
|
|
|
|
216
|
- {
|
|
|
|
217
|
- "code": 500,
|
|
|
|
218
|
- "message": "签名验证失败",
|
|
|
|
219
|
- "success": false
|
|
|
|
220
|
- }</code></pre>
|
|
|
|
221
|
-
|
|
|
|
222
|
- </li>
|
|
|
|
223
|
-
|
|
|
|
224
|
-</ol>
|
|
|
|
225
|
-
|
|
|
|
226
|
-</body>
|
|
|
|
227
|
-</html> |
|
|