sc-common-interface 2.4.2__tar.gz → 2.4.3__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.2
3
+ Version: 2.4.3
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -411,6 +411,12 @@ def create_live(data):
411
411
  salesDescription = "接口创建的直播活动介绍%d"%stamp
412
412
  salesOwner = "接口创建的直播主%d"%stamp
413
413
  platform = "FB_GROUP"
414
+ if "title" in data:
415
+ title = data["title"]
416
+ if "salesDescription" in data:
417
+ title = data["salesDescription"]
418
+ if "salesOwner" in data:
419
+ title = data["salesOwner"]
414
420
  if "platform" in data:
415
421
  platform = data["platform"]
416
422
  patternModel = "INCLUDE_MATCH"
@@ -474,6 +480,7 @@ def create_live(data):
474
480
  # message_button = data["message_button"]
475
481
  if "has_link" in data:
476
482
  has_link = data["has_link"]
483
+ platform = platform.upper()
477
484
  body = {
478
485
  "sales": {
479
486
  "title": title,
@@ -555,6 +562,256 @@ def add_live(data):
555
562
  return response
556
563
 
557
564
 
565
+ def get_live_info(data):
566
+ """查询直播间信息"""
567
+ env = data["env"]
568
+ headers = data["headers"]
569
+ sales_id = data["sales_id"]
570
+ url = "%s/api/posts/live/sales/%s" % (env, sales_id)
571
+ response = requests.get(url,headers=headers).json()
572
+ return response
573
+
574
+ def edit_live_info(data):
575
+ """编辑直播间信息"""
576
+ stamp = int(time.time())
577
+ env = data["env"]
578
+ headers = data["headers"]
579
+ sales_id = data["sales_id"]
580
+ url = "%s/api/posts/live/sales/%s" % (env, sales_id)
581
+ title = "接口编辑的直播活动名称%d" % stamp
582
+ salesDescription = "接口编辑的直播活动介绍%d" % stamp
583
+ salesOwner = "接口编辑的直播主%d" % stamp
584
+ platform = "FB_GROUP"
585
+ if "title" in data:
586
+ title = data["title"]
587
+ if "salesDescription" in data:
588
+ title = data["salesDescription"]
589
+ if "salesOwner" in data:
590
+ title = data["salesOwner"]
591
+ if "platform" in data:
592
+ platform = data["platform"]
593
+ patternModel = "INCLUDE_MATCH"
594
+ if "patternModel" in data:
595
+ patternModel = data["patternModel"]
596
+ keywordValidInLive = True
597
+ keywordValidAfterLive = False
598
+ if "keywordValidInLive" in data:
599
+ keywordValidInLive = data["keywordValidInLive"]
600
+ if "keywordValidAfterLive" in data:
601
+ keywordValidAfterLive = data["keywordValidAfterLive"]
602
+ autoNotifyPayEnable = False
603
+ autoNotifyPayMessage = ""
604
+ autoNotifyPayButton = ""
605
+ autoNotifyPayTime = None
606
+ if "autoNotifyPayEnable" in data:
607
+ autoNotifyPayEnable = data["autoNotifyPayEnable"]
608
+ if "autoNotifyPayMessage" in data:
609
+ autoNotifyPayMessage = data["autoNotifyPayMessage"]
610
+ if "autoNotifyPayButton" in data:
611
+ autoNotifyPayButton = data["autoNotifyPayButton"]
612
+ if "autoNotifyPayTime" in data:
613
+ autoNotifyPayTime = data["autoNotifyPayTime"]
614
+
615
+ stockEnable = False
616
+ stockPreTime = None
617
+ stockExpireTime = None
618
+ if "stockEnable" in data:
619
+ stockEnable = data["stockEnable"]
620
+ if "stockExpireTime" in data:
621
+ stockExpireTime = data["stockExpireTime"]
622
+
623
+ lowOfQuantityEnable = False
624
+ lowOfQuantitySound = False
625
+ lowOfQuantityQuantity = "1"
626
+ if "lowOfQuantityEnable" in data:
627
+ lowOfQuantityEnable = data["lowOfQuantityEnable"]
628
+ if "lowOfQuantitySound" in data:
629
+ lowOfQuantitySound = data["lowOfQuantitySound"]
630
+ if "lowOfQuantityQuantity" in data:
631
+ lowOfQuantityQuantity = data["lowOfQuantityQuantity"]
632
+
633
+ has_interaction_message = ""
634
+ has_interaction_message_button = ""
635
+ no_interaction_message_first = ""
636
+ second_message = ""
637
+ first_message_button = ""
638
+ second_message_button = " ️"
639
+ need_send_message = True
640
+ # message_button = "立即结帐️"
641
+ has_link = True
642
+ if "has_interaction_message" in data:
643
+ has_interaction_message = data["has_interaction_message"]
644
+ if "has_interaction_message_button" in data:
645
+ has_interaction_message_button = data["has_interaction_message_button"]
646
+ if "no_interaction_message_first" in data:
647
+ no_interaction_message_first = data["no_interaction_message_first"]
648
+ if "first_message_button" in data:
649
+ first_message_button = data["first_message_button"]
650
+ if "second_message" in data:
651
+ second_message = data["second_message"]
652
+ if "second_message_button" in data:
653
+ second_message_button = data["second_message_button"]
654
+ if "need_send_message" in data:
655
+ need_send_message = data["need_send_message"]
656
+ # if "message_button" in data:
657
+ # message_button = data["message_button"]
658
+ if "has_link" in data:
659
+ has_link = data["has_link"]
660
+
661
+ commentIntent = True
662
+ if "commentIntent" in data:
663
+ commentIntent = data["commentIntent"]
664
+
665
+ #无库存讯息
666
+ allOutOfStockMessage = ""
667
+ allOutOfStockEnable = True
668
+ if "allOutOfStockMessage" in data:
669
+ allOutOfStockMessage = data["allOutOfStockMessage"]
670
+ if "allOutOfStockEnable" in data:
671
+ allOutOfStockEnable = data["allOutOfStockEnable"]
672
+ #欢迎讯息
673
+ welcomeMessage = ""
674
+ welcomeMessageEnable = True
675
+ if "welcomeMessage" in data:
676
+ welcomeMessage = data["welcomeMessage"]
677
+ if "welcomeMessageEnable" in data:
678
+ welcomeMessageEnable = data["welcomeMessageEnable"]
679
+ # 欢迎comment
680
+ welcomeComment = ""
681
+ welcomeCommentEnable = True
682
+ if "welcomeComment" in data:
683
+ welcomeComment = data["welcomeComment"]
684
+ if "welcomeCommentEnable" in data:
685
+ welcomeCommentEnable = data["welcomeCommentEnable"]
686
+ productRecommendMessage = ""
687
+ productRecommendMessageEnable = True
688
+ if "productRecommendMessage" in data:
689
+ productRecommendMessage = data["productRecommendMessage"]
690
+ if "productRecommendMessageEnable" in data:
691
+ productRecommendMessageEnable = data["productRecommendMessageEnable"]
692
+
693
+
694
+
695
+ platform = platform.upper()
696
+ body = {
697
+ "sales": {
698
+ "title": title,
699
+ "salesOwner": salesOwner,
700
+ "salesDescription": salesDescription,
701
+ "platforms": [
702
+ platform
703
+ ],
704
+ "platformSubType": "",
705
+ "platformChannels": [],
706
+ "archivedStreamVisibleTime": None
707
+ },
708
+ "salesConfig": {
709
+ "patternModel": {
710
+ "patternModel": patternModel,
711
+ "keywordValidInLive": keywordValidInLive,
712
+ "keywordValidAfterLive": keywordValidAfterLive
713
+ },
714
+ "autoNotifyPay": {
715
+ "enable": autoNotifyPayEnable,
716
+ "notifyTime": autoNotifyPayTime,
717
+ "message": autoNotifyPayMessage,
718
+ "button": autoNotifyPayButton
719
+ },
720
+ "stock": {
721
+ "lockStock": stockEnable,
722
+ "salesStockLockExpireTime": stockExpireTime,
723
+ "salesStockLockPreTime": stockPreTime
724
+ },
725
+ "commentIntent": {
726
+ "enabled": commentIntent
727
+ },
728
+ "variationToggleOn": {
729
+ "enable": True
730
+ },
731
+ "productSort": {
732
+ "productSort": "NEW_TO_OLD"
733
+ },
734
+ "lowOfQuantity": {
735
+ "enable": lowOfQuantityEnable,
736
+ "sound": lowOfQuantitySound,
737
+ "quantity": lowOfQuantityQuantity
738
+ },
739
+ "notice": None,
740
+ "frontLive": None,
741
+ "liveViewSdk": None,
742
+ "runningLightsConfig": None,
743
+ "fbGroupSettingConfig": {
744
+ "scGroupPmCommentId": True,
745
+ "scGroupWebhook": True
746
+ },
747
+ "productPinningStyle": None
748
+ },
749
+ "postConfigMap": {
750
+ platform: {
751
+ "message": {
752
+ "needSendMessage": need_send_message,
753
+ "hasInteractionMessage": {
754
+ "firstMessageTemplate": {
755
+ "topMessage": has_interaction_message
756
+ },
757
+ "messageButton": has_interaction_message_button
758
+ },
759
+ "hasLink": has_link,
760
+ "noInteractionMessage": {
761
+ "firstMessageTemplate": {
762
+ "topMessage": no_interaction_message_first
763
+ },
764
+ "firstMessageButton": first_message_button,
765
+ "secondMessageTemplate": {
766
+ "topMessage": second_message
767
+ },
768
+ "secondMessageButton": second_message_button
769
+ },
770
+ "messageType": "MESSAGE"
771
+ },
772
+ "allOutOfStockMessage": {
773
+ "needSendMessage": allOutOfStockEnable,
774
+ "hasInteractionMessage": {
775
+ "firstMessageTemplate": {
776
+ "topMessage": allOutOfStockMessage
777
+ }
778
+ },
779
+ "messageType": "ALL_OUT_OF_STOCK"
780
+ },
781
+ "welcomeMessage": {
782
+ "needSendMessage": welcomeMessageEnable,
783
+ "hasInteractionMessage": {
784
+ "firstMessageTemplate": {
785
+ "topMessage": welcomeMessage
786
+ }
787
+ },
788
+ "messageType": "WELCOME_MESSAGE"
789
+ },
790
+ "productRecommendMessage": {
791
+ "needSendMessage": productRecommendMessageEnable,
792
+ "hasInteractionMessage": {
793
+ "firstMessageTemplate": {
794
+ "message": productRecommendMessage
795
+ }
796
+ },
797
+ "messageType": "PRODUCT_RECOMMEND_FB_MESSAGE"
798
+ },
799
+ "welcomeMessageComment": {
800
+ "needSendMessage": welcomeCommentEnable,
801
+ "hasInteractionMessage": {
802
+ "firstMessageTemplate": {
803
+ "topMessage": welcomeComment
804
+ }
805
+ },
806
+ "messageType": "WELCOME_MESSAGE_COMMENT"
807
+ },
808
+ "showNumberOfViewers": None,
809
+ "showShareButton": None
810
+ }
811
+ }
812
+ }
813
+ response = requests.put(url,headers=headers,json=body).json()
814
+ return response
558
815
 
559
816
 
560
817
 
@@ -565,4 +822,4 @@ def add_live(data):
565
822
 
566
823
 
567
824
  if __name__=="__main__":
568
- pass
825
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.4.2
3
+ Version: 2.4.3
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.2',
5
+ version='2.4.3',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),