sc-common-interface 2.4.5__tar.gz → 2.4.7__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.4.5 → sc-common-interface-2.4.7}/PKG-INFO +1 -1
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface/LiveCommonInterface.py +158 -5
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface/PostCommonInterface.py +51 -10
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/setup.py +1 -1
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface/McCommonInterface.py +0 -0
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface/Platform.py +0 -0
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface/__init__.py +0 -0
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/setup.cfg +0 -0
{sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -719,7 +719,10 @@ def get_live_info(data):
|
|
|
719
719
|
return response
|
|
720
720
|
|
|
721
721
|
def edit_live_info(data):
|
|
722
|
-
"""
|
|
722
|
+
"""
|
|
723
|
+
直播前编辑直播间信息:prepare
|
|
724
|
+
直播中编辑直播间信息:progress
|
|
725
|
+
"""
|
|
723
726
|
stamp = int(time.time())
|
|
724
727
|
env = data["env"]
|
|
725
728
|
headers = data["headers"]
|
|
@@ -762,7 +765,9 @@ def edit_live_info(data):
|
|
|
762
765
|
productRecommendMessage = ""
|
|
763
766
|
productRecommendMessageEnable = True
|
|
764
767
|
platform = "FB_GROUP"
|
|
765
|
-
|
|
768
|
+
type = "prepare"
|
|
769
|
+
if "type" in data:
|
|
770
|
+
type = data["type"]
|
|
766
771
|
if "title" in data:
|
|
767
772
|
title = data["title"]
|
|
768
773
|
if "salesDescription" in data:
|
|
@@ -839,6 +844,32 @@ def edit_live_info(data):
|
|
|
839
844
|
productRecommendMessage = data["productRecommendMessage"]
|
|
840
845
|
if "productRecommendMessageEnable" in data:
|
|
841
846
|
productRecommendMessageEnable = data["productRecommendMessageEnable"]
|
|
847
|
+
platformChannels = []
|
|
848
|
+
startTime = None
|
|
849
|
+
endTime = None
|
|
850
|
+
if type=="progress":
|
|
851
|
+
#进行中不允许修改基础设置、关键子下单设置、保留库存、
|
|
852
|
+
res = get_live_info(data)
|
|
853
|
+
title = res["data"]["sales"]["post_sales_title"]
|
|
854
|
+
salesOwner = res["data"]["sales"]["post_sales_owner"]
|
|
855
|
+
salesDescription = res["data"]["sales"]["post_sales_title"]
|
|
856
|
+
patternModel = res["data"]["salesConfig"]["patternModel"]["patternModel"]
|
|
857
|
+
keywordValidInLive = res["data"]["salesConfig"]["patternModel"]["keywordValidInLive"]
|
|
858
|
+
keywordValidAfterLive = res["data"]["salesConfig"]["patternModel"]["keywordValidAfterLive"]
|
|
859
|
+
if "start_time_timestamp" in res["data"]["sales"]:
|
|
860
|
+
startTime = res["data"]["sales"]["start_time_timestamp"]
|
|
861
|
+
if "end_time_timestamp" in res["data"]["sales"]:
|
|
862
|
+
endTime = res["data"]["sales"]["end_time_timestamp"]
|
|
863
|
+
relatedPostList = res["data"]["relatedPostList"]
|
|
864
|
+
for relatedPost in relatedPostList:
|
|
865
|
+
platformChannelName = relatedPost["page_name"]
|
|
866
|
+
platformChannelId = relatedPost["page_id"]
|
|
867
|
+
platformChannel = {
|
|
868
|
+
"platformChannelName": platformChannelName,
|
|
869
|
+
"platformChannelId": platformChannelId,
|
|
870
|
+
"platform": platform
|
|
871
|
+
}
|
|
872
|
+
platformChannels.append(platformChannel)
|
|
842
873
|
|
|
843
874
|
body = {}
|
|
844
875
|
if platform.upper()=="FB_GROUP":
|
|
@@ -959,9 +990,126 @@ def edit_live_info(data):
|
|
|
959
990
|
}
|
|
960
991
|
}
|
|
961
992
|
}
|
|
993
|
+
elif platform.lower() in ("facebook","instagram"):
|
|
994
|
+
body = {
|
|
995
|
+
"sales": {
|
|
996
|
+
"title": title,
|
|
997
|
+
"salesOwner": salesOwner,
|
|
998
|
+
"salesDescription": salesDescription,
|
|
999
|
+
"platforms": [
|
|
1000
|
+
platform
|
|
1001
|
+
],
|
|
1002
|
+
"platformSubType": "",
|
|
1003
|
+
"platformChannels": platformChannels,
|
|
1004
|
+
"archivedStreamVisibleTime": None,
|
|
1005
|
+
"startTime":startTime,
|
|
1006
|
+
"endtTime":endTime
|
|
1007
|
+
},
|
|
1008
|
+
"salesConfig": {
|
|
1009
|
+
"patternModel": {
|
|
1010
|
+
"patternModel": patternModel,
|
|
1011
|
+
"keywordValidInLive": keywordValidInLive,
|
|
1012
|
+
"keywordValidAfterLive": keywordValidAfterLive
|
|
1013
|
+
},
|
|
1014
|
+
"autoNotifyPay": {
|
|
1015
|
+
"enable": autoNotifyPayEnable,
|
|
1016
|
+
"notifyTime": autoNotifyPayTime,
|
|
1017
|
+
"message": autoNotifyPayMessage,
|
|
1018
|
+
"button": autoNotifyPayButton
|
|
1019
|
+
},
|
|
1020
|
+
"stock": {
|
|
1021
|
+
"lockStock": stockEnable,
|
|
1022
|
+
"salesStockLockExpireTime": stockExpireTime,
|
|
1023
|
+
"salesStockLockPreTime": stockPreTime
|
|
1024
|
+
},
|
|
1025
|
+
"commentIntent": {
|
|
1026
|
+
"enabled": commentIntent
|
|
1027
|
+
},
|
|
1028
|
+
"variationToggleOn": {
|
|
1029
|
+
"enable": True
|
|
1030
|
+
},
|
|
1031
|
+
"productSort": {
|
|
1032
|
+
"productSort": "NEW_TO_OLD"
|
|
1033
|
+
},
|
|
1034
|
+
"lowOfQuantity": {
|
|
1035
|
+
"enable": lowOfQuantityEnable,
|
|
1036
|
+
"sound": lowOfQuantitySound,
|
|
1037
|
+
"quantity": lowOfQuantityQuantity
|
|
1038
|
+
},
|
|
1039
|
+
"notice": None,
|
|
1040
|
+
"frontLive": None,
|
|
1041
|
+
"liveViewSdk": None,
|
|
1042
|
+
"runningLightsConfig": None,
|
|
1043
|
+
"fbGroupSettingConfig": None,
|
|
1044
|
+
"productPinningStyle": None
|
|
1045
|
+
},
|
|
1046
|
+
"postConfigMap": {
|
|
1047
|
+
"FACEBOOK": {
|
|
1048
|
+
"message": {
|
|
1049
|
+
"needSendMessage": need_send_message,
|
|
1050
|
+
"hasInteractionMessage": {
|
|
1051
|
+
"firstMessageTemplate": {
|
|
1052
|
+
"topMessage": has_interaction_message
|
|
1053
|
+
},
|
|
1054
|
+
"messageButton": has_interaction_message_button
|
|
1055
|
+
},
|
|
1056
|
+
"hasLink": has_link,
|
|
1057
|
+
"noInteractionMessage": {
|
|
1058
|
+
"firstMessageTemplate": {
|
|
1059
|
+
"topMessage": no_interaction_message_first
|
|
1060
|
+
},
|
|
1061
|
+
"firstMessageButton": first_message_button,
|
|
1062
|
+
"secondMessageTemplate": {
|
|
1063
|
+
"topMessage": second_message
|
|
1064
|
+
},
|
|
1065
|
+
"secondMessageButton": second_message_button
|
|
1066
|
+
},
|
|
1067
|
+
"messageType": "MESSAGE"
|
|
1068
|
+
},
|
|
1069
|
+
"allOutOfStockMessage": {
|
|
1070
|
+
"needSendMessage": allOutOfStockEnable,
|
|
1071
|
+
"hasInteractionMessage": {
|
|
1072
|
+
"firstMessageTemplate": {
|
|
1073
|
+
"topMessage": allOutOfStockMessage
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
"messageType": "ALL_OUT_OF_STOCK"
|
|
1077
|
+
},
|
|
1078
|
+
"welcomeMessage": {
|
|
1079
|
+
"needSendMessage": welcomeMessageEnable,
|
|
1080
|
+
"hasInteractionMessage": {
|
|
1081
|
+
"firstMessageTemplate": {
|
|
1082
|
+
"topMessage": welcomeMessage
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
1085
|
+
"messageType": "WELCOME_MESSAGE"
|
|
1086
|
+
},
|
|
1087
|
+
"productRecommendMessage": {
|
|
1088
|
+
"needSendMessage": productRecommendMessageEnable,
|
|
1089
|
+
"hasInteractionMessage": {
|
|
1090
|
+
"firstMessageTemplate": {
|
|
1091
|
+
"message": productRecommendMessage
|
|
1092
|
+
}
|
|
1093
|
+
},
|
|
1094
|
+
"messageType": "PRODUCT_RECOMMEND_FB_MESSAGE"
|
|
1095
|
+
},
|
|
1096
|
+
"welcomeMessageComment": {
|
|
1097
|
+
"needSendMessage": welcomeCommentEnable,
|
|
1098
|
+
"hasInteractionMessage": {
|
|
1099
|
+
"firstMessageTemplate": {
|
|
1100
|
+
"topMessage": welcomeComment
|
|
1101
|
+
}
|
|
1102
|
+
},
|
|
1103
|
+
"messageType": "WELCOME_MESSAGE_COMMENT"
|
|
1104
|
+
},
|
|
1105
|
+
"showNumberOfViewers": None,
|
|
1106
|
+
"showShareButton": None
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
response = requests.put(url,headers=headers,json=body).json()
|
|
1111
|
+
return response
|
|
962
1112
|
|
|
963
|
-
response = requests.put(url,headers=headers,json=body).json()
|
|
964
|
-
return response
|
|
965
1113
|
|
|
966
1114
|
def save_global_config(data):
|
|
967
1115
|
"保存直播间通用配置"
|
|
@@ -1242,6 +1390,7 @@ def save_global_config(data):
|
|
|
1242
1390
|
response = requests.post(url, headers=headers, json=body).json()
|
|
1243
1391
|
return response
|
|
1244
1392
|
|
|
1393
|
+
|
|
1245
1394
|
def get_global_config(data):
|
|
1246
1395
|
env = data["env"]
|
|
1247
1396
|
headers = data["headers"]
|
|
@@ -1276,4 +1425,8 @@ def remove_live_product(data):
|
|
|
1276
1425
|
|
|
1277
1426
|
|
|
1278
1427
|
if __name__=="__main__":
|
|
1279
|
-
|
|
1428
|
+
data = {'env': 'https://front-admin-preview.shoplineapp.com', 'headers': {'Content-Type': 'application/json', 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIwNmUxNGU2NzAxMWY0ZDNhMGU0ZDgyNDk3ZDAxYmQwZSIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjVmNTlmMTI4MzcyZWIzMDAwNmRjNDcwMSJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.gUqa8FJs_vjRJ-kFMhOZx42QtCr7XxcN3gKSK6_4Zvs', 'lang': 'en'}, 'platform': 'FACEBOOK', 'sales_id': 517320}
|
|
1429
|
+
data['type'] = "progress"
|
|
1430
|
+
res = edit_live_info(data)
|
|
1431
|
+
|
|
1432
|
+
print(res)
|
{sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface/PostCommonInterface.py
RENAMED
|
@@ -8,6 +8,7 @@ import hmac
|
|
|
8
8
|
from hashlib import sha1
|
|
9
9
|
import random
|
|
10
10
|
# from Platform import Platform
|
|
11
|
+
import itertools
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
|
|
@@ -846,8 +847,11 @@ def get_comment_user(data):
|
|
|
846
847
|
env = data["env"]
|
|
847
848
|
headers = data["headers"]
|
|
848
849
|
sales_id = data["sales_id"]
|
|
849
|
-
url = "%s/api/posts/post/comments"%env
|
|
850
850
|
params = {"pageNo":1,"pageSize":10,"salesId":sales_id}
|
|
851
|
+
if "query" in data:
|
|
852
|
+
query = data["query"]
|
|
853
|
+
params["query"] = query
|
|
854
|
+
url = "%s/api/posts/post/comments"%env
|
|
851
855
|
response = requests.get(url, headers=headers,params=params).json()
|
|
852
856
|
post_user_id = jsonpath(response, "$..id")[0]
|
|
853
857
|
return post_user_id,response
|
|
@@ -1249,30 +1253,67 @@ def modelone_create_mutil_product(data):
|
|
|
1249
1253
|
keyword = data["keyword"]
|
|
1250
1254
|
variance = {"color":["红","黄"],"size":["X","M"]}
|
|
1251
1255
|
if "variance" in data:
|
|
1252
|
-
|
|
1256
|
+
variance = data["variance"]
|
|
1257
|
+
price = 10
|
|
1258
|
+
if "price" in data:
|
|
1259
|
+
price = data["price"]
|
|
1260
|
+
quantity = 99
|
|
1261
|
+
if "quantity" in data:
|
|
1262
|
+
quantity = data["quantity"]
|
|
1253
1263
|
customVariantTypes = []
|
|
1254
1264
|
variantOptions = []
|
|
1255
1265
|
variations = []
|
|
1256
1266
|
variance_type = variance.keys()
|
|
1267
|
+
# print(variance_type)
|
|
1257
1268
|
custom_keys = []
|
|
1258
1269
|
for index,value in enumerate(variance_type):
|
|
1270
|
+
# print(value)
|
|
1259
1271
|
customVariantType = {}
|
|
1260
|
-
|
|
1272
|
+
type = "custom_%d"%(index+1)
|
|
1273
|
+
customVariantType["type"] = type
|
|
1261
1274
|
customVariantType["name"] = value
|
|
1262
1275
|
customVariantTypes.append(customVariantType)
|
|
1263
1276
|
variance_names = variance[value]
|
|
1277
|
+
# print(variance_names)
|
|
1264
1278
|
custom_key = []
|
|
1265
1279
|
for index,value in enumerate(variance_names):
|
|
1266
1280
|
variantOption = {}
|
|
1267
|
-
variantOption["type"] =
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
custom_key.append(
|
|
1281
|
+
variantOption["type"] = type
|
|
1282
|
+
variantOption["name"] = value
|
|
1283
|
+
variantOption["key"] = "%s_%s_4218"%(type,value)
|
|
1284
|
+
custom_key.append(variantOption["key"])
|
|
1271
1285
|
variantOptions.append(variantOption)
|
|
1272
1286
|
custom_keys.append(custom_key)
|
|
1287
|
+
# print(customVariantTypes)
|
|
1288
|
+
# print(variantOptions)
|
|
1289
|
+
# print(custom_keys)
|
|
1290
|
+
# 生成所有组合
|
|
1291
|
+
combinations = []
|
|
1292
|
+
for i in range(len(custom_keys)):
|
|
1293
|
+
for j in range(i + 1, len(custom_keys)):
|
|
1294
|
+
# 使用 itertools.product 生成每对子数组的组合
|
|
1295
|
+
combinations.extend(itertools.product(custom_keys[i], custom_keys[j]))
|
|
1296
|
+
for i in range(len(combinations)):
|
|
1297
|
+
variantion = {}
|
|
1298
|
+
variantion["price"] = price
|
|
1299
|
+
variantion["quantity"] = quantity
|
|
1300
|
+
variantion["keyList"] = [keyword + "%d" % i]
|
|
1301
|
+
variantion["variantOptionKeys"] = list(combinations[i])
|
|
1302
|
+
variations.append(variantion)
|
|
1303
|
+
# print(variations)
|
|
1273
1304
|
|
|
1274
|
-
|
|
1275
|
-
|
|
1305
|
+
body = {
|
|
1306
|
+
"unlimitedQuantity": False,
|
|
1307
|
+
"productName": product_name,
|
|
1308
|
+
"imageUrl": "https://s3-ap-southeast-1.amazonaws.com/static.shoplineapp.com/sc-admin/product-default.png",
|
|
1309
|
+
"customVariantTypes":customVariantTypes,
|
|
1310
|
+
"variantOptions": variantOptions,
|
|
1311
|
+
"variations": variations,
|
|
1312
|
+
"price": 0
|
|
1313
|
+
}
|
|
1314
|
+
response = requests.post(url, headers=headers, json=body).json()
|
|
1315
|
+
spu_id = response["data"]
|
|
1316
|
+
return spu_id
|
|
1276
1317
|
|
|
1277
1318
|
def get_mc_post(data):
|
|
1278
1319
|
"""
|
|
@@ -1650,4 +1691,4 @@ def edit_message(data):
|
|
|
1650
1691
|
|
|
1651
1692
|
|
|
1652
1693
|
if __name__=="__main__":
|
|
1653
|
-
|
|
1694
|
+
pass
|
{sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc-common-interface-2.4.5 → sc-common-interface-2.4.7}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|