sc-common-interface 2.3.7__tar.gz → 2.3.8__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.3.7
3
+ Version: 2.3.8
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -1017,8 +1017,9 @@ def get_user_conversation_id(data):
1017
1017
  platform = data["platform"].lower()
1018
1018
  url = "%s/mc/conversation/id?type=%s&user_id=%s&party_channel_id=%s" % (env, platform, user_id, page_id)
1019
1019
  # param = {"type":"facebook","user_id":vars["user_id"],"party_channel_id":vars["platform_channel_id"]}
1020
+ print(url)
1020
1021
  response = requests.get(url, headers=headers).json()
1021
- # print(response)
1022
+
1022
1023
  conversation_id = jsonpath(response, "$.data.id")[0]
1023
1024
  return conversation_id,response
1024
1025
 
@@ -1564,10 +1565,75 @@ def get_mc_order_link(url):
1564
1565
  key = location.split("/")[-1].split("?")[0]
1565
1566
  return key
1566
1567
 
1568
+ def edit_message(data):
1569
+ env = data["env"]
1570
+ headers = data["headers"]
1571
+ sales_id = data["sales_id"]
1572
+ url = "%s/api/posts/post/sales/%s/keyword_message" % (env,sales_id)
1573
+ has_interaction_message = "您好,以下商品加单成功!购物车商品总金额: 请按以下按钮结账%d" % int(time.time())
1574
+ no_interaction_message_first = "您好,以下商品加单成功 !购物车商品总金额: 请按以下按钮继续」%d" % int(time.time())
1575
+ second_message = "您好,以下商品加单成功!{products} 购物车商品总金额: {total}请前往购物网站!%d" % int(time.time())
1576
+ first_message_button = "继续"
1577
+ second_message_button = "立即结帐 ️"
1578
+ need_send_message = True
1579
+ message_button = "立即结帐️"
1580
+ has_link = True
1581
+ #留言回复comment_reply
1582
+ comment_reply = True
1583
+ comment_reply_content = "testcopypost您好,谢谢你在贴文下留言订购以下商%d." % int(time.time())
1584
+ #无库存信息
1585
+ all_out_of_stock =True
1586
+ all_out_of_stock_content = "您好,{customerName},以下商品库存不足,请选购其他商品,谢谢!{products}%d" % int(time.time())
1587
+ if "has_interaction_message" in data:
1588
+ has_interaction_message = data["has_interaction_message"]
1589
+ if "no_interaction_message_first" in data:
1590
+ has_interaction_message = data["no_interaction_message_first"]
1591
+ if "first_message_button" in data:
1592
+ first_message_button = data["first_message_button"]
1593
+ if "second_message" in data:
1594
+ second_message = data["second_message"]
1595
+ if "second_message_button" in data:
1596
+ second_message_button = data["second_message_button"]
1597
+ if "need_send_message" in data:
1598
+ need_send_message = data["need_send_message"]
1599
+ if "message_button" in data:
1600
+ message_button = data["message_button"]
1601
+ if "has_link" in data:
1602
+ has_link = data["has_link"]
1603
+ if "comment_reply" in data:
1604
+ comment_reply = data["comment_reply"]
1605
+ if "comment_reply_content" in data:
1606
+ comment_reply_content = data["comment_reply_content"]
1607
+ if "all_out_of_stock" in data:
1608
+ all_out_of_stock = data["all_out_of_stock"]
1609
+ if "all_out_of_stock_content" in data:
1610
+ all_out_of_stock_content = data["all_out_of_stock_content"]
1611
+
1612
+ message = {"has_interaction_message":has_interaction_message,"no_interaction_message_first":no_interaction_message_first,
1613
+ "first_message_button":first_message_button,"second_message_button":second_message_button,"second_message":second_message,
1614
+ "comment_reply_content":comment_reply_content,"all_out_of_stock_content" :all_out_of_stock_content
1567
1615
 
1616
+ }
1617
+ body = {"message_config_req": {"need_send_message": need_send_message,
1618
+ "no_interaction_message": {"first_message": no_interaction_message_first,
1619
+ "first_message_button": first_message_button,
1620
+ "second_message":second_message ,
1621
+ "second_message_button": second_message_button},
1622
+ "has_interaction_message": {"first_message": has_interaction_message,
1623
+ "message_button": message_button}, "has_link": has_link},
1624
+ "comment_reply_req": {"need_reply": comment_reply, "content": comment_reply_content},
1625
+ "all_out_of_stock_req": {"need_reply": all_out_of_stock, "content": all_out_of_stock_content}}
1626
+ response = requests.post(url, headers=headers, json = body).json()
1627
+ return message,response
1568
1628
 
1569
1629
 
1570
1630
 
1571
1631
 
1572
1632
  if __name__=="__main__":
1573
- pass
1633
+ 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'}
1634
+ sales_id,response = create_post_lucky_draw(data)
1635
+ data["sales_id"] = sales_id
1636
+ print(sales_id)
1637
+ data["prize_type"] = "discount"
1638
+ res2 = modify_lucky_draw(data)
1639
+ print(res2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.3.7
3
+ Version: 2.3.8
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.3.7',
5
+ version='2.3.8',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),