sc-common-interface 2.7.5__tar.gz → 2.7.6__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.5 → sc_common_interface-2.7.6}/PKG-INFO +1 -1
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface/LiveCommonInterface.py +11 -9
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface/PostCommonInterface.py +28 -0
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/setup.py +2 -1
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface/McCommonInterface.py +0 -0
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface/Platform.py +0 -0
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface/__init__.py +0 -0
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/setup.cfg +0 -0
{sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -234,22 +234,23 @@ def send__live_comment(data):
|
|
|
234
234
|
num = random.randint(100000, 999999)
|
|
235
235
|
user_id = "488864%d" % int(time.time())
|
|
236
236
|
name = "test live%d" % int(time.time())
|
|
237
|
-
|
|
237
|
+
|
|
238
238
|
keyword = "接口测试普通留言"
|
|
239
239
|
user_id = data.get("user_id", user_id)
|
|
240
240
|
name = data.get("name", name)
|
|
241
|
-
comment_id = data.get("comment_id", comment_id)
|
|
242
241
|
keyword = data.get("keyword", keyword)
|
|
243
242
|
# sales_type = data.get("sales_type", "live")
|
|
244
|
-
relationUrl = data.get("relationUrl")
|
|
243
|
+
relationUrl = data.get("relationUrl","")
|
|
245
244
|
if page_id == "" or post_id == "key":
|
|
246
245
|
page_info = get_page_info(data)
|
|
246
|
+
page_id = page_info["page_id"]
|
|
247
247
|
platform = page_info["platform"]
|
|
248
248
|
post_id = page_info["post_id"]
|
|
249
249
|
group_id = page_info["group_id"]
|
|
250
250
|
relationUrl = page_info["permalink_url"]
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
#放到后面,需要等设置完page_id 后再设置
|
|
252
|
+
comment_id = "%s_%d%d" % (page_id, stamp, num)
|
|
253
|
+
comment_id = data.get("comment_id", comment_id)
|
|
253
254
|
body = {"object": "page", "entry": [{"id": page_id, "time": stamp, "changes": [{"field": "feed", "value": {
|
|
254
255
|
"from": {"id": user_id, "name": name},
|
|
255
256
|
"post": {"status_type": "added_video", "is_published": True, "updated_time": "2022-11-18T09:57:26+0000",
|
|
@@ -269,9 +270,7 @@ def send__live_comment(data):
|
|
|
269
270
|
t_time = stamp*1000
|
|
270
271
|
if "_" in post_id:
|
|
271
272
|
post_id = post_id.split("_")[-1]
|
|
272
|
-
|
|
273
|
-
# print("----")
|
|
274
|
-
# relationUrl = data["relationUrl"]
|
|
273
|
+
elif relationUrl!="":
|
|
275
274
|
match = re.search(r'groups/(\d+)/permalink/(\d+)/', relationUrl)
|
|
276
275
|
group_id = match.group(1)
|
|
277
276
|
post_id = match.group(2)
|
|
@@ -2021,7 +2020,10 @@ def handler_auto_reply(data):
|
|
|
2021
2020
|
|
|
2022
2021
|
|
|
2023
2022
|
if __name__=="__main__":
|
|
2024
|
-
|
|
2023
|
+
data = {'headers': {'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIzMzRjNWViYzIwOGQ2ZTQyM2JmYzUwOWFjZjk4NThlYSIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWIwOTZiZWI3YmVmMTAwMjQ1ZGJkOGIiLCJhcHBsaWNhdGlvbl9pZCI6IjYyN2M3NTBhMDYyMzcwMDAwYWZlNWVmZCJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMuc2hvcGxpbmVhcHAuY29tIiwiYXVkIjpbXSwic3ViIjoiNjFiMDk2YmViN2JlZjEwMDI0NWRiZDhiIn0.wDmFx92Wzy23KAFC-8BiQBmSlNozvR60VpXd_wAods4', 'lang': 'en', 'Content-Type': 'application/json'}, 'activity_id': 10295839, 'env': 'https://front-admin.shoplineapp.com', 'type': 'spu', 'body': {'duration': 600, 'reward': {'reward': {'spuId': '67a466094bb0a80011bf24f0', 'skuId': ''}, 'rewardType': 'PRODUCT_CUSTOM_PRICE'}, 'lotteryMethod': 'ACTIVITY_END', 'activityTitle': '接口创建竞标活动选择商品1738832709', 'businessId': '381157', 'activityType': 'BIDDING', 'totalWinner': '4', 'message': {'winMessage': '恭喜你在中得標!請至購物車確認你的得標商品!1738832706152', 'activityEndComment': '活動結束 ,謝謝大家的熱情參與!1738832706152', 'winComment': '恭喜 {winner} 得標!得標資訊請參考:{bidding-info}!1738832706152', 'activityStartComment': '{title} 活動開始商家截止前留言出價即可競標!起標價 {min-price},最高可喊到 {max-price},出價最高 {quota} 位可得標!1738832706152'}, 'activityInfo': {'minPrice': 1, 'maxPrice': 1000}}, 'keyword': '1000', 'sales_id': '381157', 'key': 'a2f4cae7b637eb42967ef5ab6a6a3ff7'}
|
|
2024
|
+
data["keyword"] = "fasfdaf"
|
|
2025
|
+
send__live_comment(data)
|
|
2026
|
+
|
|
2025
2027
|
|
|
2026
2028
|
|
|
2027
2029
|
|
{sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface/PostCommonInterface.py
RENAMED
|
@@ -190,6 +190,34 @@ def search_oa_product(data):
|
|
|
190
190
|
response = requests.get(url, headers=headers).json()
|
|
191
191
|
return response
|
|
192
192
|
|
|
193
|
+
def get_has_stock_product(data):
|
|
194
|
+
"""返回有库存商品的spu_id和sku_id"""
|
|
195
|
+
env = data["env"]
|
|
196
|
+
headers = data["headers"]
|
|
197
|
+
url = "%s/openApi/proxy/v1/products?page=1&per_page=20" % env
|
|
198
|
+
if "query" in data:
|
|
199
|
+
query = data["query"]
|
|
200
|
+
url = "%s/openApi/proxy/v1/products/search?page=1&per_page=20&%s" % (env,query)
|
|
201
|
+
response = requests.get(url, headers=headers).json()
|
|
202
|
+
product_item = response["data"]["items"]
|
|
203
|
+
sku_id = ""
|
|
204
|
+
for product in product_item:
|
|
205
|
+
variations = product["variations"]
|
|
206
|
+
status = product["status"]
|
|
207
|
+
if variations == [] and status != "draft":
|
|
208
|
+
total_orderable_quantity = product["total_orderable_quantity"]
|
|
209
|
+
if total_orderable_quantity > 0 or total_orderable_quantity == -1:
|
|
210
|
+
spu_id = product["id"]
|
|
211
|
+
return spu_id,sku_id
|
|
212
|
+
elif status != "draft":
|
|
213
|
+
for variation in variations:
|
|
214
|
+
total_orderable_quantity = variation["total_orderable_quantity"]
|
|
215
|
+
if total_orderable_quantity > 0 or total_orderable_quantity == -1:
|
|
216
|
+
spu_id = product["id"]
|
|
217
|
+
sku_id = variation["id"]
|
|
218
|
+
return spu_id,sku_id
|
|
219
|
+
|
|
220
|
+
|
|
193
221
|
def create_post_lucky_draw(data):
|
|
194
222
|
"""
|
|
195
223
|
创建抽奖活动
|
{sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc_common_interface-2.7.5 → sc_common_interface-2.7.6}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|