From 188a925be5b1024608eba034d1225e126b3134a8 Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期三, 16 七月 2025 16:46:41 +0800
Subject: [PATCH] 资源扫码

---
 packageDomain/pages/resourceDetails/document/index.js                 |   52 +++++-----------
 packageBookService/pages/bookServices/detail/components/tree/index.js |    2 
 packageDomain/pages/resourceDetails/myVideo/index.js                  |   54 +++++------------
 packageDomain/pages/resourceDetails/myAudio/index.js                  |   52 +++++-----------
 project.config.json                                                   |    2 
 5 files changed, 53 insertions(+), 109 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js
index 2717a1e..3d90c78 100644
--- a/packageBookService/pages/bookServices/detail/components/tree/index.js
+++ b/packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -316,7 +316,7 @@
         }
         wx.navigateTo({
           url: `${url}?productLinkPath=${item.productLinkPath}&parentProductLinkPath=${parentProductLinkPath}&parentName=${parentName}&activeId=${item.id}&bookId=${this.properties.bookInfo.id}&bookName=${this.properties.bookInfo.name}&cmsId=${this.properties.bookInfo.rootCmsItemId}&formPath=${this.properties.tab}&applyState=${this.properties.applyState}&deadline=${this.properties.deadline}`,
-          // url: '/packageDomain/pages/resourceDetails/myVideo/index?formPath=jsek_cloudLearning&parentName=mingxing&cmsId=161796&productLinkPath=161796\\161798\\165396\\162299&activeId=162299&parentProductLinkPath=161798\\165396&source=qrcode&bookName=&bookId=7129'
+          // url: '/packageDomain/pages/resourceDetails/myVideo/index?formPath=jsek_cloudLearning&parentName=gggg&cmsId=137103&productLinkPath=137103\\137105\\159492&activeId=159492&parentProductLinkPath=137105&source=qrcode&bookName=fffff&bookId=6745'
         });
       }
       const token = wx.getStorageSync(app.config.tokenKey);
diff --git a/packageDomain/pages/resourceDetails/document/index.js b/packageDomain/pages/resourceDetails/document/index.js
index 3276d2a..14027c6 100644
--- a/packageDomain/pages/resourceDetails/document/index.js
+++ b/packageDomain/pages/resourceDetails/document/index.js
@@ -295,32 +295,10 @@
 
   // 鍒ゆ柇褰撳墠鐩爣鏄惁宸茶喘涔�
   async getCmsDataByQrcode() {
-    let query = {
-      storeInfo: this.data.storeInfo,
-      path: '*',
-      queryType: '*',
-      productId: this.data.bookId,
-      itemId: this.data.activeId,
-      itemFields: {
-        // 璧勬簮绫诲瀷锛岃瘯璇绘枃浠讹紝鏄惁鍏佽涓嬭浇绛夊弬鏁�
-        selectType: [],
-        freeFile: [],
-        file: [],
-        protectedFile: [],
-        resourcesClassification: [],
-        isDownload: [],
-        jsek_resourceBrief: [],
-        jsek_link: [],
-        jsek_questionBank: [],
-        learnSelectType: []
-      },
-      pading: {
-        start: 0,
-        size: 999
-      }
-    }
-    const data = await app.MG.store.getProductDetail(query)
-    return data?.datas ?? []
+    const query = {
+      cmsItemId: Number(this.data.activeId)
+    };
+    return app.MG.file.checkCmsItem(query)
   },
 
   resourceDetailsData() {
@@ -411,19 +389,23 @@
       })
       if (this.data.source == 'qrcode') {
         let qrData = this.data.threeLeveData.find(ditem => ditem.id == this.data.activeId)
-        const currentSaleMaths = await this.getCmsDataByQrcode()
-        // 鍒ゆ柇鏄惁璐拱鐩綍
-        const catalg = currentSaleMaths?.saleMethod?.find(i => currentSaleMaths.purchasedSaleMethodIdList.includes(i.Id))
-        // 鍒ゆ柇鏄惁璐拱璧勬簮鏈韩 
-        const ownCms = qrData.saleMethods?.find(i => currentSaleMaths.purchasedSaleMethodIdList.includes(i.Id))
-        if (catalg || ownCms) {
+        const isBuyCms = await this.getCmsDataByQrcode() // 褰撳墠璧勬簮鎴栫埗绾х洰褰曟槸鍚﹁喘涔�
+        const isDefualtPrice = this.data.bookDetail?.defaultSaleMethod?.price // 褰撳墠涔︾殑浠烽粯璁ら攢鍞柟寮忎环鏍兼槸鍚︿负0
+        const isBuyBook = this.data.bookDetail?.alreadyBuy // 褰撳墠涔︽槸鍚﹁喘涔�
+        if (isBuyCms) {
           this.setData({
             threeLeveData: [qrData]
           })
         } else {
-          this.setData({
-            threeLeveData: []
-          })
+          if (isDefualtPrice == 0 || isBuyBook) {
+            this.setData({
+              threeLeveData: [qrData]
+            })
+          } else {
+            this.setData({
+              threeLeveData: []
+            })
+          }
         }
       } else {
         this.setData({
diff --git a/packageDomain/pages/resourceDetails/myAudio/index.js b/packageDomain/pages/resourceDetails/myAudio/index.js
index 409ae1c..9803f75 100644
--- a/packageDomain/pages/resourceDetails/myAudio/index.js
+++ b/packageDomain/pages/resourceDetails/myAudio/index.js
@@ -349,32 +349,10 @@
 
   // 鍒ゆ柇褰撳墠鐩爣鏄惁宸茶喘涔�
   async getCmsDataByQrcode() {
-    let query = {
-      storeInfo: this.data.storeInfo,
-      path: '*',
-      queryType: '*',
-      productId: this.data.bookId,
-      itemId: this.data.activeId,
-      itemFields: {
-        // 璧勬簮绫诲瀷锛岃瘯璇绘枃浠讹紝鏄惁鍏佽涓嬭浇绛夊弬鏁�
-        selectType: [],
-        freeFile: [],
-        file: [],
-        protectedFile: [],
-        resourcesClassification: [],
-        isDownload: [],
-        jsek_resourceBrief: [],
-        jsek_link: [],
-        jsek_questionBank: [],
-        learnSelectType: []
-      },
-      pading: {
-        start: 0,
-        size: 999
-      }
-    }
-    const data = await app.MG.store.getProductDetail(query)
-    return data?.datas ?? []
+    const query = {
+      cmsItemId: Number(this.data.activeId)
+    };
+    return app.MG.file.checkCmsItem(query)
   },
 
   resourceDetailsData() {
@@ -446,19 +424,23 @@
       });
       if (this.data.source == 'qrcode') {
         let qrData = this.data.threeLeveData.find(ditem => ditem.id == this.data.activeId)
-        const currentSaleMaths = await this.getCmsDataByQrcode()
-        // 鍒ゆ柇鏄惁璐拱鐩綍
-        const catalg = currentSaleMaths?.saleMethod?.find(i => currentSaleMaths.purchasedSaleMethodIdList.includes(i.Id))
-        // 鍒ゆ柇鏄惁璐拱璧勬簮鏈韩 
-        const ownCms = qrData.saleMethods?.find(i => currentSaleMaths.purchasedSaleMethodIdList.includes(i.Id))
-        if (catalg || ownCms) {
+        const isBuyCms = await this.getCmsDataByQrcode() // 褰撳墠璧勬簮鎴栫埗绾х洰褰曟槸鍚﹁喘涔�
+        const isDefualtPrice = this.data.bookDetail?.defaultSaleMethod?.price // 褰撳墠涔︾殑浠烽粯璁ら攢鍞柟寮忎环鏍兼槸鍚︿负0
+        const isBuyBook = this.data.bookDetail?.alreadyBuy // 褰撳墠涔︽槸鍚﹁喘涔�
+        if (isBuyCms) {
           this.setData({
             threeLeveData: [qrData]
           })
         } else {
-          this.setData({
-            threeLeveData: []
-          })
+          if (isDefualtPrice == 0 || isBuyBook) {
+            this.setData({
+              threeLeveData: [qrData]
+            })
+          } else {
+            this.setData({
+              threeLeveData: []
+            })
+          }
         }
       } else {
         this.setData({
diff --git a/packageDomain/pages/resourceDetails/myVideo/index.js b/packageDomain/pages/resourceDetails/myVideo/index.js
index efda51a..ea072ff 100644
--- a/packageDomain/pages/resourceDetails/myVideo/index.js
+++ b/packageDomain/pages/resourceDetails/myVideo/index.js
@@ -332,32 +332,10 @@
 
   // 鍒ゆ柇褰撳墠鐩爣鏄惁宸茶喘涔�
   async getCmsDataByQrcode() {
-    let query = {
-      storeInfo: this.data.storeInfo,
-      path: '*',
-      queryType: '*',
-      productId: this.data.bookId,
-      itemId: this.data.activeId,
-      itemFields: {
-        // 璧勬簮绫诲瀷锛岃瘯璇绘枃浠讹紝鏄惁鍏佽涓嬭浇绛夊弬鏁�
-        selectType: [],
-        freeFile: [],
-        file: [],
-        protectedFile: [],
-        resourcesClassification: [],
-        isDownload: [],
-        jsek_resourceBrief: [],
-        jsek_link: [],
-        jsek_questionBank: [],
-        learnSelectType: []
-      },
-      pading: {
-        start: 0,
-        size: 999
-      }
-    }
-    const data = await app.MG.store.getProductDetail(query)
-    return data?.datas ?? []
+    const query = {
+      cmsItemId: Number(this.data.activeId)
+    };
+    return app.MG.file.checkCmsItem(query)
   },
 
   resourceDetailsData() {
@@ -433,21 +411,23 @@
       })
       if (this.data.source == 'qrcode') {
         let qrData = this.data.threeLeveData.find(ditem => ditem.id == this.data.activeId)
-        const currentSaleMaths = await this.getCmsDataByQrcode()
-        // 鍒ゆ柇鏄惁璐拱鐩綍
-        const catalg = currentSaleMaths?.saleMethod?.find(i => currentSaleMaths.purchasedSaleMethodIdList.includes(i.Id))
-        // 鍒ゆ柇鏄惁璐拱璧勬簮鏈韩 
-        const ownCms = qrData?.saleMethods?.find(i => currentSaleMaths.purchasedSaleMethodIdList.includes(i.Id))
-        if (catalg || ownCms) {
-          if (qrData) {
+        const isBuyCms = await this.getCmsDataByQrcode() // 褰撳墠璧勬簮鎴栫埗绾х洰褰曟槸鍚﹁喘涔�
+        const isDefualtPrice = this.data.bookDetail?.defaultSaleMethod?.price // 褰撳墠涔︾殑浠烽粯璁ら攢鍞柟寮忎环鏍兼槸鍚︿负0
+        const isBuyBook = this.data.bookDetail?.alreadyBuy // 褰撳墠涔︽槸鍚﹁喘涔�
+        if (isBuyCms) {
+          this.setData({
+            threeLeveData: [qrData]
+          })
+        } else {
+          if (isDefualtPrice == 0 || isBuyBook) {
             this.setData({
               threeLeveData: [qrData]
             })
+          } else {
+            this.setData({
+              threeLeveData: []
+            })
           }
-        } else {
-          this.setData({
-            threeLeveData: []
-          })
         }
       } else {
         this.setData({
diff --git a/project.config.json b/project.config.json
index 43de9ef..5eba6c6 100644
--- a/project.config.json
+++ b/project.config.json
@@ -136,6 +136,6 @@
     "include": []
   },
   "appid": "wx7f362fe7cb6e0d1f",
-  "libVersion": "3.8.8",
+  "libVersion": "3.8.11",
   "projectname": "jsek-applet"
 }
\ No newline at end of file

--
Gitblit v1.9.1