sc-common-interface 2.7.9__tar.gz → 2.8.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.7.9 → sc_common_interface-2.8.1}/PKG-INFO +1 -1
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface/LiveCommonInterface.py +122 -18
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/setup.py +1 -1
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface/CommonOa.py +0 -0
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface/McCommonInterface.py +0 -0
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface/Platform.py +0 -0
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface/PostCommonInterface.py +0 -0
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface/__init__.py +0 -0
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/setup.cfg +0 -0
{sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -99,7 +99,6 @@ def get_sales_id(data):
|
|
|
99
99
|
""""查询返回指定直播间的salse_id
|
|
100
100
|
status:准备中 0,直播中 1 已结束 2 断线中 4
|
|
101
101
|
"""
|
|
102
|
-
|
|
103
102
|
env = data["env"]
|
|
104
103
|
headers = data["headers"]
|
|
105
104
|
url = "%s/api/posts/post/sales"%env
|
|
@@ -362,7 +361,7 @@ def get_live_info(data):
|
|
|
362
361
|
count=count+1
|
|
363
362
|
if count>10:
|
|
364
363
|
print("查询报错:",response)
|
|
365
|
-
return response.
|
|
364
|
+
return response.json()
|
|
366
365
|
|
|
367
366
|
|
|
368
367
|
|
|
@@ -971,14 +970,31 @@ def add_live(data):
|
|
|
971
970
|
headers = data["headers"]
|
|
972
971
|
sales_id = data["sales_id"]
|
|
973
972
|
url = "%s/api/posts/live/sales/%s/addLive"%(env,sales_id)
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
"
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
973
|
+
platform = data.get("platform","FB_GROUP")
|
|
974
|
+
body = {}
|
|
975
|
+
if platform.upper()=="FB_GROUP":
|
|
976
|
+
pageId = data["page_id"]
|
|
977
|
+
relationUrl = data["relationUrl"]
|
|
978
|
+
body = {
|
|
979
|
+
"pageId": pageId,
|
|
980
|
+
"platform": "FB_GROUP",
|
|
981
|
+
"relationUrl": relationUrl
|
|
982
|
+
}
|
|
983
|
+
elif platform.upper()=="FACEBOOK":
|
|
984
|
+
postId = data["post_id"]
|
|
985
|
+
liveVideoId = data["liveVideoId"]
|
|
986
|
+
pageId = data["page_id"]
|
|
987
|
+
pageName = data["page_name"]
|
|
988
|
+
permalinkUrl = data["permalinkUrl"]
|
|
989
|
+
body = {
|
|
990
|
+
"postId": postId,
|
|
991
|
+
"liveVideoId": liveVideoId,
|
|
992
|
+
"pageId": pageId,
|
|
993
|
+
"pageName": pageName,
|
|
994
|
+
"permalinkUrl": permalinkUrl,
|
|
995
|
+
"status": "LIVE",
|
|
996
|
+
"platform": platform.upper()
|
|
997
|
+
}
|
|
982
998
|
response = requests.post(url,headers=headers,json=body).json()
|
|
983
999
|
return response
|
|
984
1000
|
|
|
@@ -1096,7 +1112,7 @@ def edit_live_info(data):
|
|
|
1096
1112
|
platformChannel = {
|
|
1097
1113
|
"platformChannelName": platformChannelName,
|
|
1098
1114
|
"platformChannelId": platformChannelId,
|
|
1099
|
-
"platform": platform
|
|
1115
|
+
"platform": platform.upper()
|
|
1100
1116
|
}
|
|
1101
1117
|
platformChannels.append(platformChannel)
|
|
1102
1118
|
if platform.upper()=="FB_GROUP":
|
|
@@ -1271,7 +1287,7 @@ def edit_live_info(data):
|
|
|
1271
1287
|
"productPinningStyle": None
|
|
1272
1288
|
},
|
|
1273
1289
|
"postConfigMap": {
|
|
1274
|
-
|
|
1290
|
+
platform.upper(): {
|
|
1275
1291
|
"message": {
|
|
1276
1292
|
"needSendMessage": need_send_message,
|
|
1277
1293
|
"hasInteractionMessage": {
|
|
@@ -1334,7 +1350,7 @@ def edit_live_info(data):
|
|
|
1334
1350
|
}
|
|
1335
1351
|
}
|
|
1336
1352
|
}
|
|
1337
|
-
|
|
1353
|
+
print(body)
|
|
1338
1354
|
response = requests.put(url, headers=headers, json=body).json()
|
|
1339
1355
|
return response
|
|
1340
1356
|
|
|
@@ -2113,17 +2129,105 @@ def handler_auto_reply(data):
|
|
|
2113
2129
|
delete_auto_reply(data)
|
|
2114
2130
|
|
|
2115
2131
|
|
|
2132
|
+
def handler_bidding(data):
|
|
2133
|
+
"删除在开启中的竞标活动"
|
|
2134
|
+
env = data["env"]
|
|
2135
|
+
headers = data["headers"]
|
|
2136
|
+
sales_id = data["sales_id"]
|
|
2137
|
+
url = "%s/admin/api/bff-web/live/activity/list/POST/%s"%(env,sales_id)
|
|
2138
|
+
response = requests.get(url,headers=headers)
|
|
2139
|
+
if response.status_code==200:
|
|
2140
|
+
for i in response.json()["data"]:
|
|
2141
|
+
status = i["status"]
|
|
2142
|
+
activity_type = i["type"]
|
|
2143
|
+
if status=="PROGRESS" and activity_type=="BIDDING":
|
|
2144
|
+
activity_id = i["id"]
|
|
2145
|
+
data["activity_id"] = activity_id
|
|
2146
|
+
end_activity(data)
|
|
2147
|
+
time.sleep(1)
|
|
2148
|
+
delate_activity(data)
|
|
2149
|
+
|
|
2150
|
+
|
|
2151
|
+
def check_14_day(data):
|
|
2152
|
+
response = get_live_info(data)
|
|
2153
|
+
start_time_timestamp = response["data"]["sales"]["start_time_timestamp"]
|
|
2154
|
+
# 将毫秒转换为秒
|
|
2155
|
+
start_time_timestamp = start_time_timestamp / 1000
|
|
2156
|
+
# 计算 14 天的秒数
|
|
2157
|
+
fourteen_days_seconds = 13 * 24 * 60 * 60
|
|
2158
|
+
# 获取当前时间戳(秒)
|
|
2159
|
+
current_time_seconds = time.time()
|
|
2160
|
+
flag = False
|
|
2161
|
+
if (current_time_seconds - start_time_timestamp) >= fourteen_days_seconds:
|
|
2162
|
+
flag =True
|
|
2163
|
+
return flag
|
|
2164
|
+
|
|
2165
|
+
def get_fb_sales_id(data):
|
|
2166
|
+
""""查询返回指定直播间的salse_id
|
|
2167
|
+
status:准备中 0,直播中 1 已结束 2 断线中 4
|
|
2168
|
+
"""
|
|
2169
|
+
env = data["env"]
|
|
2170
|
+
headers = data["headers"]
|
|
2171
|
+
url = "%s/api/posts/post/sales"%env
|
|
2172
|
+
param = {"page_num":1,"page_size":100,"sales_type":"LIVE"}
|
|
2173
|
+
platform = data.get("platform","FACEBOOK")
|
|
2174
|
+
param["platforms"] =platform.upper()
|
|
2175
|
+
if "search" in data:
|
|
2176
|
+
search_word = data["search"]
|
|
2177
|
+
param["search_word"] = search_word
|
|
2178
|
+
response = requests.get(url,headers=headers,params=param).json()
|
|
2179
|
+
sales_data = response["data"]["list"]
|
|
2180
|
+
if "status" in data:
|
|
2181
|
+
status = data["status"]
|
|
2182
|
+
for i in sales_data:
|
|
2183
|
+
real_platform = i["platform"]
|
|
2184
|
+
platforms = i["platforms"]
|
|
2185
|
+
post_sale_status = i["post_sale_status"]
|
|
2186
|
+
if real_platform=="SHOPLINE"and platforms==["SHOPLINE", "FACEBOOK"] and post_sale_status in status:
|
|
2187
|
+
sales_id = i["id"]
|
|
2188
|
+
return sales_id
|
|
2189
|
+
elif platform.upper()=="FACEBOOK" and platforms==["FACEBOOK"] and post_sale_status in status:
|
|
2190
|
+
sales_id = i["id"]
|
|
2191
|
+
return sales_id
|
|
2192
|
+
else:
|
|
2193
|
+
if len(sales_data)>0:
|
|
2194
|
+
return sales_data[0]["id"]
|
|
2116
2195
|
|
|
2117
2196
|
|
|
2197
|
+
def get_receipt_sales_id(data):
|
|
2198
|
+
sales_id = data["sales_id"]
|
|
2199
|
+
flag = check_14_day(data)
|
|
2200
|
+
if flag:
|
|
2201
|
+
#先从列表查出一个最新结束的直播间,还是不返回要求再创建直播和链接直播
|
|
2202
|
+
sales_id = get_fb_sales_id(data)
|
|
2203
|
+
data["sales_id"] = sales_id
|
|
2204
|
+
flag2 = check_14_day(data)
|
|
2205
|
+
if flag2:
|
|
2206
|
+
# 超过14天,创建一个直播间,并串接,然后结束直播
|
|
2207
|
+
data["platform"] = "FACEBOOK"
|
|
2208
|
+
sales_id = create_live(data)
|
|
2209
|
+
# 串接
|
|
2210
|
+
#先删除已被删除的
|
|
2211
|
+
delete_relate_post(data)
|
|
2212
|
+
time.sleep(2)
|
|
2213
|
+
data["sales_id"] = sales_id
|
|
2214
|
+
add_live(data)
|
|
2215
|
+
# 结束直播
|
|
2216
|
+
end_live(data)
|
|
2217
|
+
return sales_id
|
|
2218
|
+
else:
|
|
2219
|
+
return sales_id
|
|
2118
2220
|
|
|
2119
2221
|
|
|
2120
2222
|
|
|
2121
2223
|
if __name__=="__main__":
|
|
2122
|
-
data = {'env': 'https://front-
|
|
2123
|
-
data["
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2224
|
+
data = {'env': 'https://front-service.shoplinestg.com', 'headers': {'Content-Type': 'application/json', 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIwMzkzZTdlODQ2MDMzZmUyOTViMjllY2I1OWVjOTgwOSIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MjI5YTdiYWVhNzA2NDJhOGI2NWViZGEiLCJhcHBsaWNhdGlvbl9pZCI6IjYwZWVjNWViZjhkYzkyMDAwNjUyZTAwNiJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMteXkuc2hvcGxpbmVzdGcuY29tIiwiYXVkIjpbXSwic3ViIjoiNjIyOWE3YmFlYTcwNjQyYThiNjVlYmRhIn0.pKkJD01uFDUfiVR2gBJQFd_EtIvQkHR2ScJzRTTOxxg', 'lang': 'en'}}
|
|
2225
|
+
data["sales_id"] = 89356
|
|
2226
|
+
data["status"] = [2]
|
|
2227
|
+
river_receipt_info = {"post_id": "110842575060695_2328744727508810","liveVideoId": "606297275523823", "page_id": "110842575060695", "page_name": "新世界", "permalinkUrl": "https://www.facebook.com/110842575060695/videos/2328744727508810" }
|
|
2228
|
+
data.update(river_receipt_info)
|
|
2229
|
+
sales_id = get_receipt_sales_id(data)
|
|
2230
|
+
print(sales_id)
|
|
2127
2231
|
|
|
2128
2232
|
|
|
2129
2233
|
|
|
File without changes
|
{sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface/PostCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc_common_interface-2.7.9 → sc_common_interface-2.8.1}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|