shawenguan 1 năm trước cách đây
mục cha
commit
8fc1673b3c
2 tập tin đã thay đổi với 151 bổ sung5 xóa
  1. 64 0
      BoxJsSub/release.json
  2. 87 5
      Scripts/elife/ofpayHelper.js

+ 64 - 0
BoxJsSub/release.json

@@ -224,6 +224,70 @@
                     "desc": ""
                 }
             ]
+        },
+        {
+            "id": "lkOfpayHelper",
+            "name": "爱购8.8助手",
+            "author": "@jojo",
+            "script": "https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/elife/ofpayGrab.js",
+            "descs_html": [""],
+            "icons": [
+                "https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Icons/jhsh.png",
+                "https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Icons/jhsh.png"
+            ],
+            "keys": ["lkJhshSignReward", "lkJhshActInfo-A3341A038", "lkJhshLoginInfo", "lkJhshAppVersion"],
+            "settings": [
+                {
+                    "id": "lkOfPayUUID",
+                    "name": "UUID",
+                    "val": "",
+                    "type": "text",
+                    "desc": ""
+                },
+                {
+                    "id": "lkOfPayAuthorization",
+                    "name": "Authorization",
+                    "val": "",
+                    "type": "text",
+                    "desc": ""
+                },
+                {
+                    "id": "lkOfPayCookie",
+                    "name": "Cookie",
+                    "val": "",
+                    "type": "textarea",
+                    "autoGrow": true,
+                    "rows": 1,
+                    "desc": ""
+                },
+                {
+                    "id": "lkOfPayMarketItemsData1",
+                    "name": "首单享好礼",
+                    "val": "",
+                    "type": "textarea",
+                    "autoGrow": true,
+                    "rows": 1,
+                    "desc": ""
+                },
+                {
+                    "id": "lkOfPayMarketItemsData2",
+                    "name": "达标享好礼",
+                    "val": "",
+                    "type": "textarea",
+                    "autoGrow": true,
+                    "rows": 1,
+                    "desc": ""
+                },
+                {
+                    "id": "lkOfPayMarketItemsData3",
+                    "name": "邀请有礼",
+                    "val": "",
+                    "type": "textarea",
+                    "autoGrow": true,
+                    "rows": 1,
+                    "desc": ""
+                }
+            ]
         }
     ]
 }

+ 87 - 5
Scripts/elife/ofpayHelper.js

@@ -19,6 +19,39 @@ hostname=market-web.ofpay.com
 const lk = new ToolKit(`爱购8.8`, `OfpayHelper.js`);
 
 
+const OfPayConstKey = {
+    uuid: 'lkOfPayUUID',
+    token: 'lkOfPayAuthorization',
+    cookie: 'lkOfPayCookie',
+
+    marketId: 'lkOfPayMarketId',
+    eventVisitorId: 'lkOfPayEventVisitorId',
+    marketItemsData: 'lkOfPayMarketItemsData',
+}
+
+let ofpayUserAgent = `Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 F-OFST  elife_moblie_ios  fullversion:6.0.2  BSComponentVersion:5.4 WorkStationChannel:0 isBreak:0  ICBCiPhoneBSNew 6.0.2 iphone os wkwebview:true`;
+let ofpayUUID = lk.getVal(OfPayConstKey.uuid,'');
+
+// jwt登录身份验证 24小时过期
+let ofpayAuthorization = lk.getVal(OfPayConstKey.token, '');
+let ofpayCookie = lk.getVal(OfPayConstKey.cookie,'');
+
+const GCommonHeads = {
+    'HOST': 'market-web.ofpay.com',
+    'UUID': ofpayUUID,
+    'Accept': `application/json`,
+    'Origin': `https://www.gandart.com`,
+    'Accept-Encoding': `gzip, deflate, br`,
+    'Content-Type': `application/json; charset=utf-8`,
+    'Connection': `keep-alive`,
+    'Host': `api2.gandart.com`,
+    'User-Agent': ofpayUserAgent,
+    'Referer': `https://www.gandart.com/`,
+    'Accept-Language': `zh-CN,zh-Hans;q=0.9`,
+    'Authorization': ofpayAuthorization,
+    'Cookie': ofpayCookie,
+};
+
 let retBody;
 if (!lk.isExecComm) {
     if (lk.isRequest()) {
@@ -37,14 +70,29 @@ function checkHandleRequest() {
     lk.log(`请求url=${url}#${$request.method}`);
     lk.log(`请求body=${lk.getRequestBody()}`);
     if ($request && $request.method != 'OPTIONS') {
+        let headers = $request.headers;
+        if(!lk.isEmpty(headers.UUID)){
+            lk.setVal(OfPayConstKey.uuid, headers.UUID);
+        }
+        if(!lk.isEmpty(headers.Authorization)){
+            lk.setVal(OfPayConstKey.token, headers.Authorization);
+        }
+        if(!lk.isEmpty(headers.Cookie)){
+            lk.setVal(OfPayConstKey.cookie, headers.Cookie);
+        }
         if(path.match(/\/h5\/union\/market\/indexConfigAll/)){
-            let rspBody = lk.getResponseBody();
-            lk.log(`rspBody=${rspBody}`);
+            handleIndexConfigAll();
         } else if(path.match(/\/h5\/union\/interactiveIGoChoose\/index/)){
 
         } else if(path.match(/\/h5\/union\/api\/interactiveIGoChoose\/indexConfigRebuild/)){
-            // 获取商品列表
-
+            // 获取商品列表-首单享好礼(活动1)
+            handleMarketGoodsList(1);
+        } else if(path.match(/\/h5\/union\/interactiveIGoChoose\/checkMarket/)){
+            updateMarketInfoByUrlParams();
+        } else if(path.match(/\/h5\/union\/interactiveIGoChoose\/marketIndexRebuild/)){
+            // 获取商品列表-达标享好礼(活动2)subLoginType=igoPreMarket
+            // 获取商品列表-邀请有礼(活动3)subLoginType=igoShareMarket
+            handleMarketGoodsList(2);
         } else if(path.match(/\/h5\/union\/api\/interactiveIGoChoose\/orderList/)){
             // 获取订单列表
             handleOrderList();
@@ -67,12 +115,46 @@ function generateRandomNumber(length) {
     return result;
 }
 
+function updateMarketInfoByUrlParams(){
+    let urlParams = lk.parseQueryStr($request.url);
+    // lk.log(`rspBody=${urlParams}`);
+    if(urlParams.marketId){
+        lk.setVal(OfPayConstKey.marketId, urlParams.marketId);
+    }
+    if(urlParams.eventVisitorId){
+        lk.setVal(OfPayConstKey.eventVisitorId, urlParams.eventVisitorId);
+    }
+}
+
+function handleIndexConfigAll(){
+    updateMarketInfoByUrlParams();
+}
+
+function handleMarketGoodsList(tabIndex){
+    updateMarketInfoByUrlParams();
+    let urlParams = lk.parseQueryStr($request.url);
+    if(tabIndex == 2 && urlParams.subLoginType){
+        if('igoPreMarket' == urlParams.subLoginType){
+            tabIndex = 2;
+        } else if('igoShareMarket' == urlParams.subLoginType) {
+            tabIndex = 3;
+        }
+    }
+    let rspBody = lk.getResponseBody();
+    if (!rspBody) {
+        return;
+    }
+    let key = `${OfPayConstKey.marketItemsData}${tabIndex}`;
+    lk.setVal(key, rspBody);
+}
+
 function handleOrderList(){
     // 生成一个6位数的随机码
+    let urlParams = lk.parseQueryStr($request.url);
     let reqParams = {};
     let reqBody = lk.getRequestBody();
     if (reqBody) {
-        params = lk.parseQueryStr(reqBody);
+        reqParams = JSON.parse(reqBody);
     }
     let rspBody = lk.getResponseBody();
     if (!rspBody) {