sc-common-interface 2.4.6__tar.gz → 2.4.8__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.6 → sc-common-interface-2.4.8}/PKG-INFO +1 -1
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface/LiveCommonInterface.py +199 -23
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface/PostCommonInterface.py +46 -8
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/setup.py +1 -1
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface/McCommonInterface.py +0 -0
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface/Platform.py +0 -0
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface/__init__.py +0 -0
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/setup.cfg +0 -0
{sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -282,7 +282,7 @@ def live_search_oa_product(data):
|
|
|
282
282
|
"""
|
|
283
283
|
env = data["env"]
|
|
284
284
|
headers = data["headers"]
|
|
285
|
-
url = "%s/openApi/proxy/v1/products?page=1&per_page=
|
|
285
|
+
url = "%s/openApi/proxy/v1/products?page=1&per_page=50" %env
|
|
286
286
|
type = "spu"
|
|
287
287
|
quantity = 100
|
|
288
288
|
if "type" in data:
|
|
@@ -469,10 +469,8 @@ def create_live(data):
|
|
|
469
469
|
salesOwner = data["salesOwner"]
|
|
470
470
|
if "platform" in data:
|
|
471
471
|
platform = data["platform"]
|
|
472
|
-
|
|
473
472
|
if "patternModel" in data:
|
|
474
473
|
patternModel = data["patternModel"]
|
|
475
|
-
|
|
476
474
|
if "keywordValidInLive" in data:
|
|
477
475
|
keywordValidInLive = data["keywordValidInLive"]
|
|
478
476
|
if "keywordValidAfterLive" in data:
|
|
@@ -583,20 +581,6 @@ def create_live(data):
|
|
|
583
581
|
platformSubType = platform.split("&")[0].upper()
|
|
584
582
|
data["platform"] = "FACEBOOK"
|
|
585
583
|
res = get_channel(data)
|
|
586
|
-
# expireTime = res["data"][0]["expireTime"]
|
|
587
|
-
# expireTimeTimestamp = res["data"][0]["expireTimeTimestamp"]
|
|
588
|
-
# validToken = res["data"][0]["validToken"]
|
|
589
|
-
# validScope = res["data"][0]["validScope"]
|
|
590
|
-
# oneTimeNotifyStatus = res["data"][0]["oneTimeNotifyStatus"]
|
|
591
|
-
# mainChannel = res["data"][0]["mainChannel"]
|
|
592
|
-
# platformChannelAvatar = res["data"][0]["platformChannelAvatar"]
|
|
593
|
-
# platformChannelId = res["data"][0]["platformChannelId"]
|
|
594
|
-
# parentChannelId = res["data"][0]["parentChannelId"]
|
|
595
|
-
# groupId = res["data"][0]["groupId"]
|
|
596
|
-
# platformChannelName = res["data"][0]["platformChannelName"]
|
|
597
|
-
# privacy = res["data"][0]["privacy"]
|
|
598
|
-
# customerAuthLink = res["data"][0]["customerAuthLink"]
|
|
599
|
-
# subscribedStatus = res["data"][0]["subscribedStatus"]
|
|
600
584
|
body = {
|
|
601
585
|
"sales": {
|
|
602
586
|
"title": title,
|
|
@@ -684,8 +668,47 @@ def create_live(data):
|
|
|
684
668
|
}
|
|
685
669
|
}
|
|
686
670
|
}
|
|
671
|
+
elif platform in ("pl","obc"):
|
|
672
|
+
platformSubType = platform.upper()
|
|
673
|
+
platform = "SHOPLINE"
|
|
674
|
+
body = {
|
|
675
|
+
"sales": {
|
|
676
|
+
"title": title,
|
|
677
|
+
"salesOwner": salesOwner,
|
|
678
|
+
"salesDescription": salesDescription,
|
|
679
|
+
"platforms": [
|
|
680
|
+
platform
|
|
681
|
+
],
|
|
682
|
+
"platformChannels": [],
|
|
683
|
+
"startTime": startTime,
|
|
684
|
+
"endTime": endTime,
|
|
685
|
+
"platformSubType":platformSubType
|
|
686
|
+
},
|
|
687
|
+
"salesConfig": {
|
|
688
|
+
"patternModel": {
|
|
689
|
+
"patternModel": patternModel,
|
|
690
|
+
"keywordValidInLive": keywordValidInLive,
|
|
691
|
+
"keywordValidAfterLive": keywordValidAfterLive
|
|
692
|
+
},
|
|
693
|
+
"autoNotifyPay": {
|
|
694
|
+
"enable": autoNotifyPayEnable,
|
|
695
|
+
"message": autoNotifyPayMessage,
|
|
696
|
+
"button": autoNotifyPayButton
|
|
697
|
+
},
|
|
698
|
+
"stock": {
|
|
699
|
+
"lockStock": stockEnable,
|
|
700
|
+
"salesStockLockExpireTime": stockIime
|
|
701
|
+
},
|
|
702
|
+
"lowOfQuantity": {
|
|
703
|
+
"enable": lowOfQuantityEnable,
|
|
704
|
+
"sound": lowOfQuantitySound,
|
|
705
|
+
"quantity": lowOfQuantityQuantity
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
"postConfigMap":{}
|
|
709
|
+
}
|
|
687
710
|
response = requests.post(url,headers=headers,json=body).json()
|
|
688
|
-
print(json.dumps(body))
|
|
711
|
+
# print(json.dumps(body))
|
|
689
712
|
print(response)
|
|
690
713
|
sales_id = response["data"]["sales"]["id"]
|
|
691
714
|
return sales_id
|
|
@@ -719,7 +742,10 @@ def get_live_info(data):
|
|
|
719
742
|
return response
|
|
720
743
|
|
|
721
744
|
def edit_live_info(data):
|
|
722
|
-
"""
|
|
745
|
+
"""
|
|
746
|
+
直播前编辑直播间信息:prepare
|
|
747
|
+
直播中编辑直播间信息:progress
|
|
748
|
+
"""
|
|
723
749
|
stamp = int(time.time())
|
|
724
750
|
env = data["env"]
|
|
725
751
|
headers = data["headers"]
|
|
@@ -762,7 +788,9 @@ def edit_live_info(data):
|
|
|
762
788
|
productRecommendMessage = ""
|
|
763
789
|
productRecommendMessageEnable = True
|
|
764
790
|
platform = "FB_GROUP"
|
|
765
|
-
|
|
791
|
+
type = "prepare"
|
|
792
|
+
if "type" in data:
|
|
793
|
+
type = data["type"]
|
|
766
794
|
if "title" in data:
|
|
767
795
|
title = data["title"]
|
|
768
796
|
if "salesDescription" in data:
|
|
@@ -839,6 +867,32 @@ def edit_live_info(data):
|
|
|
839
867
|
productRecommendMessage = data["productRecommendMessage"]
|
|
840
868
|
if "productRecommendMessageEnable" in data:
|
|
841
869
|
productRecommendMessageEnable = data["productRecommendMessageEnable"]
|
|
870
|
+
platformChannels = []
|
|
871
|
+
startTime = None
|
|
872
|
+
endTime = None
|
|
873
|
+
if type=="progress":
|
|
874
|
+
#进行中不允许修改基础设置、关键子下单设置、保留库存、
|
|
875
|
+
res = get_live_info(data)
|
|
876
|
+
title = res["data"]["sales"]["post_sales_title"]
|
|
877
|
+
salesOwner = res["data"]["sales"]["post_sales_owner"]
|
|
878
|
+
salesDescription = res["data"]["sales"]["post_sales_title"]
|
|
879
|
+
patternModel = res["data"]["salesConfig"]["patternModel"]["patternModel"]
|
|
880
|
+
keywordValidInLive = res["data"]["salesConfig"]["patternModel"]["keywordValidInLive"]
|
|
881
|
+
keywordValidAfterLive = res["data"]["salesConfig"]["patternModel"]["keywordValidAfterLive"]
|
|
882
|
+
if "start_time_timestamp" in res["data"]["sales"]:
|
|
883
|
+
startTime = res["data"]["sales"]["start_time_timestamp"]
|
|
884
|
+
if "end_time_timestamp" in res["data"]["sales"]:
|
|
885
|
+
endTime = res["data"]["sales"]["end_time_timestamp"]
|
|
886
|
+
relatedPostList = res["data"]["relatedPostList"]
|
|
887
|
+
for relatedPost in relatedPostList:
|
|
888
|
+
platformChannelName = relatedPost["page_name"]
|
|
889
|
+
platformChannelId = relatedPost["page_id"]
|
|
890
|
+
platformChannel = {
|
|
891
|
+
"platformChannelName": platformChannelName,
|
|
892
|
+
"platformChannelId": platformChannelId,
|
|
893
|
+
"platform": platform
|
|
894
|
+
}
|
|
895
|
+
platformChannels.append(platformChannel)
|
|
842
896
|
|
|
843
897
|
body = {}
|
|
844
898
|
if platform.upper()=="FB_GROUP":
|
|
@@ -959,9 +1013,126 @@ def edit_live_info(data):
|
|
|
959
1013
|
}
|
|
960
1014
|
}
|
|
961
1015
|
}
|
|
1016
|
+
elif platform.lower() in ("facebook","instagram"):
|
|
1017
|
+
body = {
|
|
1018
|
+
"sales": {
|
|
1019
|
+
"title": title,
|
|
1020
|
+
"salesOwner": salesOwner,
|
|
1021
|
+
"salesDescription": salesDescription,
|
|
1022
|
+
"platforms": [
|
|
1023
|
+
platform
|
|
1024
|
+
],
|
|
1025
|
+
"platformSubType": "",
|
|
1026
|
+
"platformChannels": platformChannels,
|
|
1027
|
+
"archivedStreamVisibleTime": None,
|
|
1028
|
+
"startTime":startTime,
|
|
1029
|
+
"endtTime":endTime
|
|
1030
|
+
},
|
|
1031
|
+
"salesConfig": {
|
|
1032
|
+
"patternModel": {
|
|
1033
|
+
"patternModel": patternModel,
|
|
1034
|
+
"keywordValidInLive": keywordValidInLive,
|
|
1035
|
+
"keywordValidAfterLive": keywordValidAfterLive
|
|
1036
|
+
},
|
|
1037
|
+
"autoNotifyPay": {
|
|
1038
|
+
"enable": autoNotifyPayEnable,
|
|
1039
|
+
"notifyTime": autoNotifyPayTime,
|
|
1040
|
+
"message": autoNotifyPayMessage,
|
|
1041
|
+
"button": autoNotifyPayButton
|
|
1042
|
+
},
|
|
1043
|
+
"stock": {
|
|
1044
|
+
"lockStock": stockEnable,
|
|
1045
|
+
"salesStockLockExpireTime": stockExpireTime,
|
|
1046
|
+
"salesStockLockPreTime": stockPreTime
|
|
1047
|
+
},
|
|
1048
|
+
"commentIntent": {
|
|
1049
|
+
"enabled": commentIntent
|
|
1050
|
+
},
|
|
1051
|
+
"variationToggleOn": {
|
|
1052
|
+
"enable": True
|
|
1053
|
+
},
|
|
1054
|
+
"productSort": {
|
|
1055
|
+
"productSort": "NEW_TO_OLD"
|
|
1056
|
+
},
|
|
1057
|
+
"lowOfQuantity": {
|
|
1058
|
+
"enable": lowOfQuantityEnable,
|
|
1059
|
+
"sound": lowOfQuantitySound,
|
|
1060
|
+
"quantity": lowOfQuantityQuantity
|
|
1061
|
+
},
|
|
1062
|
+
"notice": None,
|
|
1063
|
+
"frontLive": None,
|
|
1064
|
+
"liveViewSdk": None,
|
|
1065
|
+
"runningLightsConfig": None,
|
|
1066
|
+
"fbGroupSettingConfig": None,
|
|
1067
|
+
"productPinningStyle": None
|
|
1068
|
+
},
|
|
1069
|
+
"postConfigMap": {
|
|
1070
|
+
"FACEBOOK": {
|
|
1071
|
+
"message": {
|
|
1072
|
+
"needSendMessage": need_send_message,
|
|
1073
|
+
"hasInteractionMessage": {
|
|
1074
|
+
"firstMessageTemplate": {
|
|
1075
|
+
"topMessage": has_interaction_message
|
|
1076
|
+
},
|
|
1077
|
+
"messageButton": has_interaction_message_button
|
|
1078
|
+
},
|
|
1079
|
+
"hasLink": has_link,
|
|
1080
|
+
"noInteractionMessage": {
|
|
1081
|
+
"firstMessageTemplate": {
|
|
1082
|
+
"topMessage": no_interaction_message_first
|
|
1083
|
+
},
|
|
1084
|
+
"firstMessageButton": first_message_button,
|
|
1085
|
+
"secondMessageTemplate": {
|
|
1086
|
+
"topMessage": second_message
|
|
1087
|
+
},
|
|
1088
|
+
"secondMessageButton": second_message_button
|
|
1089
|
+
},
|
|
1090
|
+
"messageType": "MESSAGE"
|
|
1091
|
+
},
|
|
1092
|
+
"allOutOfStockMessage": {
|
|
1093
|
+
"needSendMessage": allOutOfStockEnable,
|
|
1094
|
+
"hasInteractionMessage": {
|
|
1095
|
+
"firstMessageTemplate": {
|
|
1096
|
+
"topMessage": allOutOfStockMessage
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
"messageType": "ALL_OUT_OF_STOCK"
|
|
1100
|
+
},
|
|
1101
|
+
"welcomeMessage": {
|
|
1102
|
+
"needSendMessage": welcomeMessageEnable,
|
|
1103
|
+
"hasInteractionMessage": {
|
|
1104
|
+
"firstMessageTemplate": {
|
|
1105
|
+
"topMessage": welcomeMessage
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
1108
|
+
"messageType": "WELCOME_MESSAGE"
|
|
1109
|
+
},
|
|
1110
|
+
"productRecommendMessage": {
|
|
1111
|
+
"needSendMessage": productRecommendMessageEnable,
|
|
1112
|
+
"hasInteractionMessage": {
|
|
1113
|
+
"firstMessageTemplate": {
|
|
1114
|
+
"message": productRecommendMessage
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1117
|
+
"messageType": "PRODUCT_RECOMMEND_FB_MESSAGE"
|
|
1118
|
+
},
|
|
1119
|
+
"welcomeMessageComment": {
|
|
1120
|
+
"needSendMessage": welcomeCommentEnable,
|
|
1121
|
+
"hasInteractionMessage": {
|
|
1122
|
+
"firstMessageTemplate": {
|
|
1123
|
+
"topMessage": welcomeComment
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1126
|
+
"messageType": "WELCOME_MESSAGE_COMMENT"
|
|
1127
|
+
},
|
|
1128
|
+
"showNumberOfViewers": None,
|
|
1129
|
+
"showShareButton": None
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
response = requests.put(url,headers=headers,json=body).json()
|
|
1134
|
+
return response
|
|
962
1135
|
|
|
963
|
-
response = requests.put(url,headers=headers,json=body).json()
|
|
964
|
-
return response
|
|
965
1136
|
|
|
966
1137
|
def save_global_config(data):
|
|
967
1138
|
"保存直播间通用配置"
|
|
@@ -1242,6 +1413,7 @@ def save_global_config(data):
|
|
|
1242
1413
|
response = requests.post(url, headers=headers, json=body).json()
|
|
1243
1414
|
return response
|
|
1244
1415
|
|
|
1416
|
+
|
|
1245
1417
|
def get_global_config(data):
|
|
1246
1418
|
env = data["env"]
|
|
1247
1419
|
headers = data["headers"]
|
|
@@ -1276,4 +1448,8 @@ def remove_live_product(data):
|
|
|
1276
1448
|
|
|
1277
1449
|
|
|
1278
1450
|
if __name__=="__main__":
|
|
1279
|
-
|
|
1451
|
+
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}
|
|
1452
|
+
data['type'] = "progress"
|
|
1453
|
+
res = edit_live_info(data)
|
|
1454
|
+
|
|
1455
|
+
print(res)
|
{sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/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
|
|
|
@@ -1252,30 +1253,67 @@ def modelone_create_mutil_product(data):
|
|
|
1252
1253
|
keyword = data["keyword"]
|
|
1253
1254
|
variance = {"color":["红","黄"],"size":["X","M"]}
|
|
1254
1255
|
if "variance" in data:
|
|
1255
|
-
|
|
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"]
|
|
1256
1263
|
customVariantTypes = []
|
|
1257
1264
|
variantOptions = []
|
|
1258
1265
|
variations = []
|
|
1259
1266
|
variance_type = variance.keys()
|
|
1267
|
+
# print(variance_type)
|
|
1260
1268
|
custom_keys = []
|
|
1261
1269
|
for index,value in enumerate(variance_type):
|
|
1270
|
+
# print(value)
|
|
1262
1271
|
customVariantType = {}
|
|
1263
|
-
|
|
1272
|
+
type = "custom_%d"%(index+1)
|
|
1273
|
+
customVariantType["type"] = type
|
|
1264
1274
|
customVariantType["name"] = value
|
|
1265
1275
|
customVariantTypes.append(customVariantType)
|
|
1266
1276
|
variance_names = variance[value]
|
|
1277
|
+
# print(variance_names)
|
|
1267
1278
|
custom_key = []
|
|
1268
1279
|
for index,value in enumerate(variance_names):
|
|
1269
1280
|
variantOption = {}
|
|
1270
|
-
variantOption["type"] =
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
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"])
|
|
1274
1285
|
variantOptions.append(variantOption)
|
|
1275
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)
|
|
1276
1304
|
|
|
1277
|
-
|
|
1278
|
-
|
|
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
|
|
1279
1317
|
|
|
1280
1318
|
def get_mc_post(data):
|
|
1281
1319
|
"""
|
{sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc-common-interface-2.4.6 → sc-common-interface-2.4.8}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|