sc-common-interface 2.5.2__tar.gz → 2.5.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.5.2
3
+ Version: 2.5.4
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -200,14 +200,7 @@ def get_live_info(data):
200
200
  response = requests.get(url,headers=headers).json()
201
201
  return response
202
202
 
203
- def get_live_product(data):
204
- env = data["env"]
205
- headers = data["headers"]
206
- sales_id = data["sales_id"]
207
- url = "%s/api/posts/post/sales/%s/product/v2" % (env, sales_id)
208
- params = {"salesId":sales_id,"pageIndex":1,"pageSize":25}
209
- response = requests.get(url, headers=headers,params=params).json()
210
- return response
203
+
211
204
 
212
205
  def get_activity_detail(data):
213
206
  """
@@ -1464,6 +1457,21 @@ def delete_product_set(data):
1464
1457
  }
1465
1458
  res = requests.delete(url,headers=headers,json=body).json()
1466
1459
  return res
1460
+ #查询普通商品列表
1461
+ def get_live_product(data):
1462
+ env = data["env"]
1463
+ headers = data["headers"]
1464
+ sales_id = data["sales_id"]
1465
+ query = ""
1466
+ if "query" in data:
1467
+ query = data["query"]
1468
+ url = "%s/api/posts/post/sales/%s/product/v2" % (env, sales_id)
1469
+ params = {"salesId":sales_id,"pageIndex":1,"pageSize":25,}
1470
+ if query!="":
1471
+ params["queryType"] = "PRODUCT_NAME"
1472
+ params["query"] = query
1473
+ response = requests.get(url, headers=headers,params=params).json()
1474
+ return response
1467
1475
 
1468
1476
  def search_product_set(data):
1469
1477
  env = data["env"]
@@ -1472,13 +1480,336 @@ def search_product_set(data):
1472
1480
  query = ""
1473
1481
  if "query" in data:
1474
1482
  query = data["query"]
1475
- url = "%s/admin/api/bff-web/live/sale/%s/product/product_set/list"%(env,sales_id)
1476
- param = {"pageNum":1,"pageSize":10,"query":query}
1477
- print(param)
1483
+ url = "%s/admin/api/bff-web/live/sale/%s/sale_list/product_set"%(env,sales_id)
1484
+ param = {"pageNum":1,"pageSize":10,"query":query,"queryType":"PRODUCT_NAME"}
1485
+ # print(param)
1478
1486
  res = requests.get(url,headers=headers,params=param).json()
1479
1487
  return res
1480
1488
 
1489
+ def get_sales_keyword(data):
1490
+ env = data["env"]
1491
+ headers = data["headers"]
1492
+ sales_id = data["sales_id"]
1493
+ url = "%s/admin/api/bff-web/live/sale/%s/keyword/list"%(env,sales_id)
1494
+ res = requests.get(url, headers=headers).json()
1495
+ return res
1481
1496
 
1497
+ def get_stock_product_set(res,type="stock"):
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
1482
1514
 
1483
1515
  if __name__=="__main__":
1484
- pass
1516
+ data = {
1517
+ "success": True,
1518
+ "code": "SUCCESS",
1519
+ "message": "success",
1520
+ "data": {
1521
+ "pageInfo": {
1522
+ "pageNum": 1,
1523
+ "pageSize": 10,
1524
+ "total": 4,
1525
+ "lastPage": True
1526
+ },
1527
+ "list": [
1528
+ {
1529
+ "id": "673c889f3dc982185de87d1c",
1530
+ "image": "https://shoplineimg.com/61a87c9763b70c005106fbd0/673c889b52b9d600110bfc1c/50xf.webp?source_format=png&cheap_resize=1",
1531
+ "title": "ffsssdsfsfsf",
1532
+ "recommend": {
1533
+ "isActivity": True,
1534
+ "recommendTime": None
1535
+ },
1536
+ "effectiveKey": True,
1537
+ "defaultKey": "",
1538
+ "combinationList": [
1539
+ {
1540
+ "id": "46df6fa5b6af8bcbec7aa28db26f1eae",
1541
+ "price": {
1542
+ "originCents": 455,
1543
+ "origin": "455 ₫",
1544
+ "salesCents": 55,
1545
+ "sales": "55 ₫"
1546
+ },
1547
+ "keywords": [
1548
+ "组合商品关键字1732346557"
1549
+ ],
1550
+ "products": [
1551
+ {
1552
+ "spuId": "673c311f52b9d659d30bf878",
1553
+ "skuId": "673c311f52b9d659d30bf878",
1554
+ "count": 2,
1555
+ "name": "inbox自定义商品",
1556
+ "quantity": 1,
1557
+ "unlimitedQuantity": True
1558
+ },
1559
+ {
1560
+ "spuId": "673c2e5a3dc982185de87b57",
1561
+ "skuId": "673c2e5a3dc982185de87b57",
1562
+ "count": 2,
1563
+ "name": "自定义商品哈哈哈",
1564
+ "quantity": -1,
1565
+ "unlimitedQuantity": True
1566
+ }
1567
+ ],
1568
+ "buyerProductCount": 0
1569
+ }
1570
+ ],
1571
+ "availableStartTime": None,
1572
+ "availableEndTime": None,
1573
+ "tempPrice": {
1574
+ "originCents": 455,
1575
+ "origin": "455 ₫",
1576
+ "salesCents": 55,
1577
+ "sales": "55 ₫"
1578
+ },
1579
+ "childrenInfo": {
1580
+ "673c2e5a3dc982185de87b57": {
1581
+ "necessaryQuantity": 2,
1582
+ "variations": []
1583
+ },
1584
+ "673c311f52b9d659d30bf878": {
1585
+ "necessaryQuantity": 2,
1586
+ "variations": []
1587
+ }
1588
+ },
1589
+ "status": "active"
1590
+ },
1591
+ {
1592
+ "id": "670f8a6c7fb2d15f7b8f6431",
1593
+ "image": "https://shoplineimg.com/61a87c9763b70c005106fbd0/670f8a57b7b2cb000a26a9f6/50xf.webp?source_format=jpeg&cheap_resize=1",
1594
+ "title": "dyy超长的组合商品yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
1595
+ "recommend": {
1596
+ "isActivity": True,
1597
+ "recommendTime": None
1598
+ },
1599
+ "effectiveKey": True,
1600
+ "defaultKey": "",
1601
+ "combinationList": [
1602
+ {
1603
+ "id": "c536c6eaffa7364a1dac2743aeff518a",
1604
+ "price": {
1605
+ "originCents": 100,
1606
+ "origin": "100 ₫",
1607
+ "salesCents": 90,
1608
+ "sales": "90 ₫"
1609
+ },
1610
+ "keywords": [
1611
+ "LYQYH1730649250892"
1612
+ ],
1613
+ "products": [
1614
+ {
1615
+ "spuId": "670f8a48b7b2cb384126a9bc",
1616
+ "skuId": "670f8a48db1762000bcedfc8",
1617
+ "count": 2,
1618
+ "name": "dyy超长的商品yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(dyy超长的商品yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)",
1619
+ "quantity": -1,
1620
+ "unlimitedQuantity": True
1621
+ },
1622
+ {
1623
+ "spuId": "670f84314149e400117b3c6a",
1624
+ "skuId": "670f84314bd7dd001035d0ea",
1625
+ "count": 1,
1626
+ "name": "多规格商品名称1729070129(红)",
1627
+ "quantity": 50,
1628
+ "unlimitedQuantity": True
1629
+ }
1630
+ ],
1631
+ "buyerProductCount": 0
1632
+ }
1633
+ ],
1634
+ "availableStartTime": None,
1635
+ "availableEndTime": None,
1636
+ "tempPrice": {
1637
+ "originCents": 100,
1638
+ "origin": "100 ₫",
1639
+ "salesCents": 90,
1640
+ "sales": "90 ₫"
1641
+ },
1642
+ "childrenInfo": {
1643
+ "670f84314149e400117b3c6a": {
1644
+ "necessaryQuantity": 1,
1645
+ "variations": [
1646
+ "670f84314bd7dd001035d0ea"
1647
+ ]
1648
+ },
1649
+ "670f8a48b7b2cb384126a9bc": {
1650
+ "necessaryQuantity": 2,
1651
+ "variations": [
1652
+ "670f8a48db1762000bcedfc8",
1653
+ "670f8a48db1762000bcedfc9"
1654
+ ]
1655
+ }
1656
+ },
1657
+ "status": "active"
1658
+ },
1659
+ {
1660
+ "id": "670fc1bbb7b2cb161826a9c6",
1661
+ "image": "https://shoplineimg.com/61a87c9763b70c005106fbd0/670fc196b7b2cbbdac26a7e2/50xf.webp?source_format=jpeg&cheap_resize=1",
1662
+ "title": "dyy组合商品变动- 子商品从多规格 变成 无规格",
1663
+ "recommend": {
1664
+ "isActivity": True,
1665
+ "recommendTime": None
1666
+ },
1667
+ "effectiveKey": True,
1668
+ "defaultKey": "",
1669
+ "combinationList": [
1670
+ {
1671
+ "id": "e869f56d1d94901903a3c6b5e775d37b",
1672
+ "price": {
1673
+ "originCents": 100,
1674
+ "origin": "100 ₫",
1675
+ "salesCents": 90,
1676
+ "sales": "90 ₫"
1677
+ },
1678
+ "keywords": [
1679
+ "DDAASS"
1680
+ ],
1681
+ "products": [
1682
+ {
1683
+ "spuId": "670fc182b7b2cb001026ab78",
1684
+ "skuId": "670fc182b7b2cb001026ab78",
1685
+ "count": 2,
1686
+ "name": "dyy商品从多规格 变成 无规格",
1687
+ "quantity": -1,
1688
+ "unlimitedQuantity": True
1689
+ },
1690
+ {
1691
+ "spuId": "670fbb5227a445000f12b050",
1692
+ "skuId": "670fbb517e0510001fd941c9",
1693
+ "count": 3,
1694
+ "name": "模式4接口自动化添加的多规格商品1729084241(红,M)",
1695
+ "quantity": 55,
1696
+ "unlimitedQuantity": False
1697
+ }
1698
+ ],
1699
+ "buyerProductCount": 0
1700
+ },
1701
+ {
1702
+ "id": "f266f67781aa371f8348d331ffc77565",
1703
+ "price": {
1704
+ "originCents": 100,
1705
+ "origin": "100 ₫",
1706
+ "salesCents": 90,
1707
+ "sales": "90 ₫"
1708
+ },
1709
+ "keywords": [
1710
+ "MMM"
1711
+ ],
1712
+ "products": [
1713
+ {
1714
+ "spuId": "670fc182b7b2cb001026ab78",
1715
+ "skuId": "670fc182b7b2cb001026ab78",
1716
+ "count": 2,
1717
+ "name": "dyy商品从多规格 变成 无规格",
1718
+ "quantity": -1,
1719
+ "unlimitedQuantity": True
1720
+ },
1721
+ {
1722
+ "spuId": "670fbb5227a445000f12b050",
1723
+ "skuId": "670fbb517e0510001fd941ca",
1724
+ "count": 3,
1725
+ "name": "模式4接口自动化添加的多规格商品1729084241(红, L)",
1726
+ "quantity": 1,
1727
+ "unlimitedQuantity": False
1728
+ }
1729
+ ],
1730
+ "buyerProductCount": 0
1731
+ }
1732
+ ],
1733
+ "availableStartTime": None,
1734
+ "availableEndTime": None,
1735
+ "tempPrice": {
1736
+ "originCents": 100,
1737
+ "origin": "100 ₫",
1738
+ "salesCents": 90,
1739
+ "sales": "90 ₫"
1740
+ },
1741
+ "childrenInfo": {
1742
+ "670fbb5227a445000f12b050": {
1743
+ "necessaryQuantity": 3,
1744
+ "variations": [
1745
+ "670fbb517e0510001fd941c9",
1746
+ "670fbb517e0510001fd941ca",
1747
+ "670fbb517e0510001fd941cb",
1748
+ "670fbb517e0510001fd941cc"
1749
+ ]
1750
+ },
1751
+ "670fc182b7b2cb001026ab78": {
1752
+ "necessaryQuantity": 2,
1753
+ "variations": []
1754
+ }
1755
+ },
1756
+ "status": "active"
1757
+ },
1758
+ {
1759
+ "id": "670fc567b7b2cb000a26ab86",
1760
+ "image": "https://shoplineimg.com/61a87c9763b70c005106fbd0/670fc54eb7b2cbbdac26a7e3/50xf.webp?source_format=jpeg&cheap_resize=1",
1761
+ "title": "组合商品下的子商品被删除了",
1762
+ "recommend": {
1763
+ "isActivity": False,
1764
+ "recommendTime": "2024-11-18T20:31:57+08:00"
1765
+ },
1766
+ "effectiveKey": True,
1767
+ "defaultKey": "",
1768
+ "combinationList": [
1769
+ {
1770
+ "id": "ea4838a97018ddd345099847945ac38b",
1771
+ "price": {
1772
+ "originCents": 100,
1773
+ "origin": "100 ₫",
1774
+ "salesCents": 90,
1775
+ "sales": "90 ₫"
1776
+ },
1777
+ "keywords": [
1778
+ "FFDDD",
1779
+ "GGSS"
1780
+ ],
1781
+ "products": [
1782
+ {
1783
+ "spuId": "670fc53eb7b2cbfe9926a836",
1784
+ "skuId": "670fc53eb7b2cbfe9926a836",
1785
+ "count": 2,
1786
+ "name": "dyy这个商品是要被删除的额",
1787
+ "quantity": -1,
1788
+ "unlimitedQuantity": True
1789
+ }
1790
+ ],
1791
+ "buyerProductCount": 0
1792
+ }
1793
+ ],
1794
+ "availableStartTime": None,
1795
+ "availableEndTime": None,
1796
+ "tempPrice": {
1797
+ "originCents": 100,
1798
+ "origin": "100 ₫",
1799
+ "salesCents": 90,
1800
+ "sales": "90 ₫"
1801
+ },
1802
+ "childrenInfo": {
1803
+ "670fc53eb7b2cbfe9926a836": {
1804
+ "necessaryQuantity": 2,
1805
+ "variations": []
1806
+ }
1807
+ },
1808
+ "status": "active"
1809
+ }
1810
+ ]
1811
+ },
1812
+ "traceId": "13f3a0b22dc91017817f0f74756031cf"
1813
+ }
1814
+ keyword,spuid,__ = get_stock_product_set(data)
1815
+ print(keyword)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.5.2
3
+ Version: 2.5.4
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.2',
5
+ version='2.5.4',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),