sc-common-interface 2.7.6__tar.gz → 2.7.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.7.6 → sc_common_interface-2.7.7}/PKG-INFO +1 -1
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface/LiveCommonInterface.py +104 -5
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/setup.py +1 -1
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface/McCommonInterface.py +0 -0
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface/Platform.py +0 -0
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface/PostCommonInterface.py +0 -0
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface/__init__.py +0 -0
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/setup.cfg +0 -0
{sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import re
|
|
3
|
-
|
|
4
3
|
import requests
|
|
5
4
|
import json
|
|
6
5
|
from jsonpath import jsonpath
|
|
@@ -9,6 +8,7 @@ import random
|
|
|
9
8
|
import hmac
|
|
10
9
|
from hashlib import sha1
|
|
11
10
|
import random
|
|
11
|
+
from datetime import datetime
|
|
12
12
|
|
|
13
13
|
def delete_post(data):
|
|
14
14
|
env = data["env"]
|
|
@@ -150,7 +150,7 @@ def create_activity(data):
|
|
|
150
150
|
headers = data["headers"]
|
|
151
151
|
body = data["body"]
|
|
152
152
|
sales_id = data["sales_id"]
|
|
153
|
-
url = "%s/api/
|
|
153
|
+
url = "%s/admin/api/bff-web/live/activity/%s"%(env,sales_id)
|
|
154
154
|
platform = "FACEBOOK"
|
|
155
155
|
if "platform" in data:
|
|
156
156
|
platform = data["platform"].upper()
|
|
@@ -650,7 +650,6 @@ def create_live(data):
|
|
|
650
650
|
need_send_message = data.get("need_send_message", need_send_message)
|
|
651
651
|
has_link = data.get("has_link", has_link)
|
|
652
652
|
|
|
653
|
-
|
|
654
653
|
body = {}
|
|
655
654
|
if platform.lower() in ("fb_group","facebook","instagram"):
|
|
656
655
|
body = {
|
|
@@ -842,6 +841,83 @@ def create_live(data):
|
|
|
842
841
|
},
|
|
843
842
|
"postConfigMap":{}
|
|
844
843
|
}
|
|
844
|
+
elif platform.lower in ("line&pl","line&obc","pl&line","obc&line"):
|
|
845
|
+
shopId, platformChannelId, platformChannelName, response = get_line_info(data)
|
|
846
|
+
if platform.lower in ("line&pl","pl&line"):
|
|
847
|
+
type = "PL"
|
|
848
|
+
else:
|
|
849
|
+
type = "OBC"
|
|
850
|
+
needArchive = data.get("needArchive",True)
|
|
851
|
+
visibleTime = data.get("visibleTime",get_stamp_time(**{"days":60}))
|
|
852
|
+
startTime = data.get("startTime",get_stamp_time(**{"minutes":1}))
|
|
853
|
+
endTime = data.get("startTime", get_stamp_time(**{"minutes": 2}))
|
|
854
|
+
body = {
|
|
855
|
+
"sales": {
|
|
856
|
+
"title": title,
|
|
857
|
+
"salesOwner": salesOwner,
|
|
858
|
+
"salesDescription": salesDescription,
|
|
859
|
+
"platforms": [
|
|
860
|
+
"LINE"
|
|
861
|
+
],
|
|
862
|
+
"platformSubType": type,
|
|
863
|
+
"platformChannels": [
|
|
864
|
+
{
|
|
865
|
+
"platform": "LINE",
|
|
866
|
+
"platformChannelName": shopId,
|
|
867
|
+
"platformChannelId": shopId
|
|
868
|
+
}
|
|
869
|
+
],
|
|
870
|
+
"coverImage": "https://img.shoplineapp.com/media/image_clips/67a5678419ad34003b97243c/original.jpeg?1738893188",
|
|
871
|
+
"startTime": startTime,
|
|
872
|
+
"endTime": endTime,
|
|
873
|
+
"archivedStreamVisibleTime": visibleTime,
|
|
874
|
+
"needArchive": needArchive
|
|
875
|
+
},
|
|
876
|
+
"salesConfig": {
|
|
877
|
+
"patternModel": {
|
|
878
|
+
"patternModel": patternModel,
|
|
879
|
+
"keywordValidInLive": keywordValidInLive,
|
|
880
|
+
"keywordValidAfterLive": keywordValidAfterLive
|
|
881
|
+
},
|
|
882
|
+
"autoNotifyPay": {
|
|
883
|
+
"enable": False
|
|
884
|
+
},
|
|
885
|
+
"stock": {
|
|
886
|
+
"lockStock": stockEnable,
|
|
887
|
+
"salesStockLockExpireTime": stockExpireTime
|
|
888
|
+
},
|
|
889
|
+
"lowOfQuantity": {
|
|
890
|
+
"enable": False,
|
|
891
|
+
"sound": False
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
"postConfigMap": {
|
|
895
|
+
"LINE": {
|
|
896
|
+
"message": {
|
|
897
|
+
"needSendMessage": False,
|
|
898
|
+
"hasInteractionMessage": {
|
|
899
|
+
"firstMessageTemplate": {
|
|
900
|
+
"topMessage": ""
|
|
901
|
+
},
|
|
902
|
+
"messageButton": ""
|
|
903
|
+
},
|
|
904
|
+
"hasLink": True,
|
|
905
|
+
"noInteractionMessage": {
|
|
906
|
+
"firstMessageTemplate": {
|
|
907
|
+
"topMessage": ""
|
|
908
|
+
},
|
|
909
|
+
"firstMessageButton": "",
|
|
910
|
+
"secondMessageTemplate": {
|
|
911
|
+
"topMessage": ""
|
|
912
|
+
},
|
|
913
|
+
"secondMessageButton": ""
|
|
914
|
+
},
|
|
915
|
+
"messageType": "MESSAGE"
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
845
921
|
count = 0
|
|
846
922
|
while True:
|
|
847
923
|
response = requests.post(url,headers=headers,json=body)
|
|
@@ -864,6 +940,29 @@ def create_live(data):
|
|
|
864
940
|
return sales_id
|
|
865
941
|
|
|
866
942
|
# print(json.dumps(body))
|
|
943
|
+
def get_stamp_time(data):
|
|
944
|
+
#拿到指定时间的时间戳
|
|
945
|
+
num = data.get("num",2)
|
|
946
|
+
time_type = data.get("time_type","add")
|
|
947
|
+
unit = data.get("unit","minutes")
|
|
948
|
+
# 获取当前 UTC 时间
|
|
949
|
+
now = datetime.now()
|
|
950
|
+
if time_type not in {"add", "sub"}:
|
|
951
|
+
raise ValueError("Invalid time_type. Use 'add' or 'sub'.")
|
|
952
|
+
stamp_time = now + datetime.timedelta(**{unit:num if time_type == "add" else -num})
|
|
953
|
+
return int(stamp_time.timestamp()*1000)
|
|
954
|
+
|
|
955
|
+
def get_line_info(data):
|
|
956
|
+
env = data["env"]
|
|
957
|
+
headers = data["headers"]
|
|
958
|
+
url = "%s/api/posts/post/sales/lineConnectInfo"%env
|
|
959
|
+
response = requests.get(url,headers=headers).json()
|
|
960
|
+
shopId = response["data"]["shopInfo"]["shopId"]
|
|
961
|
+
platformChannelId = response["data"]["channel"]["platformChannelId"]
|
|
962
|
+
platformChannelName = response["data"]["channel"]["platformChannelName"]
|
|
963
|
+
return shopId,platformChannelId,platformChannelName,response
|
|
964
|
+
|
|
965
|
+
|
|
867
966
|
|
|
868
967
|
|
|
869
968
|
def add_live(data):
|
|
@@ -2020,8 +2119,8 @@ def handler_auto_reply(data):
|
|
|
2020
2119
|
|
|
2021
2120
|
|
|
2022
2121
|
if __name__=="__main__":
|
|
2023
|
-
data = {'
|
|
2024
|
-
data["keyword"] = "
|
|
2122
|
+
data = {'env': 'https://front-admin-preview.shoplineapp.com', 'headers': {'Content-Type': 'application/json', 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkZmQxYjNiMDc0M2JmYWU4YTFkODk4NzczNjgyZWVkZCIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjVlYjkwMzVhYjA5ZDEyNjU4NTFmOTU2ZiJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.Y90xLfYVAp9yByHo7Vc7A3hHrp6hX9X9Lg4mg_WiE_I', 'lang': 'en'}, 'platform': 'FB_GROUP', 'sales_id': '514694', 'activity_id': '10296402', 'keyword': 'lyqyh1738918140786', 'post_id': '3592205981019493_3943831999190221', 'page_id': '106411048594439', 'group_id': '3592205981019493', 'key': '5e3bba98882fc0fb22a0607238bc5b8f'}
|
|
2123
|
+
data["keyword"] = "lyqyh1738918047653"
|
|
2025
2124
|
send__live_comment(data)
|
|
2026
2125
|
|
|
2027
2126
|
|
{sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface/PostCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc_common_interface-2.7.6 → sc_common_interface-2.7.7}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|