sc-common-interface 2.7.0__tar.gz → 2.7.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.7.0 → sc_common_interface-2.7.2}/PKG-INFO +1 -1
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface/LiveCommonInterface.py +156 -44
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/setup.py +1 -1
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface/McCommonInterface.py +0 -0
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface/Platform.py +0 -0
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface/PostCommonInterface.py +0 -0
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface/__init__.py +0 -0
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/setup.cfg +0 -0
{sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -194,22 +194,12 @@ def end_activity(data):
|
|
|
194
194
|
def send__live_comment(data):
|
|
195
195
|
env = data["env"]
|
|
196
196
|
key = data["key"]
|
|
197
|
-
platform = "FACEBOOK"
|
|
198
|
-
page_id = ""
|
|
199
|
-
post_id = ""
|
|
200
|
-
group_id = ""
|
|
201
197
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
post_id = data['post_id']
|
|
208
|
-
if "group_id" in data:
|
|
209
|
-
post_id = data['group_id']
|
|
210
|
-
sales_type = "live"
|
|
211
|
-
if "sales_type" in data:
|
|
212
|
-
sales_type = data["sales_type"]
|
|
198
|
+
page_id = data.get("page_id", "")
|
|
199
|
+
platform = data.get("platform", "FACEBOOK")
|
|
200
|
+
post_id = data.get("post_id", "")
|
|
201
|
+
group_id = data.get("group_id", "")
|
|
202
|
+
sales_type = data.get("sales_type", "live")
|
|
213
203
|
if page_id == "" or post_id == "key":
|
|
214
204
|
info = get_live_info(data)
|
|
215
205
|
# print("info",info)
|
|
@@ -293,26 +283,15 @@ def send_mc_message(data):
|
|
|
293
283
|
key = data["key"]
|
|
294
284
|
stamp = int(time.time()*1000)
|
|
295
285
|
user_id = "488864%d" % int(time.time())
|
|
296
|
-
type = "commment"
|
|
297
|
-
payload = "{}"
|
|
298
|
-
if "payload" in data:
|
|
299
|
-
payload = data["payload"]
|
|
300
|
-
if "type" in data:
|
|
301
|
-
type = data["type"]
|
|
302
|
-
if "user_id" in data:
|
|
303
|
-
user_id = data['user_id']
|
|
304
286
|
name = "test live%d" % int(time.time())
|
|
305
|
-
if "name" in data:
|
|
306
|
-
name = data['name']
|
|
307
287
|
message = "接口测试普通留言"
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
platform = data['platform']
|
|
288
|
+
payload = data.get("payload","{}")
|
|
289
|
+
type = data.get("type", "commment")
|
|
290
|
+
user_id = data.get("user_id",user_id)
|
|
291
|
+
name = data.get("name", name)
|
|
292
|
+
message = data.get("message", message)
|
|
293
|
+
page_id = data.get("page_id", "")
|
|
294
|
+
platform = data.get("platform", "FACEBOOK")
|
|
316
295
|
if page_id=="":
|
|
317
296
|
info = get_live_info(data)
|
|
318
297
|
platform_list = jsonpath(info, "$..relatedPostList..platform")
|
|
@@ -331,7 +310,7 @@ def send_mc_message(data):
|
|
|
331
310
|
# body = {"entry":[{"id":"%s"%page_id,"messaging":[{"message":
|
|
332
311
|
# {"mid":"m_hhAqPhSlMTY4En2oWjSB59T3BFjeU97DdDV4WHr3DLWnPrO0iCsjQlG3hBN%d-sBlT26-6oNg"%stamp,"text":"%s"%message},
|
|
333
312
|
# "recipient":{"id":"%s"%page_id},"sender":{"id":"%s"%user_id},"timestamp":stamp}],"time":stamp}],"object":"page"}
|
|
334
|
-
if platform.upper()=="INSTAGRAM":
|
|
313
|
+
if type=="commment" and platform.upper()=="INSTAGRAM":
|
|
335
314
|
body={"object":"instagram","entry":[{"time":stamp,"id":"%s"%page_id,"messaging":[{"sender":{"id":"%s"%user_id},"recipient":{"id":"%s"%page_id},
|
|
336
315
|
"timestamp":stamp,"message":{"mid":"aWdfZAG1faXRlbToxOklHTWVzc2FnZAUlEOjE3ODQxNDUwMzgwODgwNTMzOjM0MDI4MjM2Njg0MTcxMDMwMTI0NDI3NjAyNDExMzcwMDc2NTA5MDozMTgzODU0Mzg3NTY4MDYwMTE3ODUxOTE2MD%d"%stamp,"text":"%s"%message}}]}]}
|
|
337
316
|
elif type=="postback" and platform.upper() in ("FB_GROUP","FACEBOOK"):
|
|
@@ -460,7 +439,11 @@ def live_search_oa_product(data):
|
|
|
460
439
|
query = data["query"]
|
|
461
440
|
url = "%s/openApi/proxy/v1/products?page=1&per_page=4&query=%s" % (env,query)
|
|
462
441
|
response = requests.get(url, headers=headers).json()
|
|
463
|
-
|
|
442
|
+
global items
|
|
443
|
+
try:
|
|
444
|
+
items = response["data"]["items"]
|
|
445
|
+
except Exception:
|
|
446
|
+
print("response:", response)
|
|
464
447
|
variant_options_list = jsonpath(items,"$..variations")
|
|
465
448
|
product_info = ""
|
|
466
449
|
spu_id = ""
|
|
@@ -1857,10 +1840,6 @@ def add_specific_product_set_to_live(data):
|
|
|
1857
1840
|
except Exception:
|
|
1858
1841
|
print("出现异常")
|
|
1859
1842
|
|
|
1860
|
-
def add_mutil_product_set_to_live(data):
|
|
1861
|
-
"""添加多规格商品的全部"""
|
|
1862
|
-
pass
|
|
1863
|
-
|
|
1864
1843
|
|
|
1865
1844
|
def add_all_product_set_to_live(data):
|
|
1866
1845
|
env = data["env"]
|
|
@@ -1997,14 +1976,147 @@ def add_all_product_set_to_keyword(data):
|
|
|
1997
1976
|
break
|
|
1998
1977
|
|
|
1999
1978
|
|
|
1979
|
+
def add_auto_reply(data):
|
|
1980
|
+
global response
|
|
1981
|
+
env = data["env"]
|
|
1982
|
+
headers = data["headers"]
|
|
1983
|
+
sales_id = data["sales_id"]
|
|
1984
|
+
url = "%s/api/posts/post/sales/%s/auto_reply"%(env,sales_id)
|
|
1985
|
+
stamp = int(time.time())
|
|
1986
|
+
name = "自动回复工具名称%d"%stamp
|
|
1987
|
+
keyword_type = "ANY"
|
|
1988
|
+
mode = "BASIC"
|
|
1989
|
+
keywords = ["自动回复关键字%d"%stamp]
|
|
1990
|
+
commentStatus = True
|
|
1991
|
+
messageStatus = True
|
|
1992
|
+
commentContent = "留言回复内容%d"%stamp
|
|
1993
|
+
messageContent = "私讯回复内容%d" % stamp
|
|
1994
|
+
name = data.get("name",name)
|
|
1995
|
+
keyword_type = data.get("keyword_type", keyword_type)
|
|
1996
|
+
mode = data.get("mode", mode)
|
|
1997
|
+
keywords = data.get("keywords", keywords)
|
|
1998
|
+
commentStatus = data.get("commentStatus", commentStatus)
|
|
1999
|
+
messageStatus = data.get("messageStatus", messageStatus)
|
|
2000
|
+
commentContent = data.get("commentContent", commentContent)
|
|
2001
|
+
messageContent = data.get("messageContent", messageContent)
|
|
2002
|
+
body = {
|
|
2003
|
+
"id": "",
|
|
2004
|
+
"name": name,
|
|
2005
|
+
"keywordMatchType": keyword_type,
|
|
2006
|
+
"mode": mode,
|
|
2007
|
+
"status": False,
|
|
2008
|
+
"keywords": [keywords],
|
|
2009
|
+
"answer": {
|
|
2010
|
+
"commentStatus": commentStatus,
|
|
2011
|
+
"messageStatus": messageStatus,
|
|
2012
|
+
"commentContent": commentContent,
|
|
2013
|
+
"messageContent": messageContent
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
try:
|
|
2017
|
+
response = requests.post(url,headers=headers,json=body).json()
|
|
2018
|
+
auto_reply_id = response["data"]["id"]
|
|
2019
|
+
return auto_reply_id
|
|
2020
|
+
except Exception:
|
|
2021
|
+
print("创建自动回复失败:",response)
|
|
2022
|
+
|
|
2023
|
+
def enable_auto_reply(data):
|
|
2024
|
+
global response
|
|
2025
|
+
env = data["env"]
|
|
2026
|
+
headers = data["headers"]
|
|
2027
|
+
sales_id = data["sales_id"]
|
|
2028
|
+
auto_reply_id = data["auto_reply_id"]
|
|
2029
|
+
status = True
|
|
2030
|
+
status = data.get("status",status)
|
|
2031
|
+
url = "%s/api/posts/post/sales/%s/auto_reply/%s/switch"%(env,sales_id,auto_reply_id)
|
|
2032
|
+
body = {
|
|
2033
|
+
"status": status
|
|
2034
|
+
}
|
|
2035
|
+
try:
|
|
2036
|
+
response = requests.put(url,headers=headers,json=body).json()
|
|
2037
|
+
except Exception:
|
|
2038
|
+
print("更改自动回复状态失败:",response)
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
def edit_auto_reply(data):
|
|
2042
|
+
global response
|
|
2043
|
+
env = data["env"]
|
|
2044
|
+
headers = data["headers"]
|
|
2045
|
+
sales_id = data["sales_id"]
|
|
2046
|
+
auto_reply_id = data["auto_reply_id"]
|
|
2047
|
+
url = "%s/api/posts/post/sales/%s/auto_reply"%(env,sales_id)
|
|
2048
|
+
stamp = int(time.time())
|
|
2049
|
+
name = "自动回复工具名称%d"%stamp
|
|
2050
|
+
keyword_type = "ANY"
|
|
2051
|
+
mode = "BASIC"
|
|
2052
|
+
keywords = ["自动回复关键字%d"%stamp]
|
|
2053
|
+
commentStatus = True
|
|
2054
|
+
messageStatus = True
|
|
2055
|
+
commentContent = "留言回复内容%d"%stamp
|
|
2056
|
+
messageContent = "私讯回复内容%d" % stamp
|
|
2057
|
+
name = data.get("name",name)
|
|
2058
|
+
keyword_type = data.get("keyword_type", keyword_type)
|
|
2059
|
+
mode = data.get("mode", mode)
|
|
2060
|
+
keywords = data.get("keywords", keywords)
|
|
2061
|
+
commentStatus = data.get("commentStatus", commentStatus)
|
|
2062
|
+
messageStatus = data.get("messageStatus", messageStatus)
|
|
2063
|
+
commentContent = data.get("commentContent", commentContent)
|
|
2064
|
+
messageContent = data.get("messageContent", messageContent)
|
|
2065
|
+
body = {
|
|
2066
|
+
"id": auto_reply_id,
|
|
2067
|
+
"name": name,
|
|
2068
|
+
"keywordMatchType": keyword_type,
|
|
2069
|
+
"mode": mode,
|
|
2070
|
+
"status": False,
|
|
2071
|
+
"keywords": [keywords],
|
|
2072
|
+
"answer": {
|
|
2073
|
+
"commentStatus": commentStatus,
|
|
2074
|
+
"messageStatus": messageStatus,
|
|
2075
|
+
"commentContent": commentContent,
|
|
2076
|
+
"messageContent": messageContent
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
try:
|
|
2080
|
+
response = requests.put(url,headers=headers,json=body).json()
|
|
2081
|
+
except Exception:
|
|
2082
|
+
print("编辑自动回复失败:",response)
|
|
2083
|
+
|
|
2084
|
+
|
|
2085
|
+
def delete_auto_reply(data):
|
|
2086
|
+
global response
|
|
2087
|
+
env = data["env"]
|
|
2088
|
+
headers = data["headers"]
|
|
2089
|
+
sales_id = data["sales_id"]
|
|
2090
|
+
auto_reply_id = data["auto_reply_id"]
|
|
2091
|
+
url = "%s/api/posts/post/sales/%s/auto_reply"%(env,sales_id)
|
|
2092
|
+
body = {
|
|
2093
|
+
"id": auto_reply_id
|
|
2094
|
+
}
|
|
2095
|
+
try:
|
|
2096
|
+
response = requests.delete(url,headers=headers,json=body).json()
|
|
2097
|
+
except Exception:
|
|
2098
|
+
print("删除自动回复状态失败:",response)
|
|
2099
|
+
|
|
2100
|
+
def handler_auto_reply(data):
|
|
2101
|
+
"""处理自动回复,避免超过10个,超过10个无法新增"""
|
|
2102
|
+
live_info = get_live_info(data)
|
|
2103
|
+
autoReplyCommentConfig = live_info["data"]["autoReplyCommentConfig"]["rules"]
|
|
2104
|
+
num = data.get("num",8)
|
|
2105
|
+
if len(autoReplyCommentConfig)>num:
|
|
2106
|
+
for info in autoReplyCommentConfig:
|
|
2107
|
+
auto_reply_id = info["id"]
|
|
2108
|
+
data["auto_reply_id"] = auto_reply_id
|
|
2109
|
+
delete_auto_reply(data)
|
|
2110
|
+
|
|
2111
|
+
|
|
2112
|
+
|
|
2113
|
+
|
|
2114
|
+
|
|
2000
2115
|
|
|
2001
2116
|
|
|
2002
2117
|
if __name__=="__main__":
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
sales_id= create_live(data)
|
|
2006
|
-
data["sales_id"] = sales_id
|
|
2007
|
-
delete_relate_post(data)
|
|
2118
|
+
pass
|
|
2119
|
+
|
|
2008
2120
|
|
|
2009
2121
|
|
|
2010
2122
|
|
{sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface/PostCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc_common_interface-2.7.0 → sc_common_interface-2.7.2}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|