sc-common-interface 2.8.2__tar.gz → 2.8.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.8.2 → sc_common_interface-2.8.4}/PKG-INFO +1 -1
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface/LiveCommonInterface.py +85 -25
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/setup.py +1 -1
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface/CommonOa.py +0 -0
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface/McCommonInterface.py +0 -0
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface/Platform.py +0 -0
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface/PostCommonInterface.py +0 -0
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface/__init__.py +0 -0
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/setup.cfg +0 -0
{sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -1838,24 +1838,41 @@ def add_product_set_to_live(data):
|
|
|
1838
1838
|
|
|
1839
1839
|
url = "%s/admin/api/bff-web/live/sale/%s/sale_list/product_set" % (env, sales_id)
|
|
1840
1840
|
# keyword = "python添加商品关键子%d" % int(time.time())
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
"
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1841
|
+
if isinstance(keyword,str):
|
|
1842
|
+
add_body = {
|
|
1843
|
+
"spuList": [
|
|
1844
|
+
{
|
|
1845
|
+
"id": "%s" % product_id,
|
|
1846
|
+
"defaultKey": "",
|
|
1847
|
+
"combinationList": [
|
|
1848
|
+
{
|
|
1849
|
+
"products": products,
|
|
1850
|
+
"keywords": [
|
|
1851
|
+
"%s" % keyword
|
|
1852
|
+
],
|
|
1853
|
+
"skuId": ""
|
|
1854
|
+
}
|
|
1855
|
+
]
|
|
1856
|
+
}
|
|
1857
|
+
]
|
|
1858
|
+
}
|
|
1859
|
+
else:
|
|
1860
|
+
add_body = {
|
|
1861
|
+
"spuList": [
|
|
1862
|
+
{
|
|
1863
|
+
"id": "%s" % product_id,
|
|
1864
|
+
"defaultKey": "",
|
|
1865
|
+
"combinationList": [
|
|
1866
|
+
{
|
|
1867
|
+
"products": products,
|
|
1868
|
+
"keywords": keyword,
|
|
1869
|
+
"skuId": ""
|
|
1870
|
+
}
|
|
1871
|
+
]
|
|
1872
|
+
}
|
|
1873
|
+
]
|
|
1874
|
+
}
|
|
1875
|
+
print(add_body)
|
|
1859
1876
|
try:
|
|
1860
1877
|
#先删除再添加
|
|
1861
1878
|
data["product_id"] = product_id
|
|
@@ -2296,16 +2313,59 @@ def get_not_exist_keyword_set(data):
|
|
|
2296
2313
|
pageNum += 1
|
|
2297
2314
|
data["pageNum"] = pageNum
|
|
2298
2315
|
|
|
2316
|
+
def search_product_by_keyword(data):
|
|
2317
|
+
env = data["env"]
|
|
2318
|
+
headers = data["headers"]
|
|
2319
|
+
keyword = data["keyword"]
|
|
2320
|
+
sales_id = data["sales_id"]
|
|
2321
|
+
url = "%s/api/posts/post/sales/%s/product/v2" % (env, sales_id)
|
|
2322
|
+
param = {"salesId": sales_id, "pageIndex": 1, "pageSize": 25, "query": keyword, "queryType": "KEYWORD"}
|
|
2323
|
+
response = requests.get(url, headers=headers, params=param).json()
|
|
2324
|
+
return response
|
|
2325
|
+
|
|
2326
|
+
def search_product_set_by_keyword(data):
|
|
2327
|
+
env = data["env"]
|
|
2328
|
+
headers = data["headers"]
|
|
2329
|
+
keyword = data["keyword"]
|
|
2330
|
+
sales_id = data["sales_id"]
|
|
2331
|
+
url = "%s/admin/api/bff-web/live/sale/%s/sale_list/product_set" % (env, sales_id)
|
|
2332
|
+
param = { "pageNum": 1, "pageSize": 25, "query": keyword, "queryType": "KEYWORD"}
|
|
2333
|
+
response = requests.get(url, headers=headers, params=param).json()
|
|
2334
|
+
return response
|
|
2335
|
+
|
|
2336
|
+
|
|
2337
|
+
def delete_product_by_keyword(data):
|
|
2338
|
+
"""根据关键字查询出商品,删除该普通商品和组合商品"""
|
|
2339
|
+
response = search_product_by_keyword(data)
|
|
2340
|
+
result = response["data"]["product_page_result"]["list"]
|
|
2341
|
+
if len(result)>0:
|
|
2342
|
+
spu_id = result[0]["spu_id"]
|
|
2343
|
+
data["product_id"] = spu_id
|
|
2344
|
+
remove_live_product(data)
|
|
2345
|
+
set_response = search_product_set_by_keyword(data)
|
|
2346
|
+
set_result = set_response["data"]["list"]
|
|
2347
|
+
if len(set_result)>0:
|
|
2348
|
+
set_spu_id = set_result[0]["id"]
|
|
2349
|
+
data["product_id"] = set_spu_id
|
|
2350
|
+
delete_product_set(data)
|
|
2351
|
+
|
|
2352
|
+
|
|
2353
|
+
|
|
2354
|
+
|
|
2355
|
+
|
|
2356
|
+
|
|
2357
|
+
|
|
2358
|
+
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
|
|
2362
|
+
|
|
2363
|
+
|
|
2299
2364
|
|
|
2300
2365
|
|
|
2301
2366
|
if __name__=="__main__":
|
|
2302
|
-
data = {'
|
|
2303
|
-
|
|
2304
|
-
product_id = response['data']["list"][0]["id"]
|
|
2305
|
-
data["product_id"] = [product_id]
|
|
2306
|
-
delete_keyword_product_set(data)
|
|
2307
|
-
data["product_id"] = product_id
|
|
2308
|
-
__,__,__,res = add_product_set_to_live(data)
|
|
2367
|
+
data = {'headers': {'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkZmQxYjNiMDc0M2JmYWU4YTFkODk4NzczNjgyZWVkZCIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjVlYjkwMzVhYjA5ZDEyNjU4NTFmOTU2ZiJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.Y90xLfYVAp9yByHo7Vc7A3hHrp6hX9X9Lg4mg_WiE_I', 'lang': 'en', 'Content-Type': 'application/json'}, 'product_id': '6787314d323be4000e158d6a', 'env': 'https://front-admin-preview.shoplineapp.com', 'keyword': ['jfjsdjfdfhhdaewqeqe',"ndhsahdsd"], 'sales_id': '95828'}
|
|
2368
|
+
__,__,keyword,res = add_product_set_to_live(data)
|
|
2309
2369
|
print(res)
|
|
2310
2370
|
|
|
2311
2371
|
|
|
File without changes
|
{sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface/PostCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc_common_interface-2.8.2 → sc_common_interface-2.8.4}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|