shawenguan 1 سال پیش
والد
کامیت
c25c03d03b
2فایلهای تغییر یافته به همراه33 افزوده شده و 4 حذف شده
  1. 8 1
      BoxJsSub/hbcpre.json
  2. 25 3
      Scripts/hbcpre/hbcpreHelper.js

+ 8 - 1
BoxJsSub/hbcpre.json

@@ -87,7 +87,14 @@
                     "val": "",
                     "type": "text",
                     "desc": "拥有的产品数量自定义,格式:id#num|id#num"
-                }
+                },
+                {
+                    "id": "HbcpreOpeningTimeOffset",
+                    "name": "上新产品时间偏移(ms)",
+                    "val": 60000,
+                    "type": "number",
+                    "desc": "上新产品时间向前偏移"
+                },
             ]
         },
         {

+ 25 - 3
Scripts/hbcpre/hbcpreHelper.js

@@ -303,7 +303,8 @@ function checkHandleRequest() {
                     // 产品类别
                     handleMarketSeriesList();
                 } else if (path.indexOf('/mall/home/series')) {//无需登录
-                    //首页数字资产和盲盒推荐
+                    //首页数字资产和盲盒上新
+                    handlerHomeSeriesInfo();
                 } else if (path.indexOf('/mall/homepage/info')) {//无需登录
                     //首页信息,包括广告喇叭、banner上多个入口配置
                     handlerHomePageInfo();
@@ -355,7 +356,7 @@ function getResponsePlainData() {
     if (!data) {
         return;
     }
-    return JSON.parse(data);;
+    return JSON.parse(data);
 }
 
 function getRequestPlainData() {
@@ -419,6 +420,26 @@ function handleUserInfo() {
     }
 }
 
+function handlerHomeSeriesInfo(){
+    let rspData = getResponsePlainData();
+    if (!rspData) {
+        return;
+    }
+    if (rspData.code != 200) {
+        return;
+    }
+    let otimeOffset = magicJS.data.read(HbcpreConstKey.openingTimeOffset, 60000);
+    let seriesList = rspData.data.list;
+    for(let i=0; i < seriesList.length; i++){
+        const item = seriesList[i];
+        if(item.soldNum >= item.issueNum){
+            item.soldNum = item.issueNum - 1;
+        }
+        item.saleTime -= otimeOffset;
+        item.status = 0;
+    }
+}
+
 function handlerHomePageInfo(){
     let rspData = getResponsePlainData();
     if (!rspData) {
@@ -519,10 +540,11 @@ function handleSeriesInfo() {
         let otimeOffset = magicJS.data.read(HbcpreConstKey.openingTimeOffset, 60000);
         seriesInfo.openingTime -= otimeOffset;
         // 强开限制可购买数
-        if(seriesInfo.circulationNumber == seriesInfo.quantityNumber){
+        if(seriesInfo.circulationNumber >= seriesInfo.quantityNumber){
             seriesInfo.circulationNumber = seriesInfo.quantityNumber - 1;
             seriesInfo.authorName = `${seriesInfo.authorName}#改`;
         }
+        seriesInfo.status = 0;
         // 强开限制购买次数
         seriesInfo.limitBuy = 1000;
     }