sc-common-interface 2.6.1__tar.gz → 2.6.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.
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/PKG-INFO +1 -1
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface/LiveCommonInterface.py +73 -2
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/setup.py +1 -1
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface/McCommonInterface.py +0 -0
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface/Platform.py +0 -0
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface/PostCommonInterface.py +0 -0
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface/__init__.py +0 -0
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/setup.cfg +0 -0
{sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -7,6 +7,66 @@ import random
|
|
|
7
7
|
import hmac
|
|
8
8
|
from hashlib import sha1
|
|
9
9
|
import random
|
|
10
|
+
from PostCommonInterface import *
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def delete_relate_post(data):
|
|
14
|
+
"""删除串接的facebook或fb group 避免影响串接"""
|
|
15
|
+
env = data["env"]
|
|
16
|
+
headers = data["headers"]
|
|
17
|
+
url = "%s/api/posts/post/sales" % env
|
|
18
|
+
sales_type = "LIVE"
|
|
19
|
+
if "sales_type" in data:
|
|
20
|
+
sales_type = data["sales_type"]
|
|
21
|
+
param = {"page_num": 1, "page_size": 100, "sales_type": sales_type}
|
|
22
|
+
platform = "facebook"
|
|
23
|
+
post_id = data["post_id"]
|
|
24
|
+
if "platform" in data:
|
|
25
|
+
platform = data["platform"].upper()
|
|
26
|
+
param["platforms"] = platform
|
|
27
|
+
if "search" in data:
|
|
28
|
+
search_word = data["search"]
|
|
29
|
+
param["search_word"] = search_word
|
|
30
|
+
response = requests.get(url, headers=headers, params=param).json()
|
|
31
|
+
# print("url",url)
|
|
32
|
+
# print("param", param)
|
|
33
|
+
# print("response",response)
|
|
34
|
+
sales_data = response["data"]["list"]
|
|
35
|
+
print("sales_data",sales_data)
|
|
36
|
+
status = [1,2]
|
|
37
|
+
if "status" in data:
|
|
38
|
+
status = data["status"]
|
|
39
|
+
for i in sales_data:
|
|
40
|
+
platforms = i["platforms"]
|
|
41
|
+
post_sale_status = i["post_sale_status"]
|
|
42
|
+
if platforms == [platform.upper()] and post_sale_status in status:
|
|
43
|
+
sales_id = i["id"]
|
|
44
|
+
data["sales_id"] = sales_id
|
|
45
|
+
# print(sales_id)
|
|
46
|
+
response = get_live_info(data)
|
|
47
|
+
relatedPostList = response["data"]["relatedPostList"]
|
|
48
|
+
if platform.lower() == "facebook":
|
|
49
|
+
for i in relatedPostList:
|
|
50
|
+
fb_post_id = i["post_id"]
|
|
51
|
+
# print("fb_post_id",fb_post_id)
|
|
52
|
+
# print("post_id", post_id)
|
|
53
|
+
if fb_post_id.strip()==post_id.strip():
|
|
54
|
+
print("找到串接的帖文:%s"%sales_id)
|
|
55
|
+
res = delete_post(data)
|
|
56
|
+
# print(res)
|
|
57
|
+
return res
|
|
58
|
+
elif platform.lower()=="fb_group":
|
|
59
|
+
for i in relatedPostList:
|
|
60
|
+
permalink_url = i["permalink_url"]
|
|
61
|
+
post_id = post_id.split("posts/")[-1]
|
|
62
|
+
# print("permalink_url",permalink_url)
|
|
63
|
+
# print("post_id", post_id)
|
|
64
|
+
if post_id.strip() in permalink_url:
|
|
65
|
+
print("找到串接的帖文:%s" % sales_id)
|
|
66
|
+
res = delete_post(data)
|
|
67
|
+
return res
|
|
68
|
+
|
|
69
|
+
|
|
10
70
|
|
|
11
71
|
|
|
12
72
|
|
|
@@ -15,6 +75,7 @@ def get_sales_id(data):
|
|
|
15
75
|
""""查询返回指定直播间的salse_id
|
|
16
76
|
status:准备中 0,直播中 1 已结束 2 断线中 4
|
|
17
77
|
"""
|
|
78
|
+
|
|
18
79
|
env = data["env"]
|
|
19
80
|
headers = data["headers"]
|
|
20
81
|
url = "%s/api/posts/post/sales"%env
|
|
@@ -369,7 +430,7 @@ def live_search_oa_product(data):
|
|
|
369
430
|
if quantitys!=0 or unlimited_quantity==True:
|
|
370
431
|
product_info = items[a]
|
|
371
432
|
spu_id = items[a]["id"]
|
|
372
|
-
sku_id = jsonpath(items[a]["variations"],"$..
|
|
433
|
+
sku_id = jsonpath(items[a]["variations"],"$.._id")
|
|
373
434
|
sku_id_quantity = jsonpath(items[a]["variations"],"$..total_orderable_quantity")
|
|
374
435
|
break
|
|
375
436
|
elif type == "spu" and b == [] and quantity == 0:
|
|
@@ -770,9 +831,19 @@ def create_live(data):
|
|
|
770
831
|
sales_id = response.json()["data"]["sales"]["id"]
|
|
771
832
|
return sales_id
|
|
772
833
|
else:
|
|
834
|
+
time.sleep(1)
|
|
773
835
|
count=count+1
|
|
774
836
|
if count>10:
|
|
775
|
-
|
|
837
|
+
platform = "facebook"
|
|
838
|
+
status = 0
|
|
839
|
+
if "platform" in data:
|
|
840
|
+
platform = data["platform"]
|
|
841
|
+
if "status" in data:
|
|
842
|
+
status = data["status"]
|
|
843
|
+
data["platform"] = platform
|
|
844
|
+
data["status"] = status
|
|
845
|
+
sales_id,__ = get_sales_id(data)
|
|
846
|
+
return sales_id
|
|
776
847
|
|
|
777
848
|
# print(json.dumps(body))
|
|
778
849
|
|
{sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface/PostCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc-common-interface-2.6.1 → sc-common-interface-2.6.2}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|