sc-common-interface 2.4.0__tar.gz → 2.4.2__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.0
3
+ Version: 2.4.2
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -69,7 +69,7 @@ def send__live_comment(data):
69
69
  if page_id == "" or post_id == "":
70
70
  info = get_live_info(data)
71
71
  platform_list = jsonpath(info, "$..relatedPostList..platform")
72
- i = platform_list.index(platform)
72
+ i = platform_list.index(platform.upper())
73
73
  page_id = info["data"]["relatedPostList"][i]["page_id"]
74
74
  platform = info["data"]["relatedPostList"][i]["platform"]
75
75
  post_id = info["data"]["relatedPostList"][i]["post_id"]
@@ -392,10 +392,177 @@ def get_broadcast_detail(data):
392
392
  response = requests.post(url,headers=headers,json=body).json()
393
393
  return response
394
394
 
395
+ def end_live(data):
396
+ """结束帖文"""
397
+ env = data["env"]
398
+ headers = data["headers"]
399
+ sales_id = data["sales_id"]
400
+ url = "%s/api/posts/live/sales/%s/end" % (env, sales_id)
401
+ response = requests.put(url, headers=headers).json()
402
+ return response
403
+
404
+ def create_live(data):
405
+ """创建直播,不套用通用配置"""
406
+ env = data["env"]
407
+ headers = data["headers"]
408
+ url = "%s/api/posts/live/sales" % (env)
409
+ stamp = int(time.time())
410
+ title = "接口创建的直播活动名称%d"%stamp
411
+ salesDescription = "接口创建的直播活动介绍%d"%stamp
412
+ salesOwner = "接口创建的直播主%d"%stamp
413
+ platform = "FB_GROUP"
414
+ if "platform" in data:
415
+ platform = data["platform"]
416
+ patternModel = "INCLUDE_MATCH"
417
+ if "patternModel" in data:
418
+ patternModel = data["patternModel"]
419
+ keywordValidInLive = True
420
+ keywordValidAfterLive =False
421
+ if "keywordValidInLive" in data:
422
+ keywordValidInLive = data["keywordValidInLive"]
423
+ if "keywordValidAfterLive" in data:
424
+ keywordValidAfterLive = data["keywordValidAfterLive"]
425
+ autoNotifyPayEnable = False
426
+ autoNotifyPayMessage = ""
427
+ autoNotifyPayButton = ""
428
+ if "autoNotifyPayEnable" in data:
429
+ autoNotifyPayEnable = data["autoNotifyPayEnable"]
430
+ if "autoNotifyPayMessage" in data:
431
+ autoNotifyPayMessage = data["autoNotifyPayMessage"]
432
+ if "autoNotifyPayButton" in data:
433
+ autoNotifyPayButton = data["autoNotifyPayButton"]
434
+ stockEnable = False
435
+ stockIime = None
436
+ if "stockEnable" in data:
437
+ stockEnable = data["stockEnable"]
438
+ if "stockIime" in data:
439
+ stockIime = data["stockIime"]
440
+ lowOfQuantityEnable = False
441
+ lowOfQuantitySound = False
442
+ lowOfQuantityQuantity = "1"
443
+ if "lowOfQuantityEnable" in data:
444
+ lowOfQuantityEnable = data["lowOfQuantityEnable"]
445
+ if "lowOfQuantitySound" in data:
446
+ lowOfQuantitySound = data["lowOfQuantitySound"]
447
+ if "lowOfQuantityQuantity" in data:
448
+ lowOfQuantityQuantity = data["lowOfQuantityQuantity"]
449
+
450
+ has_interaction_message = ""
451
+ has_interaction_message_button = ""
452
+ no_interaction_message_first = ""
453
+ second_message = ""
454
+ first_message_button = ""
455
+ second_message_button = " ️"
456
+ need_send_message = True
457
+ # message_button = "立即结帐️"
458
+ has_link = True
459
+ if "has_interaction_message" in data:
460
+ has_interaction_message = data["has_interaction_message"]
461
+ if "has_interaction_message_button" in data:
462
+ has_interaction_message_button = data["has_interaction_message_button"]
463
+ if "no_interaction_message_first" in data:
464
+ no_interaction_message_first = data["no_interaction_message_first"]
465
+ if "first_message_button" in data:
466
+ first_message_button = data["first_message_button"]
467
+ if "second_message" in data:
468
+ second_message = data["second_message"]
469
+ if "second_message_button" in data:
470
+ second_message_button = data["second_message_button"]
471
+ if "need_send_message" in data:
472
+ need_send_message = data["need_send_message"]
473
+ # if "message_button" in data:
474
+ # message_button = data["message_button"]
475
+ if "has_link" in data:
476
+ has_link = data["has_link"]
477
+ body = {
478
+ "sales": {
479
+ "title": title,
480
+ "salesOwner": salesOwner,
481
+ "salesDescription": salesDescription,
482
+ "platforms": [
483
+ platform
484
+ ],
485
+ "platformChannels": []
486
+ },
487
+ "salesConfig": {
488
+ "patternModel": {
489
+ "patternModel": patternModel,
490
+ "keywordValidInLive": keywordValidInLive,
491
+ "keywordValidAfterLive": keywordValidAfterLive
492
+ },
493
+ "autoNotifyPay": {
494
+ "enable": autoNotifyPayEnable,
495
+ "message": autoNotifyPayMessage,
496
+ "button": autoNotifyPayButton
497
+ },
498
+ "stock": {
499
+ "lockStock": stockEnable,
500
+ "salesStockLockExpireTime": stockIime
501
+ },
502
+ "lowOfQuantity": {
503
+ "enable": lowOfQuantityEnable,
504
+ "sound": lowOfQuantitySound,
505
+ "quantity": lowOfQuantityQuantity
506
+ }
507
+ },
508
+ "postConfigMap": {
509
+ platform: {
510
+ "message": {
511
+ "needSendMessage": need_send_message,
512
+ "hasInteractionMessage": {
513
+ "firstMessageTemplate": {
514
+ "topMessage": has_interaction_message
515
+ },
516
+ "messageButton": has_interaction_message_button
517
+ },
518
+ "hasLink": has_link,
519
+ "noInteractionMessage": {
520
+ "firstMessageTemplate": {
521
+ "topMessage": no_interaction_message_first
522
+ },
523
+ "firstMessageButton": first_message_button,
524
+ "secondMessageTemplate": {
525
+ "topMessage": second_message
526
+ },
527
+ "secondMessageButton": second_message_button
528
+ },
529
+ "messageType": "MESSAGE"
530
+ }
531
+ }
532
+ }
533
+ }
534
+ response = requests.post(url,headers=headers,json=body).json()
535
+ print(response)
536
+ sales_id = response["data"]["sales"]["id"]
537
+ return sales_id
538
+
539
+
540
+ def add_live(data):
541
+ """fb——group 链接帖文"""
542
+ env = data["env"]
543
+ headers = data["headers"]
544
+ sales_id = data["sales_id"]
545
+ url = "%s/api/posts/live/sales/%s/addLive"%(env,sales_id)
546
+ pageId = data["page_id"]
547
+ relationUrl = data["relationUrl"]
548
+
549
+ body = {
550
+ "pageId": pageId,
551
+ "platform": "FB_GROUP",
552
+ "relationUrl": relationUrl
553
+ }
554
+ response = requests.post(url,headers=headers,json=body).json()
555
+ return response
556
+
557
+
558
+
559
+
560
+
561
+
395
562
 
396
563
 
397
564
 
398
565
 
399
566
 
400
567
  if __name__=="__main__":
401
- pass
568
+ pass
@@ -1196,6 +1196,8 @@ def modelone_create_single_product(data):
1196
1196
  body = {"customKey":keyword,"quantity":quantity,"unlimitedQuantity":False,"productName":product_name,
1197
1197
  "imageUrl":"https://s3-ap-southeast-1.amazonaws.com/static.shoplineapp.com/sc-admin/product-default.png","price":3}
1198
1198
  response = requests.post(url,headers=headers,json=body).json()
1199
+ # print(body)
1200
+ print(response)
1199
1201
  spu_id = response["data"]
1200
1202
  return spu_id
1201
1203
 
@@ -1645,10 +1647,4 @@ def edit_message(data):
1645
1647
 
1646
1648
 
1647
1649
  if __name__=="__main__":
1648
- data = {'env': 'https://front-admin-preview.shoplineapp.com', 'headers': {'Content-Type': 'application/json', 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIwNmUxNGU2NzAxMWY0ZDNhMGU0ZDgyNDk3ZDAxYmQwZSIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjVmNTlmMTI4MzcyZWIzMDAwNmRjNDcwMSJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.gUqa8FJs_vjRJ-kFMhOZx42QtCr7XxcN3gKSK6_4Zvs', 'lang': 'en'}, 'sales_id': 513416, 'platform': 'FB_GROUP'}
1649
- sales_id,response = create_post_lucky_draw(data)
1650
- data["sales_id"] = sales_id
1651
- print(sales_id)
1652
- data["prize_type"] = "discount"
1653
- res2 = modify_lucky_draw(data)
1654
- print(res2)
1650
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.4.0
3
+ Version: 2.4.2
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.0',
5
+ version='2.4.2',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),