sc-common-interface 2.4.4__tar.gz → 2.4.6__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.4
3
+ Version: 2.4.6
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -175,6 +175,12 @@ def send_mc_message(data):
175
175
  elif type=="postback" and platform.upper() in ("FB_GROUP","FACEBOOK"):
176
176
  # t_time = stamp * 1000
177
177
  body = {"object":"page","entry":[{"time":stamp,"id":"%s"%page_id,"messaging":[{"sender":{"id":"%s"%user_id},"recipient":{"id":"%s"%page_id},"timestamp":stamp,"postback":{"title":"继续 ➡️","payload":payload,"mid":"m_w6KNGd0PMndK0LvCw7Hzy1zsVSWT0fpN3ievQ9LtB0NxnnTQGDMyKI5DFeVbaJIRni1cqqJYXIJ-wq98aw%d"%stamp}}]}]}
178
+ elif type=="postback" and platform.lower()=="instagram":
179
+ body = {"object": "instagram", "entry": [{"time": stamp, "id": "%s" % page_id, "messaging": [
180
+ {"sender": {"id": "%s" % user_id}, "recipient": {"id": "%s" % page_id}, "timestamp": stamp,
181
+ "postback": {"title": "继续 ➡️", "payload": payload,
182
+ "mid": "m_w6KNGd0PMndK0LvCw7Hzy1zsVSWT0fpN3ievQ9LtB0NxnnTQGDMyKI5DFeVbaJIRni1cqqJYXIJ-wq98aw%d" % stamp}}]}]}
183
+
178
184
  url = "%s/facebook/webhook" % env
179
185
  sign_text = hmac.new(key.encode("utf-8"), json.dumps(body).encode("utf-8"), sha1)
180
186
  signData = sign_text.hexdigest()
@@ -194,6 +200,15 @@ def get_live_info(data):
194
200
  response = requests.get(url,headers=headers).json()
195
201
  return response
196
202
 
203
+ def get_live_product(data):
204
+ env = data["env"]
205
+ headers = data["headers"]
206
+ sales_id = data["sales_id"]
207
+ url = "%s/api/posts/post/sales/%s/product/v2" % (env, sales_id)
208
+ params = {"salesId":sales_id,"pageIndex":1,"pageSize":25}
209
+ response = requests.get(url, headers=headers,params=params).json()
210
+ return response
211
+
197
212
  def get_activity_detail(data):
198
213
  """
199
214
  type:
@@ -328,6 +343,7 @@ def get_merchant_info(data):
328
343
  url = "%s/openApi/proxy/v1/merchants/%s" % (env,merchant_id)
329
344
  response = requests.get(url, headers=headers).json()
330
345
  base_country_code = response["data"]["base_country_code"]
346
+ default_language_code = response["data"]["default_language_code"]
331
347
  currency = ""
332
348
  if base_country_code=="TW":
333
349
  currency="NT$"
@@ -450,7 +466,7 @@ def create_live(data):
450
466
  if "salesDescription" in data:
451
467
  title = data["salesDescription"]
452
468
  if "salesOwner" in data:
453
- title = data["salesOwner"]
469
+ salesOwner = data["salesOwner"]
454
470
  if "platform" in data:
455
471
  platform = data["platform"]
456
472
 
@@ -582,92 +598,92 @@ def create_live(data):
582
598
  # customerAuthLink = res["data"][0]["customerAuthLink"]
583
599
  # subscribedStatus = res["data"][0]["subscribedStatus"]
584
600
  body = {
585
- "sales": {
586
- "title": title,
587
- "salesOwner": salesOwner,
588
- "salesDescription": salesDescription,
589
- "platforms": [
590
- "SHOPLINE",
591
- "FACEBOOK"
592
- ],
593
- "platformSubType": platformSubType,
594
- "platformChannels": [
595
- res["data"][0]
596
- ],
597
- "startTime":startTime ,
598
- "endTime": endTime
599
- },
600
- "salesConfig": {
601
- "patternModel": {
602
- "patternModel": patternModel,
603
- "keywordValidInLive": keywordValidInLive,
604
- "keywordValidAfterLive": keywordValidAfterLive
605
- },
606
- "autoNotifyPay": {
607
- "enable": autoNotifyPayEnable,
608
- "message": autoNotifyPayMessage,
609
- "button": autoNotifyPayButton,
610
- "notifyTime": autoNotifyPayTime
601
+ "sales": {
602
+ "title": title,
603
+ "salesOwner": salesOwner,
604
+ "salesDescription": salesDescription,
605
+ "platforms": [
606
+ "SHOPLINE",
607
+ "FACEBOOK"
608
+ ],
609
+ "platformSubType": platformSubType,
610
+ "platformChannels": [
611
+ res["data"][0]
612
+ ],
613
+ "startTime":startTime ,
614
+ "endTime": endTime
611
615
  },
612
- "stock": {
613
- "lockStock": stockEnable,
614
- "salesStockLockExpireTime": stockIime
616
+ "salesConfig": {
617
+ "patternModel": {
618
+ "patternModel": patternModel,
619
+ "keywordValidInLive": keywordValidInLive,
620
+ "keywordValidAfterLive": keywordValidAfterLive
621
+ },
622
+ "autoNotifyPay": {
623
+ "enable": autoNotifyPayEnable,
624
+ "message": autoNotifyPayMessage,
625
+ "button": autoNotifyPayButton,
626
+ "notifyTime": autoNotifyPayTime
627
+ },
628
+ "stock": {
629
+ "lockStock": stockEnable,
630
+ "salesStockLockExpireTime": stockIime
631
+ },
632
+ "lowOfQuantity": {
633
+ "enable": lowOfQuantityEnable,
634
+ "sound": lowOfQuantitySound,
635
+ "quantity": lowOfQuantityQuantity
636
+ }
615
637
  },
616
- "lowOfQuantity": {
617
- "enable": lowOfQuantityEnable,
618
- "sound": lowOfQuantitySound,
619
- "quantity": lowOfQuantityQuantity
620
- }
621
- },
622
- "postConfigMap": {
623
- "FACEBOOK": {
624
- "message": {
625
- "needSendMessage": need_send_message,
626
- "hasInteractionMessage": {
627
- "firstMessageTemplate": {
628
- "topMessage": has_interaction_message
638
+ "postConfigMap": {
639
+ "FACEBOOK": {
640
+ "message": {
641
+ "needSendMessage": need_send_message,
642
+ "hasInteractionMessage": {
643
+ "firstMessageTemplate": {
644
+ "topMessage": has_interaction_message
645
+ },
646
+ "messageButton": has_interaction_message_button
629
647
  },
630
- "messageButton": has_interaction_message_button
631
- },
632
- "hasLink": has_link,
633
- "noInteractionMessage": {
634
- "firstMessageTemplate": {
635
- "topMessage": no_interaction_message_first
648
+ "hasLink": has_link,
649
+ "noInteractionMessage": {
650
+ "firstMessageTemplate": {
651
+ "topMessage": no_interaction_message_first
652
+ },
653
+ "firstMessageButton": first_message_button,
654
+ "secondMessageButton": second_message_button,
655
+ "secondMessageTemplate": {
656
+ "topMessage": second_message
657
+ }
636
658
  },
637
- "firstMessageButton": first_message_button,
638
- "secondMessageButton": second_message_button,
639
- "secondMessageTemplate": {
640
- "topMessage": second_message
641
- }
642
- },
643
- "messageType": "MESSAGE"
644
- }
645
- },
646
- "SHOPLINE": {
647
- "message": {
648
- "needSendMessage": need_send_message,
649
- "hasInteractionMessage": {
650
- "firstMessageTemplate": {
651
- "topMessage": has_interaction_message
659
+ "messageType": "MESSAGE"
660
+ }
661
+ },
662
+ "SHOPLINE": {
663
+ "message": {
664
+ "needSendMessage": need_send_message,
665
+ "hasInteractionMessage": {
666
+ "firstMessageTemplate": {
667
+ "topMessage": has_interaction_message
668
+ },
669
+ "messageButton": has_interaction_message_button
652
670
  },
653
- "messageButton": has_interaction_message_button
654
- },
655
- "hasLink": has_link,
656
- "noInteractionMessage": {
657
- "firstMessageTemplate": {
658
- "topMessage": no_interaction_message_first
671
+ "hasLink": has_link,
672
+ "noInteractionMessage": {
673
+ "firstMessageTemplate": {
674
+ "topMessage": no_interaction_message_first
675
+ },
676
+ "firstMessageButton": first_message_button,
677
+ "secondMessageButton": second_message_button,
678
+ "secondMessageTemplate": {
679
+ "topMessage": second_message
680
+ }
659
681
  },
660
- "firstMessageButton": first_message_button,
661
- "secondMessageButton": second_message_button,
662
- "secondMessageTemplate": {
663
- "topMessage": second_message
682
+ "messageType": "MESSAGE"
664
683
  }
665
- },
666
- "messageType": "MESSAGE"
667
684
  }
668
685
  }
669
686
  }
670
- }
671
687
  response = requests.post(url,headers=headers,json=body).json()
672
688
  print(json.dumps(body))
673
689
  print(response)
@@ -983,10 +999,12 @@ def save_global_config(data):
983
999
  # 欢迎comment
984
1000
  welcomeComment = ""
985
1001
  welcomeCommentEnable = True
1002
+ #推荐讯息
986
1003
  fbProductRecommendMessage = ""
987
1004
  igProductRecommendMessage = ""
988
1005
  slProductRecommendMessage = ""
989
1006
  # productRecommendMessageEnable = True
1007
+ #视频观看人数
990
1008
  show_number = True
991
1009
  show_share = True
992
1010
 
@@ -1243,6 +1261,15 @@ outOfStock = {
1243
1261
 
1244
1262
 
1245
1263
 
1264
+ def remove_live_product(data):
1265
+ env = data["env"]
1266
+ headers = data["headers"]
1267
+ sales_id = data["sales_id"]
1268
+ product_id = data["product_id"]
1269
+ url = "%s/api/posts/post/sales/%s/product/%s"%(env,sales_id,product_id)
1270
+ response = requests.delete(url,headers=headers).json()
1271
+ return response
1272
+
1246
1273
 
1247
1274
 
1248
1275
 
@@ -846,8 +846,11 @@ def get_comment_user(data):
846
846
  env = data["env"]
847
847
  headers = data["headers"]
848
848
  sales_id = data["sales_id"]
849
- url = "%s/api/posts/post/comments"%env
850
849
  params = {"pageNo":1,"pageSize":10,"salesId":sales_id}
850
+ if "query" in data:
851
+ query = data["query"]
852
+ params["query"] = query
853
+ url = "%s/api/posts/post/comments"%env
851
854
  response = requests.get(url, headers=headers,params=params).json()
852
855
  post_user_id = jsonpath(response, "$..id")[0]
853
856
  return post_user_id,response
@@ -1650,4 +1653,4 @@ def edit_message(data):
1650
1653
 
1651
1654
 
1652
1655
  if __name__=="__main__":
1653
- pass
1656
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.4.4
3
+ Version: 2.4.6
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.4',
5
+ version='2.4.6',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),