|
|
@@ -40,6 +40,10 @@ const GYQP_APPID = 'wx5508e31ffe9366b8'; // 贵盐黔品
|
|
|
const LLSC_APPID = 'wx821fb4d8604ed4d6'; // 乐旅商城
|
|
|
const YLQX_APPID = 'wxee0ce83ab4b26f9c'; // 驿路黔寻
|
|
|
|
|
|
+//手机上上的UserAgent
|
|
|
+const UserAgent = `Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKitz/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.47(0x18002f2c) NetType/WIFI Language/zh_CN`;
|
|
|
+// //PC上的UserAgent
|
|
|
+// const UserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF XWEB/6945';
|
|
|
const APP_INFO_BY_APPID = {
|
|
|
['wxded2e7e6d60ac09d'] : {
|
|
|
key: 'XLTH_COOKIE',
|
|
|
@@ -328,18 +332,14 @@ function delay(time) {
|
|
|
|
|
|
function calculateDigest(body, sk) {
|
|
|
const CryptoJS = createCryptoJS();
|
|
|
- lk.log(body);
|
|
|
const signature = CryptoJS.HmacSHA256(body, sk);
|
|
|
- lk.log(signature);
|
|
|
return CryptoJS.enc.Base64.stringify(signature).toString();
|
|
|
}
|
|
|
|
|
|
function calculateSignature(method, url, ak, sk, date) {
|
|
|
const CryptoJS = createCryptoJS();
|
|
|
const strToSign = `${method.toUpperCase()}\n${url}\n\n${ak}\n${date}\n`;
|
|
|
- lk.log(strToSign);
|
|
|
const signature = CryptoJS.HmacSHA256(strToSign, sk);
|
|
|
- lk.log(signature);
|
|
|
return CryptoJS.enc.Base64.stringify(signature).toString();
|
|
|
}
|
|
|
|
|
|
@@ -353,12 +353,8 @@ function buildHeader(method, url, body) {
|
|
|
// date = date.replace('$1', weekdayAbbreviation);
|
|
|
// date = date.replace('$2', monthAbbreviation);
|
|
|
let date = new Date().toUTCString();
|
|
|
- lk.log(`==============================`);
|
|
|
const signature = calculateSignature(method, url, AK, SK, date);
|
|
|
- lk.log(`signature=${signature}`);
|
|
|
- lk.log(`==============================`);
|
|
|
const digest = calculateDigest(body, SK);
|
|
|
- lk.log(`digest=${digest}`);
|
|
|
const headers = {
|
|
|
'Content-Type': 'application/json',
|
|
|
'X-HMAC-SIGNATURE': signature,
|
|
|
@@ -366,7 +362,7 @@ function buildHeader(method, url, body) {
|
|
|
'X-HMAC-ALGORITHM': 'hmac-sha256',
|
|
|
'X-HMAC-DIGEST': digest,
|
|
|
'X-HMAC-Date': date,
|
|
|
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF XWEB/6945'
|
|
|
+ 'User-Agent': UserAgent,
|
|
|
};
|
|
|
return headers;
|
|
|
}
|