Browse Source

Merge branch '2024-10-18-luojunhui-master-minigram' of Server/title_with_video into master

luojunhui 5 months ago
parent
commit
ae35f56968
1 changed files with 69 additions and 56 deletions
  1. 69 56
      applications/deal/minigram.py

+ 69 - 56
applications/deal/minigram.py

@@ -1,51 +1,65 @@
 """
 @author: luojunhui
 """
+
 from applications.functions.forward import forward_requests
 
-minigram_map = {
-    1: {
-        25: {
-            "avatar": "https://rescdn.yishihui.com/0temp/logo.png",
-            "id": "wx89e7eb06478361d7",
-            "name": "票圈 l 3亿人喜欢的视频平台",
-            "index": 25
-        },
-        29: {
-            "avatar": "https://rescdn.yishihui.com/0temp/logo.png",
-            "id": "wx89e7eb06478361d7",
-            "name": "票圈 l 3亿人喜欢的视频平台",
-            "index": 29
-        },
-        31: {
-            "avatar": "https://rescdn.yishihui.com/0temp/logo.png",
-            "id": "wx89e7eb06478361d7",
-            "name": "票圈 l 3亿人喜欢的视频平台",
-            "index": 31
-        }
-    },
-    2: {
-        36: {
-            "avatar": "https://rescdn.yishihui.com/0temp/logo.png",
-            "id": "wx89e7eb06478361d7",
-            "name": "票圈 l 3亿人喜欢的视频平台",
-            "index": 36
-        },
-        33: {
-            "avatar": "https://rescdn.yishihui.com/0temp/logo.png",
-            "id": "wx89e7eb06478361d7",
-            "name": "票圈 l 3亿人喜欢的视频平台",
-            "index": 33
-        }
-    },
-    3: {
-        27: {
-            "avatar": "https://rescdn.yishihui.com/0temp/xymhfqdd.png",
-            "id": "wx7187c217efef24a7",
-            "name": "幸运美好福气多多",
-            "index": 27
-        }
-    }
+PQSP4 = {
+    "avatar": "https://rescdn.yishihui.com/0temp/pqsp.png",
+    "id": "wxbdd2a2e93d9a6e25",
+    "name": "票圈视频"
+}
+
+VLOG0 = {
+    "avatar": "https://rescdn.yishihui.com/0temp/logo.png",
+    "id": "wx89e7eb06478361d7",
+    "name": "票圈 l 3亿人喜欢的视频平台"
+}
+
+
+PQSP_GHID = {
+    "gh_2ad5072e7a76",
+    "gh_57c9e8babea7",
+    "gh_a61d7ae2e594",
+    "gh_2fe4c2f7d571",
+    "gh_d8c215687f02",
+    "gh_749271f1ccd5",
+    "gh_617684416aec",
+    "gh_a221d1a952aa",
+    "gh_ec42d1027ba5",
+    "gh_e3a8e14013cd",
+    "gh_9ee8fc75c07f",
+    "gh_0e4fd9e88386",
+    "gh_2e8ae0384787",
+    "gh_7c66e0dbd2cf",
+    "gh_755225d8ede5",
+    "gh_92da3c574f82",
+    "gh_31e523f45168",
+    "gh_df59c5e42954",
+    "gh_6d3aa9d13402",
+    "gh_810a439f320a",
+    "gh_2e0c4609839f",
+    "gh_f1122b34f1f3",
+    "gh_da44c409ec0f",
+    "gh_2e615fa75ffb",
+    "gh_d32fe439b098",
+    "gh_d7fa1998b4e1",
+    "gh_abc6794e6996",
+    "gh_c43c01198e6a",
+    "gh_a447c30961b7",
+    "gh_dc2da0611278",
+    "gh_156c66ac3e37",
+    "gh_ddf6ec0104d0",
+    "gh_39218d3a3ec1",
+    "gh_98ec0ffe69b3",
+    "gh_243829b5ff02",
+    "gh_03d32e83122f",
+    "gh_a1c2771f8020",
+    "gh_4f6bfd731ac8",
+    "gh_9360765baf6a",
+    "gh_1686250f15b6",
+    "gh_6e977e8cd40d",
+    "gh_dfa7599c181f"
 }
 
 
@@ -56,6 +70,7 @@ class Minigram(object):
     NEW_STRATEGY = "strategy_v2"
 
     def __init__(self, params):
+        self.gh_id = None
         self.strategy = None
         self.params = params
         self.business_type = None
@@ -72,6 +87,7 @@ class Minigram(object):
             self.mini_code = self.params['miniCode']
             self.trace_id = self.params['traceId']
             self.strategy = self.params.get('strategy')
+            self.gh_id = self.params.get('ghId', None)
             if not self.strategy:
                 self.strategy = "strategy_v1"
             return None
@@ -89,19 +105,16 @@ class Minigram(object):
         分配小程序卡片
         :return:
         """
-        try:
-            minigram = minigram_map.get(self.business_type).get(self.mini_code)
-            response = {
-                "programAvatar": minigram['avatar'],
-                "programId": minigram['id'],
-                "programName": minigram['name'],
-                "trace_id": self.trace_id
-            }
-        except Exception as e:
-            response = {
-                "error": "invalid params",
-                "msg": str(e)
-            }
+        if self.gh_id in PQSP_GHID:
+            minigram = PQSP4
+        else:
+            minigram = VLOG0
+        response = {
+            "programAvatar": minigram['avatar'],
+            "programId": minigram['id'],
+            "programName": minigram['name'],
+            "trace_id": self.trace_id
+        }
         return response
 
     async def deal(self):