sc-common-interface 2.5.4__tar.gz → 2.5.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.5.4
3
+ Version: 2.5.6
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -1496,21 +1496,40 @@ def get_sales_keyword(data):
1496
1496
 
1497
1497
  def get_stock_product_set(res,type="stock"):
1498
1498
  list_data = res["data"]["list"]
1499
- for i in list_data:
1500
- combinationList = i["combinationList"]
1501
- for combination in combinationList:
1502
- products = combination["products"]
1503
- for product in products:
1504
- count = product["count"]
1505
- quantity = product["quantity"]
1506
- if quantity==-1:
1507
- # print("库存无限数量")
1508
- pass
1509
- elif quantity<count:
1510
- break
1511
- keyword = combination["keywords"][0]
1512
- product_id = i["id"]
1513
- return keyword, product_id, list_data
1499
+ if type=="stock":
1500
+ for i in list_data:
1501
+ combinationList = i["combinationList"]
1502
+ for combination in combinationList:
1503
+ products = combination["products"]
1504
+ for product in products:
1505
+ count = product["count"]
1506
+ quantity = product["quantity"]
1507
+ if quantity==-1:
1508
+ # print("库存无限数量")
1509
+ pass
1510
+ elif quantity<count:
1511
+ break
1512
+ keyword = combination["keywords"][0]
1513
+ product_id = i["id"]
1514
+ combination_id = combination["id"]
1515
+ return keyword, product_id, combination_id
1516
+ elif type=="out":
1517
+ for i in list_data:
1518
+ combinationList = i["combinationList"]
1519
+ for combination in combinationList:
1520
+ products = combination["products"]
1521
+ for product in products:
1522
+ count = product["count"]
1523
+ quantity = product["quantity"]
1524
+ if quantity != -1 and quantity < count:
1525
+ keyword = combination["keywords"][0]
1526
+ product_id = i["id"]
1527
+ combination_id = combination["id"]
1528
+ return keyword, product_id, combination_id
1529
+
1530
+
1531
+
1532
+
1514
1533
 
1515
1534
  if __name__=="__main__":
1516
1535
  data = {
@@ -1553,7 +1572,7 @@ if __name__=="__main__":
1553
1572
  "skuId": "673c311f52b9d659d30bf878",
1554
1573
  "count": 2,
1555
1574
  "name": "inbox自定义商品",
1556
- "quantity": 1,
1575
+ "quantity": -1,
1557
1576
  "unlimitedQuantity": True
1558
1577
  },
1559
1578
  {
@@ -1561,7 +1580,7 @@ if __name__=="__main__":
1561
1580
  "skuId": "673c2e5a3dc982185de87b57",
1562
1581
  "count": 2,
1563
1582
  "name": "自定义商品哈哈哈",
1564
- "quantity": -1,
1583
+ "quantity": 9999,
1565
1584
  "unlimitedQuantity": True
1566
1585
  }
1567
1586
  ],
@@ -1622,7 +1641,7 @@ if __name__=="__main__":
1622
1641
  {
1623
1642
  "spuId": "670f84314149e400117b3c6a",
1624
1643
  "skuId": "670f84314bd7dd001035d0ea",
1625
- "count": 1,
1644
+ "count": 51,
1626
1645
  "name": "多规格商品名称1729070129(红)",
1627
1646
  "quantity": 50,
1628
1647
  "unlimitedQuantity": True
@@ -1811,5 +1830,5 @@ if __name__=="__main__":
1811
1830
  },
1812
1831
  "traceId": "13f3a0b22dc91017817f0f74756031cf"
1813
1832
  }
1814
- keyword,spuid,__ = get_stock_product_set(data)
1815
- print(keyword)
1833
+ keyword,spuid,combination_id = get_stock_product_set(data,"out")
1834
+ print(combination_id)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.5.4
3
+ Version: 2.5.6
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='sc-common-interface',
5
- version='2.5.4',
5
+ version='2.5.6',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),