|
@@ -1,49 +1,18 @@
|
|
|
"""
|
|
|
@author: luojunhui
|
|
|
"""
|
|
|
-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
|
|
|
- }
|
|
|
- }
|
|
|
+import json
|
|
|
+
|
|
|
+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亿人喜欢的视频平台"
|
|
|
}
|
|
|
|
|
|
|
|
@@ -52,11 +21,13 @@ class Minigram(object):
|
|
|
小程序卡片
|
|
|
"""
|
|
|
|
|
|
- def __init__(self, params):
|
|
|
+ def __init__(self, params, config):
|
|
|
+ self.gh_id = None
|
|
|
self.params = params
|
|
|
self.business_type = None
|
|
|
self.mini_code = None
|
|
|
self.trace_id = None
|
|
|
+ self.config = config
|
|
|
|
|
|
def check_params(self):
|
|
|
"""
|
|
@@ -67,6 +38,7 @@ class Minigram(object):
|
|
|
self.business_type = self.params['businessType']
|
|
|
self.mini_code = self.params['miniCode']
|
|
|
self.trace_id = self.params['traceId']
|
|
|
+ self.gh_id = self.params.get('ghId', None)
|
|
|
return None
|
|
|
except Exception as e:
|
|
|
response = {
|
|
@@ -82,19 +54,17 @@ 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)
|
|
|
- }
|
|
|
+ pq_gh_id_list = json.loads(self.config.get_config_value('ghIdInPqVideo'))
|
|
|
+ if self.gh_id in set(pq_gh_id_list):
|
|
|
+ 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):
|