shawenguan 1 년 전
부모
커밋
455885c63c
3개의 변경된 파일86개의 추가작업 그리고 3개의 파일을 삭제
  1. 74 1
      BoxJsSub/hbcpre.json
  2. 10 1
      Scripts/hbcpre/hbcpreGrab.js
  3. 2 1
      Scripts/hbcpre/hbcpreHelper.js

+ 74 - 1
BoxJsSub/hbcpre.json

@@ -20,6 +20,10 @@
                 {
                     "name": "极速下单",
                     "script": "https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/hbcpre/hbcpreOrder.js"
+                },
+                {
+                    "name": "首发抢购",
+                    "script": "https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/hbcpre/hbcpreGrab.js"
                 }
             ],
             "keys": [
@@ -36,6 +40,13 @@
                     "desc": "默认关闭"
                 },
                 {
+                    "id": "HbcpreHomeSeriesDataGrabEnabled",
+                    "name": "开启/关闭首发采集",
+                    "val": false,
+                    "type": "boolean",
+                    "desc": "默认关闭"
+                },
+                {
                     "id": "drawItemDataGrabEnabled",
                     "name": "开启/关闭抽奖采集",
                     "val": false,
@@ -145,7 +156,7 @@
                     "id": "HbcpreOrderLimitPrice",
                     "name": "捡漏最高价格",
                     "val": 0,
-                    "type": "text",
+                    "type": "number",
                     "desc": "捡漏最高价格"
                 },
                 {
@@ -164,6 +175,68 @@
                     "desc": "产品列表"
                 }
             ]
+        },
+        {
+            "id": "jojo.hbcpreHomeGrab",
+            "name": "华文数交首发",
+            "author": "@jojo",
+            "repo": "https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/hbcpre/hbcpreGrab.js",
+            "script": "https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/hbcpre/hbcpreGrab.js",
+            "icons": [
+                "https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Icons/hbcpre.png",
+                "https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Icons/hbcpre.png"
+            ],
+            "keys": [
+                "HbcpreUserToken",
+                "HbcpreUserInfo",
+                "HbcpreHomeSeriesList"
+            ],
+            "settings": [
+                {
+                    "id": "HbcpreHomeSeriesCacheModeEnabled",
+                    "name": "开启/关闭缓存模式",
+                    "val": true,
+                    "type": "boolean",
+                    "desc": "默认开启"
+                },
+                {
+                    "id": "HbcpreHomeSeriesId",
+                    "name": "当前首发抢购Id",
+                    "val": "",
+                    "type": "text",
+                    "desc": "当前首发抢购Id"
+                },
+                {
+                    "id": "HbcpreHomeSeriesName",
+                    "name": "当前首发抢购名称",
+                    "val": "",
+                    "type": "text",
+                    "desc": "当前首发抢购名称"
+                },
+                {
+                    "id": "HbcpreHomeSeriesLimitBuy",
+                    "name": "一个ID限制下单数量",
+                    "val": 0,
+                    "type": "number",
+                    "desc": "一个ID限制下单数量"
+                },
+                {
+                    "id": "HbcpreHomeSeriesInfo",
+                    "name": "产品列表",
+                    "val": "[]",
+                    "autoGrow": false,
+                    "type": "textarea",
+                    "desc": "产品列表"
+                },
+                {
+                    "id": "HbcpreHomeSeriesList",
+                    "name": "产品列表",
+                    "val": "[]",
+                    "autoGrow": false,
+                    "type": "textarea",
+                    "desc": "产品列表"
+                }
+            ]
         }
     ]
 }

+ 10 - 1
Scripts/hbcpre/hbcpreGrab.js

@@ -22,6 +22,7 @@ const HbcpreConstKey = {
 
     // 首发相关的
     homeSeriesDataGrabEnabled: 'HbcpreHomeSeriesDataGrabEnabled',
+    homeSeriesCacheModeEnabled: 'HbcpreHomeSeriesCacheModeEnabled',
     homeSeriesOpenTimeOffset: 'HbcpreOpeningTimeOffset',
     homeSeriesList: 'HbcpreHomeSeriesList',
     homeSeriesInfo: 'HbcpreHomeSeriesInfo',
@@ -95,6 +96,14 @@ function updateRequestHeaders() {
     }
 }
 
+function isHomeSeriesDataGrabEnabled() {
+    let flag = magicJS.data.read(HbcpreConstKey.homeSeriesCacheModeEnabled, null);
+    if (flag == null) {
+        return false;
+    }
+    return JSON.parse(flag);
+}
+
 async function tryGrabNew() {
     let itemId = magicJS.data.read(HbcpreConstKey.homeSeriesId, null);
     let itemName = magicJS.data.read(HbcpreConstKey.homeSeriesName, null);
@@ -102,7 +111,7 @@ async function tryGrabNew() {
         magicJS.logger.info(`缺少首发产品信息`);
         return;
     }
-    let onlyUseCacheData = true;
+    let onlyUseCacheData = isHomeSeriesDataGrabEnabled();
     let willBuyList = [];
     let seriesSimple = getHomeSeriesCache(itemId, itemName);
     if(seriesSimple){

+ 2 - 1
Scripts/hbcpre/hbcpreHelper.js

@@ -40,6 +40,7 @@ const HbcpreConstKey = {
 
     // 首发相关的
     homeSeriesDataGrabEnabled: 'HbcpreHomeSeriesDataGrabEnabled',
+    homeSeriesCacheModeEnabled: 'HbcpreHomeSeriesCacheModeEnabled',
     homeSeriesOpenTimeOffset: 'HbcpreOpeningTimeOffset',
     homeSeriesList: 'HbcpreHomeSeriesList',
     homeSeriesInfo: 'HbcpreHomeSeriesInfo',
@@ -489,7 +490,7 @@ function handlerHomeSeriesList(){
         dataList.push(tmpItemDict[k]);
     }
     magicJS.data.write(HbcpreConstKey.homeSeriesList, dataList);
-    
+
     gRetBody = rspData;
 }