sc-common-interface 2.4.7__tar.gz → 2.4.9__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.4.7
3
+ Version: 2.4.9
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -282,7 +282,7 @@ def live_search_oa_product(data):
282
282
  """
283
283
  env = data["env"]
284
284
  headers = data["headers"]
285
- url = "%s/openApi/proxy/v1/products?page=1&per_page=20" %env
285
+ url = "%s/openApi/proxy/v1/products?page=1&per_page=50" %env
286
286
  type = "spu"
287
287
  quantity = 100
288
288
  if "type" in data:
@@ -469,10 +469,8 @@ def create_live(data):
469
469
  salesOwner = data["salesOwner"]
470
470
  if "platform" in data:
471
471
  platform = data["platform"]
472
-
473
472
  if "patternModel" in data:
474
473
  patternModel = data["patternModel"]
475
-
476
474
  if "keywordValidInLive" in data:
477
475
  keywordValidInLive = data["keywordValidInLive"]
478
476
  if "keywordValidAfterLive" in data:
@@ -583,20 +581,6 @@ def create_live(data):
583
581
  platformSubType = platform.split("&")[0].upper()
584
582
  data["platform"] = "FACEBOOK"
585
583
  res = get_channel(data)
586
- # expireTime = res["data"][0]["expireTime"]
587
- # expireTimeTimestamp = res["data"][0]["expireTimeTimestamp"]
588
- # validToken = res["data"][0]["validToken"]
589
- # validScope = res["data"][0]["validScope"]
590
- # oneTimeNotifyStatus = res["data"][0]["oneTimeNotifyStatus"]
591
- # mainChannel = res["data"][0]["mainChannel"]
592
- # platformChannelAvatar = res["data"][0]["platformChannelAvatar"]
593
- # platformChannelId = res["data"][0]["platformChannelId"]
594
- # parentChannelId = res["data"][0]["parentChannelId"]
595
- # groupId = res["data"][0]["groupId"]
596
- # platformChannelName = res["data"][0]["platformChannelName"]
597
- # privacy = res["data"][0]["privacy"]
598
- # customerAuthLink = res["data"][0]["customerAuthLink"]
599
- # subscribedStatus = res["data"][0]["subscribedStatus"]
600
584
  body = {
601
585
  "sales": {
602
586
  "title": title,
@@ -684,8 +668,47 @@ def create_live(data):
684
668
  }
685
669
  }
686
670
  }
671
+ elif platform in ("pl","obc"):
672
+ platformSubType = platform.upper()
673
+ platform = "SHOPLINE"
674
+ body = {
675
+ "sales": {
676
+ "title": title,
677
+ "salesOwner": salesOwner,
678
+ "salesDescription": salesDescription,
679
+ "platforms": [
680
+ platform
681
+ ],
682
+ "platformChannels": [],
683
+ "startTime": startTime,
684
+ "endTime": endTime,
685
+ "platformSubType":platformSubType
686
+ },
687
+ "salesConfig": {
688
+ "patternModel": {
689
+ "patternModel": patternModel,
690
+ "keywordValidInLive": keywordValidInLive,
691
+ "keywordValidAfterLive": keywordValidAfterLive
692
+ },
693
+ "autoNotifyPay": {
694
+ "enable": autoNotifyPayEnable,
695
+ "message": autoNotifyPayMessage,
696
+ "button": autoNotifyPayButton
697
+ },
698
+ "stock": {
699
+ "lockStock": stockEnable,
700
+ "salesStockLockExpireTime": stockIime
701
+ },
702
+ "lowOfQuantity": {
703
+ "enable": lowOfQuantityEnable,
704
+ "sound": lowOfQuantitySound,
705
+ "quantity": lowOfQuantityQuantity
706
+ }
707
+ },
708
+ "postConfigMap":{}
709
+ }
687
710
  response = requests.post(url,headers=headers,json=body).json()
688
- print(json.dumps(body))
711
+ # print(json.dumps(body))
689
712
  print(response)
690
713
  sales_id = response["data"]["sales"]["id"]
691
714
  return sales_id
@@ -782,7 +805,6 @@ def edit_live_info(data):
782
805
  keywordValidInLive = data["keywordValidInLive"]
783
806
  if "keywordValidAfterLive" in data:
784
807
  keywordValidAfterLive = data["keywordValidAfterLive"]
785
-
786
808
  if "autoNotifyPayEnable" in data:
787
809
  autoNotifyPayEnable = data["autoNotifyPayEnable"]
788
810
  if "autoNotifyPayMessage" in data:
@@ -791,19 +813,16 @@ def edit_live_info(data):
791
813
  autoNotifyPayButton = data["autoNotifyPayButton"]
792
814
  if "autoNotifyPayTime" in data:
793
815
  autoNotifyPayTime = data["autoNotifyPayTime"]
794
-
795
816
  if "stockEnable" in data:
796
817
  stockEnable = data["stockEnable"]
797
818
  if "stockExpireTime" in data:
798
819
  stockExpireTime = data["stockExpireTime"]
799
-
800
820
  if "lowOfQuantityEnable" in data:
801
821
  lowOfQuantityEnable = data["lowOfQuantityEnable"]
802
822
  if "lowOfQuantitySound" in data:
803
823
  lowOfQuantitySound = data["lowOfQuantitySound"]
804
824
  if "lowOfQuantityQuantity" in data:
805
825
  lowOfQuantityQuantity = data["lowOfQuantityQuantity"]
806
-
807
826
  if "has_interaction_message" in data:
808
827
  has_interaction_message = data["has_interaction_message"]
809
828
  if "has_interaction_message_button" in data:
@@ -824,22 +843,18 @@ def edit_live_info(data):
824
843
  has_link = data["has_link"]
825
844
  if "commentIntent" in data:
826
845
  commentIntent = data["commentIntent"]
827
-
828
846
  if "allOutOfStockMessage" in data:
829
847
  allOutOfStockMessage = data["allOutOfStockMessage"]
830
848
  if "allOutOfStockEnable" in data:
831
849
  allOutOfStockEnable = data["allOutOfStockEnable"]
832
-
833
850
  if "welcomeMessage" in data:
834
851
  welcomeMessage = data["welcomeMessage"]
835
852
  if "welcomeMessageEnable" in data:
836
853
  welcomeMessageEnable = data["welcomeMessageEnable"]
837
-
838
854
  if "welcomeComment" in data:
839
855
  welcomeComment = data["welcomeComment"]
840
856
  if "welcomeCommentEnable" in data:
841
857
  welcomeCommentEnable = data["welcomeCommentEnable"]
842
-
843
858
  if "productRecommendMessage" in data:
844
859
  productRecommendMessage = data["productRecommendMessage"]
845
860
  if "productRecommendMessageEnable" in data:
@@ -847,6 +862,7 @@ def edit_live_info(data):
847
862
  platformChannels = []
848
863
  startTime = None
849
864
  endTime = None
865
+ body = {}
850
866
  if type=="progress":
851
867
  #进行中不允许修改基础设置、关键子下单设置、保留库存、
852
868
  res = get_live_info(data)
@@ -870,8 +886,6 @@ def edit_live_info(data):
870
886
  "platform": platform
871
887
  }
872
888
  platformChannels.append(platformChannel)
873
-
874
- body = {}
875
889
  if platform.upper()=="FB_GROUP":
876
890
  body = {
877
891
  "sales": {
@@ -1107,8 +1121,8 @@ def edit_live_info(data):
1107
1121
  }
1108
1122
  }
1109
1123
  }
1110
- response = requests.put(url,headers=headers,json=body).json()
1111
- return response
1124
+ response = requests.put(url, headers=headers, json=body).json()
1125
+ return response
1112
1126
 
1113
1127
 
1114
1128
  def save_global_config(data):
@@ -1425,8 +1439,4 @@ def remove_live_product(data):
1425
1439
 
1426
1440
 
1427
1441
  if __name__=="__main__":
1428
- data = {'env': 'https://front-admin-preview.shoplineapp.com', 'headers': {'Content-Type': 'application/json', 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIwNmUxNGU2NzAxMWY0ZDNhMGU0ZDgyNDk3ZDAxYmQwZSIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjVmNTlmMTI4MzcyZWIzMDAwNmRjNDcwMSJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.gUqa8FJs_vjRJ-kFMhOZx42QtCr7XxcN3gKSK6_4Zvs', 'lang': 'en'}, 'platform': 'FACEBOOK', 'sales_id': 517320}
1429
- data['type'] = "progress"
1430
- res = edit_live_info(data)
1431
-
1432
- print(res)
1442
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.4.7
3
+ Version: 2.4.9
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.4.7',
5
+ version='2.4.9',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),