(key, path)
| 149 | |
| 150 | // Get请求构建 |
| 151 | getGetHeader(key, path) { |
| 152 | let currentDate = new Date(); |
| 153 | let formattedDate = this.formatDate(currentDate, 0); |
| 154 | let parts = formattedDate.split(" "); |
| 155 | formattedDate = `${parts[0]}, ${parts[2]} ${parts[1]} ${parts[3]} ${parts[4]} GMT`; |
| 156 | let date = new Date(formattedDate) |
| 157 | let timestamp = date.getTime(); |
| 158 | let uuid = this.generateUUID(); |
| 159 | let signature = this.calculateHmacSha256("GET", "application/json; charset=utf-8", "", "application/x-www-form-urlencoded; charset=utf-8", formattedDate, key, uuid, timestamp, path) |
| 160 | let headers = { |
| 161 | 'date': formattedDate, |
| 162 | 'x-ca-signature': signature, |
| 163 | 'x-ca-nonce': uuid, |
| 164 | 'x-ca-key': key, |
| 165 | 'ca_version': 1, |
| 166 | 'accept': 'application/json; charset=utf-8', |
| 167 | 'usetoken': 1, |
| 168 | 'x-ca-timestamp': timestamp, |
| 169 | 'x-ca-signature-headers': 'x-ca-nonce,x-ca-timestamp,x-ca-key', |
| 170 | 'x-refresh-token': true, |
| 171 | 'content-type': 'application/x-www-form-urlencoded; charset=utf-8', |
| 172 | 'user-agent': 'ALIYUN-ANDROID-UA', |
| 173 | 'token': this.token, |
| 174 | 'deviceSN': this.deviceSN, |
| 175 | 'txCookie': '', |
| 176 | 'appId': 'galaxy-app', |
| 177 | 'appVersion': '1.27.0', |
| 178 | 'platform': 'Android', |
| 179 | 'Cache-Control': 'no-cache', |
| 180 | 'Connection': 'Keep-Alive', |
| 181 | 'Accept-Encoding': 'gzip', |
| 182 | } |
| 183 | if (key == 204179735) { |
| 184 | headers["usetoken"] = true |
| 185 | headers["host"] = `galaxy-user-api.geely.com` |
| 186 | delete headers["x-refresh-token"] |
| 187 | headers["taenantid"] = 569001701001 |
| 188 | headers["svcsid"] = "" |
| 189 | } else { |
| 190 | headers["usetoken"] = 1 |
| 191 | headers["host"] = `galaxy-app.geely.com` |
| 192 | headers["x-refresh-token"] = true |
| 193 | } |
| 194 | return headers |
| 195 | } |
| 196 | |
| 197 | // 刷新Key函数 |
| 198 | async refresh_token() { |
no test coverage detected