sc-common-interface 2.3.0__tar.gz → 2.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.3.0
3
+ Version: 2.3.2
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -53,11 +53,27 @@ def end_activity(data):
53
53
  def send__live_comment(data):
54
54
  env = data["env"]
55
55
  key = data["key"]
56
- info = get_live_info(data)
57
- related_post_list = info["data"]["relatedPostList"][0]
58
- page_id = related_post_list["page_id"]
59
- post_id = related_post_list["post_id"]
60
- platform = related_post_list["platform"]
56
+ platform = "FACEBOOK"
57
+ page_id = ""
58
+ post_id = ""
59
+ if "page_id" in data:
60
+ page_id = data['page_id']
61
+ if "platform" in data:
62
+ platform = data['platform']
63
+ if "post_id" in data:
64
+ post_id = data['post_id']
65
+ if page_id == "" or post_id == "":
66
+ info = get_live_info(data)
67
+ platform_list = jsonpath(info, "$..relatedPostList..platform")
68
+ i = platform_list.index(platform)
69
+ page_id = info["data"]["relatedPostList"][i]["page_id"]
70
+ platform = info["data"]["relatedPostList"][i]["platform"]
71
+ post_id = info["data"]["relatedPostList"][i]["post_id"]
72
+ # info = get_live_info(data)
73
+ # related_post_list = info["data"]["relatedPostList"][0]
74
+ # page_id = related_post_list["page_id"]
75
+ # post_id = related_post_list["post_id"]
76
+ # platform = related_post_list["platform"]
61
77
  stamp = int(time.time())
62
78
  num = random.randint(100000, 999999)
63
79
  user_id = "488864%d" % int(time.time())
@@ -88,13 +104,14 @@ def send__live_comment(data):
88
104
  "media_product_type": "FEED"},
89
105
  "id": comment_id, "text": keyword},
90
106
  "field": "comments"}]}], "object": "instagram"}
91
-
107
+ print(body)
92
108
  url = "%s/facebook/webhook" % env
93
109
  sign_text = hmac.new(key.encode("utf-8"), json.dumps(body).encode("utf-8"), sha1)
94
110
  signData = sign_text.hexdigest()
95
111
  # print("body", json.dumps(body))
96
112
  header = {"Content-Type": "application/json", "x-hub-signature": "sha1=%s" % signData}
97
113
  response = requests.post(url, headers=header, data=json.dumps(body))
114
+ print(response.text)
98
115
  return user_id, name, comment_id
99
116
 
100
117
  def send_mc_message(data):
@@ -291,6 +308,62 @@ def get_merchant_info(data):
291
308
  currency = "₫"
292
309
  return base_country_code,currency,response
293
310
 
311
+ def delete_broadcast(data):
312
+ env = data["env"]
313
+ headers = data["headers"]
314
+ broadcast_id = data["broadcast_id"]
315
+ url = "%s/admin/api/bff-web/live/broadcast/%s"%(env,broadcast_id)
316
+ response = requests.delete(url,headers=headers).json()
317
+ return response
318
+
319
+ def get_broadcast_list(data):
320
+ env = data["env"]
321
+ headers = data["headers"]
322
+ sales_id = data["sales_id"]
323
+ name = ""
324
+ platform= data["platform"]
325
+ broadcast_id = ""
326
+ pageNum = 1
327
+ pageSize = 12
328
+ if "pageNum" in data:
329
+ pageNum = data["pageNum"]
330
+ if "pageSize" in data:
331
+ pageSize = data["pageSize"]
332
+ if "name" in data:
333
+ name= data["name"]
334
+ url = "%s/admin/api/bff-web/live/broadcast/query"%env
335
+ body = {
336
+ "businessId": "%s"%sales_id,
337
+ "businessType": "LIVE",
338
+ "businessSubType": "LIVE_STREAM",
339
+ "platform": "%s"%platform,
340
+ "pageNum": pageNum,
341
+ "pageSize": pageSize
342
+ }
343
+ reponse = requests.post(url,headers=headers,json=body).json()
344
+ if name !="":
345
+ name_list = jsonpath(reponse,"$..name")
346
+ broadcast_id_list = jsonpath(reponse,"$..id")
347
+ for i,value in enumerate(name_list):
348
+ if value==name:
349
+ broadcast_id =broadcast_id_list[i]
350
+ return broadcast_id,name
351
+
352
+ def get_broadcast_detail(data):
353
+ env = data["env"]
354
+ headers = data["headers"]
355
+ broadcast_id = data["broadcast_id"]
356
+ platform = data["platform"]
357
+ url = "%s/admin/api/bff-web/live/broadcast/detail"%env
358
+ body = {
359
+ "id": "%s"%broadcast_id,
360
+ "platform": "%s"%platform
361
+ }
362
+ response = requests.post(url,headers=headers,json=body).json()
363
+ return response
364
+
365
+
366
+
294
367
 
295
368
 
296
369
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.3.0
3
+ Version: 2.3.2
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='sc-common-interface',
5
- version='2.3.0',
5
+ version='2.3.2',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),