shawenguan hai 1 ano
pai
achega
1db6003fbf
Modificáronse 1 ficheiros con 33 adicións e 1 borrados
  1. 33 1
      Scripts/hbcpre/hbcpreHelper.js

+ 33 - 1
Scripts/hbcpre/hbcpreHelper.js

@@ -131,7 +131,10 @@ function checkHandleRequest() {
                 // 公告类别
                 break;
             default:
-                if (path.indexOf('/api/market/packlistdetail') > -1) {
+                if (path.indexOf('/api/collection/index') > -1) {
+                    // 产品详情
+                    handleCollectionIndex();
+                }else if (path.indexOf('/api/market/packlistdetail') > -1) {
                     // 产品详情
                     handlePacklistDetail();
                 }else if (path.indexOf('/api/market/newpackorderlistdetail') > -1) {
@@ -400,6 +403,35 @@ function handlePacklistDetail(){
     }
 }
 
+function handleCollectionIndex(){
+    let rspData = getResponsePlainData();
+    if (!rspData) {
+        return;
+    }
+    if (rspData.code != 1000) {
+        return;
+    }
+    readItemCntRwDict();
+    let dataList = rspData.data;
+
+    for(let i=0; i < dataList.length; i++){
+        const id = dataList[i].collection_id;
+        const name = dataList[i].title;
+        if(gItemCntRwDict[id] != void 0){
+            dataList[i].num = gItemCntRwDict[id];
+        } else if(gItemCntRwDict[name] != void 0){
+            dataList[i].num = gItemCntRwDict[name];
+        }
+        dataList[i].title = `${name} 均价:${dataList[i].avg_price}`
+    }
+
+    const baseConfig = getBaseConfig();
+    if (baseConfig.encrypt) {
+        gRetBody = encryptAES(JSON.stringify(rspData), baseConfig.k, baseConfig.v);
+    } else {
+        gRetBody = rspData;
+    }
+}
 
 function transformKeys(keyStr) {
     let n = 3;