Przeglądaj źródła

feat: 参数加密

huangzhichao 1 rok temu
rodzic
commit
c96a141e9a
2 zmienionych plików z 7 dodań i 2 usunięć
  1. 1 0
      package.json
  2. 6 2
      src/plugin/components/custom/index.tsx

+ 1 - 0
package.json

@@ -36,6 +36,7 @@
     "@tarojs/runtime": "3.6.19",
     "@tarojs/shared": "3.6.19",
     "@tarojs/taro": "3.6.19",
+    "crypto-js": "^3.1.9-1",
     "react": "^18.0.0",
     "react-dom": "^18.0.0"
   },

+ 6 - 2
src/plugin/components/custom/index.tsx

@@ -9,6 +9,7 @@ import { adSelfPredict } from '@/http/api/index'
 import { adActionLog } from '@/logCenter/index'
 import { reportBusinessType } from '@/plugin/share/const'
 import { queryURLParams } from '@/plugin/share'
+import AES from 'crypto-js/aes.js'
 
 // 在一些场景下 loadedMetaFiredInOnce 被触发了很多次
 let loadedMetaFiredInOnce = 0
@@ -102,12 +103,15 @@ function PqCustom(props: PropsWithChildren<CustomPropsType>) {
     const query = queryURLParams(createAdActionReportData())
 
     adActionReport(reportBusinessType.adPlay, 'adOpen')
+    const orgPath = `path=${encodeURIComponent(landingPageAddress)}&${query}`
+    const path = AES.encrypt(orgPath, 'wx5ef216d1caf4a0eaylq').toString()
+
     openEmbeddedMiniProgram(
       'wx5ef216d1caf4a0ea',
-      `/pages/ad-launch-page/index?path=${encodeURIComponent(landingPageAddress)}&${query}`
+      `/pages/ad-launch-page/index?q=${path}`
     )
 
-    console.log(`/pages/ad-launch-page/index?path=${encodeURIComponent(landingPageAddress)}&${query}`)
+    console.log(`/pages/ad-launch-page/index?q=${path}`)
   }
 
   function videoLoad() {