sc-common-interface 2.4.1__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.1
3
+ Version: 2.4.3
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -411,9 +411,76 @@ 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"
423
+ if "patternModel" in data:
424
+ patternModel = data["patternModel"]
425
+ keywordValidInLive = True
426
+ keywordValidAfterLive =False
427
+ if "keywordValidInLive" in data:
428
+ keywordValidInLive = data["keywordValidInLive"]
429
+ if "keywordValidAfterLive" in data:
430
+ keywordValidAfterLive = data["keywordValidAfterLive"]
431
+ autoNotifyPayEnable = False
432
+ autoNotifyPayMessage = ""
433
+ autoNotifyPayButton = ""
434
+ if "autoNotifyPayEnable" in data:
435
+ autoNotifyPayEnable = data["autoNotifyPayEnable"]
436
+ if "autoNotifyPayMessage" in data:
437
+ autoNotifyPayMessage = data["autoNotifyPayMessage"]
438
+ if "autoNotifyPayButton" in data:
439
+ autoNotifyPayButton = data["autoNotifyPayButton"]
440
+ stockEnable = False
441
+ stockIime = None
442
+ if "stockEnable" in data:
443
+ stockEnable = data["stockEnable"]
444
+ if "stockIime" in data:
445
+ stockIime = data["stockIime"]
446
+ lowOfQuantityEnable = False
447
+ lowOfQuantitySound = False
448
+ lowOfQuantityQuantity = "1"
449
+ if "lowOfQuantityEnable" in data:
450
+ lowOfQuantityEnable = data["lowOfQuantityEnable"]
451
+ if "lowOfQuantitySound" in data:
452
+ lowOfQuantitySound = data["lowOfQuantitySound"]
453
+ if "lowOfQuantityQuantity" in data:
454
+ lowOfQuantityQuantity = data["lowOfQuantityQuantity"]
455
+
456
+ has_interaction_message = ""
457
+ has_interaction_message_button = ""
458
+ no_interaction_message_first = ""
459
+ second_message = ""
460
+ first_message_button = ""
461
+ second_message_button = " ️"
462
+ need_send_message = True
463
+ # message_button = "立即结帐️"
464
+ has_link = True
465
+ if "has_interaction_message" in data:
466
+ has_interaction_message = data["has_interaction_message"]
467
+ if "has_interaction_message_button" in data:
468
+ has_interaction_message_button = data["has_interaction_message_button"]
469
+ if "no_interaction_message_first" in data:
470
+ no_interaction_message_first = data["no_interaction_message_first"]
471
+ if "first_message_button" in data:
472
+ first_message_button = data["first_message_button"]
473
+ if "second_message" in data:
474
+ second_message = data["second_message"]
475
+ if "second_message_button" in data:
476
+ second_message_button = data["second_message_button"]
477
+ if "need_send_message" in data:
478
+ need_send_message = data["need_send_message"]
479
+ # if "message_button" in data:
480
+ # message_button = data["message_button"]
481
+ if "has_link" in data:
482
+ has_link = data["has_link"]
483
+ platform = platform.upper()
417
484
  body = {
418
485
  "sales": {
419
486
  "title": title,
@@ -426,45 +493,45 @@ def create_live(data):
426
493
  },
427
494
  "salesConfig": {
428
495
  "patternModel": {
429
- "patternModel": "INCLUDE_MATCH",
430
- "keywordValidInLive": False,
431
- "keywordValidAfterLive": False
496
+ "patternModel": patternModel,
497
+ "keywordValidInLive": keywordValidInLive,
498
+ "keywordValidAfterLive": keywordValidAfterLive
432
499
  },
433
500
  "autoNotifyPay": {
434
- "enable": False,
435
- "message": "",
436
- "button": ""
501
+ "enable": autoNotifyPayEnable,
502
+ "message": autoNotifyPayMessage,
503
+ "button": autoNotifyPayButton
437
504
  },
438
505
  "stock": {
439
- "lockStock": False,
440
- "salesStockLockExpireTime": None
506
+ "lockStock": stockEnable,
507
+ "salesStockLockExpireTime": stockIime
441
508
  },
442
509
  "lowOfQuantity": {
443
- "enable": True,
444
- "sound": False,
445
- "quantity": "1"
510
+ "enable": lowOfQuantityEnable,
511
+ "sound": lowOfQuantitySound,
512
+ "quantity": lowOfQuantityQuantity
446
513
  }
447
514
  },
448
515
  "postConfigMap": {
449
516
  platform: {
450
517
  "message": {
451
- "needSendMessage": True,
518
+ "needSendMessage": need_send_message,
452
519
  "hasInteractionMessage": {
453
520
  "firstMessageTemplate": {
454
- "topMessage": ""
521
+ "topMessage": has_interaction_message
455
522
  },
456
- "messageButton": ""
523
+ "messageButton": has_interaction_message_button
457
524
  },
458
- "hasLink": True,
525
+ "hasLink": has_link,
459
526
  "noInteractionMessage": {
460
527
  "firstMessageTemplate": {
461
- "topMessage": ""
528
+ "topMessage": no_interaction_message_first
462
529
  },
463
- "firstMessageButton": "",
530
+ "firstMessageButton": first_message_button,
464
531
  "secondMessageTemplate": {
465
- "topMessage": ""
532
+ "topMessage": second_message
466
533
  },
467
- "secondMessageButton": ""
534
+ "secondMessageButton": second_message_button
468
535
  },
469
536
  "messageType": "MESSAGE"
470
537
  }
@@ -495,6 +562,256 @@ def add_live(data):
495
562
  return response
496
563
 
497
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
498
815
 
499
816
 
500
817
 
@@ -505,4 +822,4 @@ def add_live(data):
505
822
 
506
823
 
507
824
  if __name__=="__main__":
508
- pass
825
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.4.1
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.1',
5
+ version='2.4.3',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),