sc-common-interface 2.5.9__tar.gz → 2.6.1__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.
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/PKG-INFO +1 -1
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface/LiveCommonInterface.py +95 -10
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface/PostCommonInterface.py +3 -1
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/setup.py +1 -1
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface/McCommonInterface.py +0 -0
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface/Platform.py +0 -0
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface/__init__.py +0 -0
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/setup.cfg +0 -0
{sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -9,6 +9,60 @@ from hashlib import sha1
|
|
|
9
9
|
import random
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def get_sales_id(data):
|
|
15
|
+
""""查询返回指定直播间的salse_id
|
|
16
|
+
status:准备中 0,直播中 1 已结束 2 断线中 4
|
|
17
|
+
"""
|
|
18
|
+
env = data["env"]
|
|
19
|
+
headers = data["headers"]
|
|
20
|
+
url = "%s/api/posts/post/sales"%env
|
|
21
|
+
param = {"page_num":1,"page_size":100,"sales_type":"LIVE"}
|
|
22
|
+
platform = "LINE"
|
|
23
|
+
if "platform" in data:
|
|
24
|
+
platform = data["platform"].upper()
|
|
25
|
+
param["platforms"] = platform
|
|
26
|
+
if "search" in data:
|
|
27
|
+
search_word = data["search"]
|
|
28
|
+
param["search_word"] = search_word
|
|
29
|
+
response = requests.get(url,headers=headers,params=param).json()
|
|
30
|
+
# print("url",url)
|
|
31
|
+
# print("param", param)
|
|
32
|
+
# print("response",response)
|
|
33
|
+
sales_data = response["data"]["list"]
|
|
34
|
+
if "status" in data:
|
|
35
|
+
status = data["status"]
|
|
36
|
+
for i in sales_data:
|
|
37
|
+
platforms = i["platforms"]
|
|
38
|
+
post_sale_status = i["post_sale_status"]
|
|
39
|
+
if platforms == [platform.upper()] and post_sale_status == status:
|
|
40
|
+
sales_id = i["id"]
|
|
41
|
+
data["sales_id"] = sales_id
|
|
42
|
+
if "type" in data:
|
|
43
|
+
type = data["type"]
|
|
44
|
+
response = get_live_info(data)
|
|
45
|
+
platform_sub_type = response["data"]["sales"]["platform_sub_type"]
|
|
46
|
+
if platform_sub_type == type.upper():
|
|
47
|
+
return sales_id, response
|
|
48
|
+
else:
|
|
49
|
+
return sales_id, response
|
|
50
|
+
else:
|
|
51
|
+
for i in sales_data:
|
|
52
|
+
platforms = i["platforms"]
|
|
53
|
+
if platforms == [platform.upper()]:
|
|
54
|
+
sales_id = i["id"]
|
|
55
|
+
data["sales_id"] = sales_id
|
|
56
|
+
if "type" in data:
|
|
57
|
+
type = data["type"]
|
|
58
|
+
response = get_live_info(data)
|
|
59
|
+
platform_sub_type = response["data"]["sales"]["platform_sub_type"]
|
|
60
|
+
if platform_sub_type == type.upper():
|
|
61
|
+
return sales_id, response
|
|
62
|
+
else:
|
|
63
|
+
return sales_id, response
|
|
64
|
+
|
|
65
|
+
|
|
12
66
|
def create_activity(data):
|
|
13
67
|
env = data["env"]
|
|
14
68
|
headers = data["headers"]
|
|
@@ -66,7 +120,7 @@ def send__live_comment(data):
|
|
|
66
120
|
post_id = data['post_id']
|
|
67
121
|
if "group_id" in data:
|
|
68
122
|
post_id = data['group_id']
|
|
69
|
-
if page_id == "" or post_id == "":
|
|
123
|
+
if page_id == "" or post_id == "key":
|
|
70
124
|
info = get_live_info(data)
|
|
71
125
|
platform_list = jsonpath(info, "$..relatedPostList..platform")
|
|
72
126
|
i = platform_list.index(platform.upper())
|
|
@@ -197,8 +251,17 @@ def get_live_info(data):
|
|
|
197
251
|
headers = data["headers"]
|
|
198
252
|
sales_id = data["sales_id"]
|
|
199
253
|
url = "%s/api/posts/live/sales/%s" % (env, sales_id)
|
|
200
|
-
|
|
201
|
-
|
|
254
|
+
count = 0
|
|
255
|
+
while True:
|
|
256
|
+
response = requests.get(url,headers=headers)
|
|
257
|
+
if response.status_code==200:
|
|
258
|
+
return response.json()
|
|
259
|
+
else:
|
|
260
|
+
count=count+1
|
|
261
|
+
if count>10:
|
|
262
|
+
print("查询报错")
|
|
263
|
+
return response
|
|
264
|
+
|
|
202
265
|
|
|
203
266
|
|
|
204
267
|
|
|
@@ -700,11 +763,18 @@ def create_live(data):
|
|
|
700
763
|
},
|
|
701
764
|
"postConfigMap":{}
|
|
702
765
|
}
|
|
703
|
-
|
|
766
|
+
count = 0
|
|
767
|
+
while True:
|
|
768
|
+
response = requests.post(url,headers=headers,json=body)
|
|
769
|
+
if response.status_code==200 and response.json()["code"]=="SUCCESS":
|
|
770
|
+
sales_id = response.json()["data"]["sales"]["id"]
|
|
771
|
+
return sales_id
|
|
772
|
+
else:
|
|
773
|
+
count=count+1
|
|
774
|
+
if count>10:
|
|
775
|
+
return 1000
|
|
776
|
+
|
|
704
777
|
# print(json.dumps(body))
|
|
705
|
-
print(response)
|
|
706
|
-
sales_id = response["data"]["sales"]["id"]
|
|
707
|
-
return sales_id
|
|
708
778
|
|
|
709
779
|
|
|
710
780
|
def add_live(data):
|
|
@@ -1429,6 +1499,7 @@ def remove_live_product(data):
|
|
|
1429
1499
|
|
|
1430
1500
|
|
|
1431
1501
|
def change_keyword_status(data):
|
|
1502
|
+
"""生效普通商品状态"""
|
|
1432
1503
|
env = data["env"]
|
|
1433
1504
|
headers = data["headers"]
|
|
1434
1505
|
sales_id = data["sales_id"]
|
|
@@ -1505,10 +1576,16 @@ def get_product_set(data):
|
|
|
1505
1576
|
url = "%s/admin/api/bff-web/live/sale/%s/product/product_set/list"%(env,sales_id)
|
|
1506
1577
|
param = {"pageNum":pageNum,"pageSize":10,"query":query}
|
|
1507
1578
|
# print(param)
|
|
1579
|
+
count = 0
|
|
1508
1580
|
while True:
|
|
1509
1581
|
res = requests.get(url, headers=headers, params=param)
|
|
1510
1582
|
if res.status_code==200:
|
|
1511
1583
|
return res.json()
|
|
1584
|
+
else:
|
|
1585
|
+
count+=1
|
|
1586
|
+
if count>10:
|
|
1587
|
+
print("查询get_product_set 异常")
|
|
1588
|
+
return res
|
|
1512
1589
|
|
|
1513
1590
|
def get_sales_keyword(data):
|
|
1514
1591
|
env = data["env"]
|
|
@@ -1582,10 +1659,16 @@ def get_produnct_set_detail(data):
|
|
|
1582
1659
|
"pageNum": 1,
|
|
1583
1660
|
"pageSize": 101
|
|
1584
1661
|
}
|
|
1662
|
+
count = 0
|
|
1585
1663
|
while True:
|
|
1586
1664
|
response = requests.post(url, headers=headers, json=body)
|
|
1587
1665
|
if response.status_code==200:
|
|
1588
1666
|
return response.json()
|
|
1667
|
+
else:
|
|
1668
|
+
count+=1
|
|
1669
|
+
if count>10:
|
|
1670
|
+
print("查询get_produnct_set_detail 异常")
|
|
1671
|
+
return response
|
|
1589
1672
|
|
|
1590
1673
|
|
|
1591
1674
|
def add_specific_product_set_to_live(data):
|
|
@@ -1716,7 +1799,7 @@ def add_all_product_set_to_live(data):
|
|
|
1716
1799
|
print("出现异常")
|
|
1717
1800
|
lastPage = set_list_res["data"]["pageInfo"]["lastPage"]
|
|
1718
1801
|
pageNum = set_list_res["data"]["pageInfo"]["pageNum"]
|
|
1719
|
-
print("加前的pagenum",pageNum)
|
|
1802
|
+
# print("加前的pagenum",pageNum)
|
|
1720
1803
|
# print(lastPage)
|
|
1721
1804
|
if lastPage == False:
|
|
1722
1805
|
pageNum = pageNum + 1
|
|
@@ -1725,6 +1808,8 @@ def add_all_product_set_to_live(data):
|
|
|
1725
1808
|
else:
|
|
1726
1809
|
break
|
|
1727
1810
|
|
|
1728
|
-
if __name__=="__main__":
|
|
1729
|
-
pass
|
|
1730
1811
|
|
|
1812
|
+
|
|
1813
|
+
|
|
1814
|
+
if __name__=="__main__":
|
|
1815
|
+
pass
|
{sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc-common-interface-2.5.9 → sc-common-interface-2.6.1}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|