sc-common-interface 3.0.2__tar.gz → 3.0.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.
Files changed (17) hide show
  1. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/PKG-INFO +1 -1
  2. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface/LiveCommonInterface.py +123 -16
  3. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface/PostCommonInterface.py +7 -7
  4. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface.egg-info/PKG-INFO +1 -1
  5. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/setup.py +1 -1
  6. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface/CommonOa.py +0 -0
  7. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface/McCommonInterface.py +0 -0
  8. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface/OperaMysql.py +0 -0
  9. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface/OperaRedis.py +0 -0
  10. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface/ScPulsar.py +0 -0
  11. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface/ScWebsocket.py +0 -0
  12. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface/__init__.py +0 -0
  13. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface.egg-info/SOURCES.txt +0 -0
  14. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface.egg-info/dependency_links.txt +0 -0
  15. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface.egg-info/requires.txt +0 -0
  16. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/sc_common_interface.egg-info/top_level.txt +0 -0
  17. {sc_common_interface-3.0.2 → sc_common_interface-3.0.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc_common_interface
3
- Version: 3.0.2
3
+ Version: 3.0.4
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -1770,7 +1770,10 @@ def get_sales_keyword(data):
1770
1770
 
1771
1771
 
1772
1772
  def get_stock_product_set(res, type="stock"):
1773
- """直播间查询OA组合商品信息"""
1773
+ """直播间查询OA组合商品信息
1774
+ stock:查询有库存
1775
+ out:查询无库存
1776
+ """
1774
1777
  list_data = res["data"]["list"]
1775
1778
  if type == "stock":
1776
1779
  for i in list_data:
@@ -1783,7 +1786,7 @@ def get_stock_product_set(res, type="stock"):
1783
1786
  if quantity == -1:
1784
1787
  # print("库存无限数量")
1785
1788
  pass
1786
- elif quantity > count:
1789
+ elif quantity < count:
1787
1790
  break
1788
1791
  keyword = combination["keywords"][0]
1789
1792
  product_id = i["id"]
@@ -2507,27 +2510,33 @@ def add_product_to_live(data):
2507
2510
  def send_comment():
2508
2511
  timStamp = int(time.time())
2509
2512
 
2510
- key = "a2f4cae7b637eb42967ef5ab6a6a3ff7"
2511
- url = "https://front-service.shoplinestg.com/facebook/webhook"
2512
- post_id = "119305964434044_9672903432799494"
2513
- page_id = "119305964434044"
2513
+ # key = "a2f4cae7b637eb42967ef5ab6a6a3ff7"
2514
+ # url = "https://front-service.shoplinestg.com/facebook/webhook"
2515
+ # post_id = "119305964434044_1342551670179146"
2516
+ # page_id = "119305964434044"
2514
2517
 
2515
2518
  # message = "fb文3本消息%d"%timStamp
2516
2519
  # message = "%d" % random.randint(3, 999)
2517
- message = "个哈哈哈"
2520
+ message = "方法"
2518
2521
 
2519
2522
  # 生产
2520
- # key = 'a2f4cae7b637eb42967ef5ab6a6a3ff7'
2521
- # url = 'https://front-admin.shoplineapp.com/facebook/webhook'
2522
- # post_id = "107977035056574_1226869379002413"
2523
- # page_id = "107977035056574"
2523
+ key = 'a2f4cae7b637eb42967ef5ab6a6a3ff7'
2524
+ url = 'https://front-admin.shoplineapp.com/facebook/webhook'
2525
+ post_id = "107977035056574_1829322521133522"
2526
+ page_id = "107977035056574"
2527
+
2528
+ #预发
2529
+ # key = '5e3bba98882fc0fb22a0607238bc5b8f'
2530
+ # url = 'https://front-admin-preview.shoplineapp.com/facebook/webhook'
2531
+ # post_id = "106411048594439_1764064707792500"
2532
+ # page_id = "106411048594439"
2524
2533
 
2525
2534
  randnum = random.randint(1, 1000)
2526
2535
  user_id = "4724508317%d%d" % (timStamp, randnum)
2527
2536
  # user_id = "47245083171744792310"0
2528
2537
  name = "️%d%dtest" % (randnum, timStamp)
2529
2538
  contentbody = {"entry": [{"id": page_id, "time": timStamp, "changes": [{"value": {
2530
- "from": {"id": user_id, "name": name},
2539
+ "from": {"id": user_id,"name":name},
2531
2540
  "post": {"status_type": "added_video", "is_published": True, "updated_time": "2024-10-16T13:28:29+0000",
2532
2541
  "permalink_url": "https://www.facebook.com/161726309710099/videos/3266941630279674",
2533
2542
  "promotion_status": "inactive", "id": post_id}, "message": message, "post_id": post_id,
@@ -2536,6 +2545,7 @@ def send_comment():
2536
2545
  "parent_id": post_id, "verb": "add"}, "field": "feed"}]}], "object": "page"}
2537
2546
  # print("contentbody", contentbody)
2538
2547
  # contentbody["entry"][0]["time"] = time
2548
+ print(contentbody)
2539
2549
 
2540
2550
  signdata = hmac.new(key.encode('utf-8'), json.dumps(contentbody).encode('utf-8'), hashlib.sha1).hexdigest()
2541
2551
  signdata = signdata
@@ -2543,12 +2553,109 @@ def send_comment():
2543
2553
  headers = {"Content-Type": "application/json", "x-hub-signature": "sha1=%s" % signdata}
2544
2554
  res = requests.post(url, headers=headers, data=contentbody)
2545
2555
  # print(res.content)
2556
+ def create_single_product(data):
2557
+ """
2558
+ 新增无规格商品
2559
+ :param data:
2560
+ :return: 返回新增的商品的spu_id
2561
+ """
2562
+ env = data["env"]
2563
+ headers = data["headers"]
2564
+ sales_id = data["sales_id"]
2565
+ quantity = 1000
2566
+ if "quantity" in data:
2567
+ quantity = data["quantity"]
2568
+ url = "%s/api/posts/post/sales/%s/product/create" % (env, sales_id)
2569
+ product_name = "post接口新增商品多规格商品名称%d" % int(time.time())
2570
+ if "product_name" in data:
2571
+ product_name = data["product_name"]
2572
+ keyword = "post接口新增商品多规格商品关键字%d" % int(time.time())
2573
+ if "keyword" in data:
2574
+ keyword = data["keyword"]
2575
+ body = {"customNumber": keyword, "quantity": quantity, "unlimitedQuantity": False, "productName": product_name,
2576
+ "imageUrl": "https://s3-ap-southeast-1.amazonaws.com/static.shoplineapp.com/sc-admin/product-default.png",
2577
+ "price": 3}
2578
+ response = requests.post(url, headers=headers, json=body).json()
2579
+ spu_id = response["data"]
2580
+ return spu_id
2581
+
2582
+
2583
+
2584
+ def get_bulk_edit_keyword(data):
2585
+ global customNumber, pre_keyword, spu
2586
+ keyword_type = data.get("keyword_type","keyList")
2587
+ if keyword_type=="customNumber":
2588
+ customNumber = "前和后关键字%d"%int(time.time())
2589
+ customNumber = data.get("customNumber",customNumber)
2590
+ elif keyword_type=="keyList":
2591
+ pre_keyword = "前缀关键字%d"%int(time.time())
2592
+ pre_keyword = data.get("keyList", pre_keyword)
2593
+ #拿到直播间商品信息
2594
+ response = get_live_product(data)
2595
+ product_page_result = response["data"]["product_page_result"]["list"]
2596
+ spuList = []
2597
+ bulk_edit_body = {"spuList":spuList}
2598
+ if product_page_result!=[]:
2599
+ for product in product_page_result:
2600
+ spu = {}
2601
+ product_info = product["product_info"]
2602
+ product_id = product_info["id"]
2603
+ spu["spuId"] = product_id
2604
+ spu["defaultKey"] = ""
2605
+ if keyword_type=="customNumber":
2606
+ spu["customNumbers"] = [customNumber]
2607
+ else:
2608
+ spu["customNumbers"] = []
2609
+ sku_product_list = product["sku_product_list"]
2610
+ sku_list = []
2611
+ num = 1
2612
+ for sku in sku_product_list:
2613
+ sku_dict = {}
2614
+ sku_id = sku["sku_id"]
2615
+ sku_dict["skuId"] = sku_id
2616
+ if keyword_type=="customNumber":
2617
+ sku_dict["keyList"] = []
2618
+ else:
2619
+ keyword = pre_keyword+str(num)
2620
+ sku_dict["keyList"] = [keyword]
2621
+ num+=1
2622
+ sku_list.append(sku_dict)
2623
+ spu["skuList"] = sku_list
2624
+ break
2625
+ spuList.append(spu)
2626
+ else:
2627
+ # 给直播间创建商品
2628
+ spu_id = create_single_product(data)
2629
+ spu = {}
2630
+ spu["spuId"] = spu_id
2631
+ spu["defaultKey"] = ""
2632
+ if keyword_type == "customNumber":
2633
+ spu["customNumbers"] = [customNumber]
2634
+ else:
2635
+ spu["customNumbers"] = []
2636
+ skuList = []
2637
+ sku = {}
2638
+ sku["skuId"] = spu_id
2639
+ if keyword_type == "customNumber":
2640
+ sku["keyList"] = []
2641
+ else:
2642
+ sku["keyList"] = [pre_keyword]
2643
+ skuList.append(sku)
2644
+ spu["skuList"] = skuList
2645
+ spuList.append(spu)
2646
+ return bulk_edit_body
2647
+
2648
+
2649
+
2650
+
2651
+
2652
+
2546
2653
 
2547
2654
 
2548
2655
  if __name__ == "__main__":
2549
- data = {'env': 'https://front-admin-preview.shoplineapp.com', 'headers': {'Content-Type': 'application/json', 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIzMzA5NzFkNWE3ODIwYjBhN2Y1NjQzM2UyOGEwZDFmZSIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjYyN2M3NTBhMDYyMzcwMDAwYWZlNWVmZCJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.AmO49bUXC-bpV0Oij3FCHv5PDI728EhBnXm_sK-yyBE', 'lang': 'en', 'user-agent': 'ShoplineQuality/1.5-python'}, 'sales_id': 583226}
2550
- data["activity_id"] = 10324333
2551
- res = start_activity(data)
2552
- print(res)
2656
+ for i in range(60):
2657
+ send_comment()
2658
+
2659
+
2553
2660
 
2554
2661
 
@@ -305,12 +305,12 @@ def modify_lucky_draw(data):
305
305
  tagFriendsNum = 0
306
306
  if "tagFriendsNum" in data:
307
307
  tagFriendsNum = data["tagFriendsNum"]
308
- taskTypes = ["COMMENT"]
309
- if "taskTypes" in data:
310
- if "taskTypes" =="order":
311
- taskTypes = ["HAD_ORDER", "COMMENT"]
312
- elif "taskTypes" == "like":
313
- taskTypes = ["LIKED_POST", "COMMENT"]
308
+ taskTypes = data.get("taskTypes",["COMMENT"])
309
+ # if "taskTypes" in data:
310
+ # if "taskTypes" =="order":
311
+ # taskTypes = ["HAD_ORDER", "COMMENT"]
312
+ # elif "taskTypes" == "like":
313
+ # taskTypes = ["LIKED_POST", "COMMENT"]
314
314
  activityInfo = {"keyword": keyword, "autoAward": autoAward, "tagFriendsNum": tagFriendsNum, "taskTypes": taskTypes}
315
315
  winReplyComment = "🎁 恭喜您中奖!请与小编联系确认领奖细节!"
316
316
  if "winReplyComment" in data:
@@ -877,6 +877,7 @@ def get_comment_user(data):
877
877
  query = data["query"]
878
878
  params["query"] = query
879
879
  url = "%s/api/posts/post/comments"%env
880
+ # print(params)
880
881
  response = requests.get(url, headers=headers,params=params).json()
881
882
  print(response)
882
883
  post_user_id = jsonpath(response, "$..id")[0]
@@ -1716,4 +1717,3 @@ def edit_message(data):
1716
1717
 
1717
1718
  if __name__=="__main__":
1718
1719
  pass
1719
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 3.0.2
3
+ Version: 3.0.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='3.0.2',
5
+ version='3.0.4',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),