sc-common-interface 2.3.3__tar.gz → 2.3.4__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.3.3 → sc-common-interface-2.3.4}/PKG-INFO +1 -1
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface/PostCommonInterface.py +74 -30
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/setup.py +1 -1
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface/LiveCommonInterface.py +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface/Platform.py +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface/__init__.py +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/setup.cfg +0 -0
{sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface/PostCommonInterface.py
RENAMED
|
@@ -480,15 +480,64 @@ def search_post_product(data):
|
|
|
480
480
|
headers = data["headers"]
|
|
481
481
|
url = "%s/api/posts/common/product/key/spu/list?page=1&searchType=ALL&pageSize=10"%env
|
|
482
482
|
response = requests.get(url, headers=headers).json()
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
483
|
+
items = response["data"]["openApiProductDetails"]
|
|
484
|
+
# productSpuKeyVos = response["data"]["productSpuKeyVos"][0]
|
|
485
|
+
# skuKeys = productSpuKeyVos["skuKeys"]
|
|
486
|
+
# spuId = productSpuKeyVos["spuId"]
|
|
487
|
+
# return skuKeys,spuId,response
|
|
488
|
+
type = "spu"
|
|
489
|
+
quantity = 100
|
|
490
|
+
if "type" in data:
|
|
491
|
+
type = data["type"]
|
|
492
|
+
if "quantity" in data:
|
|
493
|
+
quantity = data["quantity"]
|
|
494
|
+
if "query" in data:
|
|
495
|
+
query = data["query"]
|
|
496
|
+
variant_options_list = jsonpath(items, "$..variations")
|
|
497
|
+
product_info = ""
|
|
498
|
+
spu_id = ""
|
|
499
|
+
sku_id = ""
|
|
500
|
+
sku_id_quantity = []
|
|
501
|
+
|
|
502
|
+
for a, b in enumerate(variant_options_list):
|
|
503
|
+
if type == "spu" and b == [] and quantity != 0:
|
|
504
|
+
quantitys = items[a]["totalOrderableQuantity"]
|
|
505
|
+
unlimited_quantity = items[a]["unlimitedQuantity"]
|
|
506
|
+
if quantitys != 0 or unlimited_quantity == True:
|
|
507
|
+
product_info = items[a]
|
|
508
|
+
spu_id = items[a]["id"]
|
|
509
|
+
break
|
|
510
|
+
elif type == "sku" and b != [] and quantity != 0:
|
|
511
|
+
quantitys = items[a]["totalOrderableQuantity"]
|
|
512
|
+
unlimited_quantity = items[a]["unlimitedQuantity"]
|
|
513
|
+
if quantitys != 0 or unlimited_quantity == True:
|
|
514
|
+
product_info = items[a]
|
|
515
|
+
spu_id = items[a]["id"]
|
|
516
|
+
sku_id = jsonpath(items[a]["variations"], "$..id")
|
|
517
|
+
sku_id_quantity = jsonpath(items[a]["variations"], "$..totalOrderableQuantity")
|
|
518
|
+
break
|
|
519
|
+
elif type == "spu" and b == [] and quantity == 0:
|
|
520
|
+
quantitys = items[a]["totalOrderableQuantity"]
|
|
521
|
+
unlimited_quantity = items[a]["unlimitedQuantity"]
|
|
522
|
+
if quantitys != 0 or unlimited_quantity == True:
|
|
523
|
+
product_info = items[a]
|
|
524
|
+
spu_id = items[a]["id"]
|
|
525
|
+
break
|
|
526
|
+
elif type == "sku" and b != [] and quantity == 0:
|
|
527
|
+
quantitys = items[a]["totalOrderableQuantity"]
|
|
528
|
+
unlimited_quantity = items[a]["unlimited_quantity"]
|
|
529
|
+
if quantitys != 0 or unlimited_quantity == True:
|
|
530
|
+
product_info = items[a]
|
|
531
|
+
spu_id = items[a]["id"]
|
|
532
|
+
sku_id = jsonpath(items[a]["variations"], "$..id")
|
|
533
|
+
sku_id_quantity = jsonpath(items[a]["variations"], "$..totalOrderableQuantity")
|
|
534
|
+
break
|
|
535
|
+
return spu_id, sku_id, sku_id_quantity, product_info
|
|
487
536
|
|
|
488
537
|
|
|
489
538
|
def model_one_add_product(data):
|
|
490
539
|
"""
|
|
491
|
-
贴文销售模式1-模式3
|
|
540
|
+
贴文销售模式1-模式3添加商品,只添加第一个有库存商品到贴文
|
|
492
541
|
:param data:
|
|
493
542
|
:return:
|
|
494
543
|
"""
|
|
@@ -496,25 +545,27 @@ def model_one_add_product(data):
|
|
|
496
545
|
headers = data["headers"]
|
|
497
546
|
sales_id = data["sales_id"]
|
|
498
547
|
url = "%s/api/posts/post/sales/%s/products"%(env,sales_id)
|
|
499
|
-
|
|
548
|
+
spu_id, sku_id, sku_id_quantity, product_info = search_post_product(data)
|
|
549
|
+
# print("sku_id",sku_id)
|
|
500
550
|
skuList = []
|
|
501
551
|
body = {}
|
|
502
|
-
if
|
|
503
|
-
for index, sku in enumerate(
|
|
504
|
-
skuId = sku["skuId"]
|
|
505
|
-
spuId = sku["spuId"]
|
|
552
|
+
if len(sku_id) >1:
|
|
553
|
+
for index, sku in enumerate(sku_id):
|
|
554
|
+
# skuId = sku["skuId"]
|
|
555
|
+
# spuId = sku["spuId"]
|
|
506
556
|
sku_data = {}
|
|
507
|
-
sku_data["skuId"] =
|
|
557
|
+
sku_data["skuId"] = sku
|
|
508
558
|
sku_data["missCommonKey"] = False
|
|
509
559
|
sku_data["keyList"] = ["模式1关键字%d" % index]
|
|
510
560
|
skuList.append(sku_data)
|
|
511
561
|
# print(skuList)
|
|
512
|
-
if
|
|
562
|
+
if len(sku_id)<=1:
|
|
513
563
|
body = {
|
|
514
|
-
"spuList": [{"spuId":
|
|
564
|
+
"spuList": [{"spuId": spu_id, "missCommonKey": "false", "customNumbers": [], "keyList": ["无规格商品关键字"]}]}
|
|
515
565
|
else:
|
|
516
566
|
body = {
|
|
517
|
-
"spuList": [{"spuId":
|
|
567
|
+
"spuList": [{"spuId": spu_id, "missCommonKey": "false", "customNumbers": [], "skuList": skuList}]}
|
|
568
|
+
# print(body)
|
|
518
569
|
response = requests.post(url, headers=headers, json=body).json()
|
|
519
570
|
return response
|
|
520
571
|
|
|
@@ -528,25 +579,25 @@ def model_four_add_product(data):
|
|
|
528
579
|
headers = data["headers"]
|
|
529
580
|
sales_id = data["sales_id"]
|
|
530
581
|
url = "%s/api/posts/post/sales/%s/products"%(env,sales_id)
|
|
531
|
-
|
|
582
|
+
spu_id, sku_id, sku_id_quantity, product_info = search_post_product(data)
|
|
532
583
|
skuList = []
|
|
533
|
-
if
|
|
534
|
-
for index, sku in enumerate(
|
|
535
|
-
skuId = sku["skuId"]
|
|
536
|
-
spuId = sku["spuId"]
|
|
584
|
+
if len(sku_id) >1:
|
|
585
|
+
for index, sku in enumerate(sku_id):
|
|
586
|
+
# skuId = sku["skuId"]
|
|
587
|
+
# spuId = sku["spuId"]
|
|
537
588
|
sku_data = {}
|
|
538
|
-
sku_data["skuId"] =
|
|
589
|
+
sku_data["skuId"] = sku
|
|
539
590
|
sku_data["missCommonKey"] = False
|
|
540
591
|
skuList.append(sku_data)
|
|
541
592
|
# print(skuList)
|
|
542
593
|
customNumbers = "模式4接口关键字下单"
|
|
543
594
|
body = {}
|
|
544
|
-
if
|
|
595
|
+
if len(sku_id) <= 1:
|
|
545
596
|
body = {"spuList": [
|
|
546
|
-
{"spuId":
|
|
597
|
+
{"spuId": spu_id, "missCommonKey": "true", "customNumbers": [customNumbers], "customNumber": customNumbers}]}
|
|
547
598
|
else:
|
|
548
599
|
body = {"spuList": [
|
|
549
|
-
{"spuId":
|
|
600
|
+
{"spuId": spu_id, "missCommonKey": "false", "customNumbers": [customNumbers], "customNumber": customNumbers,
|
|
550
601
|
"skuList": skuList}]}
|
|
551
602
|
response = requests.post(url, headers=headers, json=body).json()
|
|
552
603
|
return response
|
|
@@ -1467,11 +1518,4 @@ def get_mc_order_link(url):
|
|
|
1467
1518
|
|
|
1468
1519
|
if __name__=="__main__":
|
|
1469
1520
|
pass
|
|
1470
|
-
# headers = {"content-type": "application/json",
|
|
1471
|
-
# "authorization": "Bearer 11eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIzN2Y2MjY2M2IyMTI1MjIzMWZlMTc4MTE2ODhkNDliYSIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MjI5YTdiYWVhNzA2NDJhOGI2NWViZGEiLCJhcHBsaWNhdGlvbl9pZCI6IjYwZWVjNWViZjhkYzkyMDAwNjUyZTAwNiJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMteXkuc2hvcGxpbmVzdGcuY29tIiwiYXVkIjpbXSwic3ViIjoiNjIyOWE3YmFlYTcwNjQyYThiNjVlYmRhIn0.FwtntG1dAYWNUcEZf6WSehXQveEw_rvTSGPEM3xV9FA"}
|
|
1472
|
-
# data = {"env": "https://front-service.shoplinestg.com", "headers": headers, "platform": "FB_GROUP",
|
|
1473
|
-
# "sales_id": "84031", "page_id": "110842575060695",
|
|
1474
|
-
# "relationUrl": "https://www.facebook.com/groups/416632743936652/posts/823646243235298/"}
|
|
1475
|
-
# res = relate_post(data)
|
|
1476
|
-
# print(res)
|
|
1477
1521
|
|
{sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc-common-interface-2.3.3 → sc-common-interface-2.3.4}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|