sc-common-interface 2.7.2__tar.gz → 2.7.4__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.7.2
3
+ Version: 2.7.4
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -24,9 +24,7 @@ def delete_relate_post(data):
24
24
  env = data["env"]
25
25
  headers = data["headers"]
26
26
  url = "%s/api/posts/post/sales" % env
27
- sales_type = "LIVE"
28
- if "sales_type" in data:
29
- sales_type = data["sales_type"]
27
+ sales_type = data.get("sales_type","LIVE")
30
28
  param = {"page_num": 1, "page_size": 100, "sales_type": sales_type}
31
29
  platform = "facebook"
32
30
  post_id = data["post_id"]
@@ -114,9 +112,6 @@ def get_sales_id(data):
114
112
  search_word = data["search"]
115
113
  param["search_word"] = search_word
116
114
  response = requests.get(url,headers=headers,params=param).json()
117
- # print("url",url)
118
- # print("param", param)
119
- # print("response",response)
120
115
  sales_data = response["data"]["list"]
121
116
  if "status" in data:
122
117
  status = data["status"]
@@ -160,11 +155,12 @@ def create_activity(data):
160
155
  if "platform" in data:
161
156
  platform = data["platform"].upper()
162
157
  response = requests.post(url,headers=headers,json=body)
163
- print(response.json())
158
+ # print(response.json())
164
159
  if response.status_code==200:
165
160
  activity_id = response.json()["data"]
166
161
  return activity_id
167
162
  else:
163
+ print("创建活动失败",response)
168
164
  return response
169
165
 
170
166
  def delate_activity(data):
@@ -191,53 +187,61 @@ def end_activity(data):
191
187
  response = requests.post(url, headers=headers).json()
192
188
  return response
193
189
 
190
+ def get_page_info(data):
191
+ info = get_live_info(data)
192
+ platform = data.get("platform", "FACEBOOK")
193
+ sales_type = data.get("sales_type", "live")
194
+ global platform_list
195
+ page_info = {}
196
+ if sales_type.lower() == "live":
197
+ platform_list = jsonpath(info, "$..relatedPostList..platform")
198
+ i = platform_list.index(platform.upper())
199
+ page_id = info["data"]["relatedPostList"][i]["page_id"]
200
+ platform = info["data"]["relatedPostList"][i]["platform"]
201
+ post_id = info["data"]["relatedPostList"][i]["post_id"]
202
+ group_id = info["data"]["relatedPostList"][i]["group_id"]
203
+ page_info["page_id"] = page_id
204
+ page_info["platform"] = platform
205
+ page_info["post_id"] = post_id
206
+ page_info["group_id"] = group_id
207
+ elif sales_type.lower() == "post":
208
+ platform_list = jsonpath(info, "$..related_post_list..platform")
209
+ i = platform_list.index(platform.upper())
210
+ page_id = info["data"]["related_post_list"][i]["page_id"]
211
+ platform = info["data"]["related_post_list"][i]["platform"]
212
+ post_id = info["data"]["related_post_list"][i]["post_id"]
213
+ group_id = info["data"]["related_post_list"][i]["group_id"]
214
+ page_info["page_id"] = page_id
215
+ page_info["platform"] = platform
216
+ page_info["post_id"] = post_id
217
+ page_info["group_id"] = group_id
218
+ return page_info
219
+
220
+
194
221
  def send__live_comment(data):
195
222
  env = data["env"]
196
223
  key = data["key"]
197
-
198
224
  page_id = data.get("page_id", "")
199
225
  platform = data.get("platform", "FACEBOOK")
200
226
  post_id = data.get("post_id", "")
201
227
  group_id = data.get("group_id", "")
202
- sales_type = data.get("sales_type", "live")
203
- if page_id == "" or post_id == "key":
204
- info = get_live_info(data)
205
- # print("info",info)
206
- global platform_list
207
- if sales_type.lower()=="live":
208
- platform_list = jsonpath(info, "$..relatedPostList..platform")
209
- i = platform_list.index(platform.upper())
210
- page_id = info["data"]["relatedPostList"][i]["page_id"]
211
- platform = info["data"]["relatedPostList"][i]["platform"]
212
- post_id = info["data"]["relatedPostList"][i]["post_id"]
213
- group_id = info["data"]["relatedPostList"][i]["group_id"]
214
- elif sales_type.lower()=="post":
215
- platform_list = jsonpath(info, "$..related_post_list..platform")
216
- i = platform_list.index(platform.upper())
217
- page_id = info["data"]["related_post_list"][i]["page_id"]
218
- platform = info["data"]["related_post_list"][i]["platform"]
219
- post_id = info["data"]["related_post_list"][i]["post_id"]
220
- group_id = info["data"]["related_post_list"][i]["group_id"]
221
-
222
- # info = get_live_info(data)
223
- # related_post_list = info["data"]["relatedPostList"][0]
224
- # page_id = related_post_list["page_id"]
225
- # post_id = related_post_list["post_id"]
226
- # platform = related_post_list["platform"]
227
228
  stamp = int(time.time())
228
229
  num = random.randint(100000, 999999)
229
230
  user_id = "488864%d" % int(time.time())
230
- if "user_id" in data:
231
- user_id = data['user_id']
232
231
  name = "test live%d" % int(time.time())
233
- if "name" in data:
234
- name = data['name']
235
232
  comment_id = "%s_%d%d" % (page_id, stamp, num)
236
- if "comment_id" in data:
237
- comment_id = data['comment_id']
238
233
  keyword = "接口测试普通留言"
239
- if "keyword" in data:
240
- keyword = data['keyword']
234
+ user_id = data.get("user_id", user_id)
235
+ name = data.get("name", name)
236
+ comment_id = data.get("comment_id", comment_id)
237
+ keyword = data.get("keyword", keyword)
238
+ # sales_type = data.get("sales_type", "live")
239
+ if page_id == "" or post_id == "key":
240
+ page_info = get_page_info(data)
241
+ platform = page_info["platform"]
242
+ post_id = page_info["post_id"]
243
+ group_id = page_info["group_id"]
244
+
241
245
  body = {"object": "page", "entry": [{"id": page_id, "time": stamp, "changes": [{"field": "feed", "value": {
242
246
  "from": {"id": user_id, "name": name},
243
247
  "post": {"status_type": "added_video", "is_published": True, "updated_time": "2022-11-18T09:57:26+0000",
@@ -293,11 +297,11 @@ def send_mc_message(data):
293
297
  page_id = data.get("page_id", "")
294
298
  platform = data.get("platform", "FACEBOOK")
295
299
  if page_id=="":
296
- info = get_live_info(data)
297
- platform_list = jsonpath(info, "$..relatedPostList..platform")
298
- i = platform_list.index(platform)
299
- page_id = info["data"]["relatedPostList"][i]["page_id"]
300
- platform = info["data"]["relatedPostList"][i]["platform"]
300
+ page_info = get_page_info(data)
301
+ page_id = page_info["page_id"]
302
+ platform = page_info["platform"]
303
+ post_id = page_info["post_id"]
304
+ group_id = page_info["group_id"]
301
305
  mid = "m_hhAqPhSlMTY4En2oWjSB59T3BFjeU97DdDV4WHr3DLWnPrO0iCsjQlG3hBN%d-sBlT26-6oNg" % stamp
302
306
  body = {"entry": [{"id": "%s" % page_id, "messaging": [{"message":
303
307
  {
@@ -347,10 +351,11 @@ def get_live_info(data):
347
351
  if response.status_code==200:
348
352
  return response.json()
349
353
  else:
354
+ time.sleep(1)
350
355
  count=count+1
351
356
  if count>10:
352
357
  print("查询报错:",response)
353
- return response
358
+ return response.content
354
359
 
355
360
 
356
361
 
@@ -431,10 +436,8 @@ def live_search_oa_product(data):
431
436
  url = "%s/openApi/proxy/v1/products?page=1&per_page=50" %env
432
437
  type = "spu"
433
438
  quantity = 100
434
- if "type" in data:
435
- type = data["type"]
436
- if "quantity" in data:
437
- quantity = data["quantity"]
439
+ type = data.get("type",type)
440
+ quantity = data.get("quantity",quantity)
438
441
  if "query" in data:
439
442
  query = data["query"]
440
443
  url = "%s/openApi/proxy/v1/products?page=1&per_page=4&query=%s" % (env,query)
@@ -521,10 +524,9 @@ def get_broadcast_list(data):
521
524
  broadcast_id = ""
522
525
  pageNum = 1
523
526
  pageSize = 12
524
- if "pageNum" in data:
525
- pageNum = data["pageNum"]
526
- if "pageSize" in data:
527
- pageSize = data["pageSize"]
527
+ pageNum =data.get("pageNum",pageNum)
528
+ pageNum = data.get("pageSize", pageSize)
529
+ name = data.get("name",name)
528
530
  if "name" in data:
529
531
  name= data["name"]
530
532
  url = "%s/admin/api/bff-web/live/broadcast/query"%env
@@ -609,63 +611,39 @@ def create_live(data):
609
611
  need_send_message = True
610
612
  has_link = True
611
613
  startTime = None
612
- # endTime = datetime.datetime.now()+datetime.timedelta(days=3)
613
614
  endTime = None
614
- if "title" in data:
615
- title = data["title"]
616
- if "salesDescription" in data:
617
- title = data["salesDescription"]
618
- if "salesOwner" in data:
619
- salesOwner = data["salesOwner"]
620
- if "platform" in data:
621
- platform = data["platform"]
622
- if "patternModel" in data:
623
- patternModel = data["patternModel"]
624
- if "keywordValidInLive" in data:
625
- keywordValidInLive = data["keywordValidInLive"]
626
- if "keywordValidAfterLive" in data:
627
- keywordValidAfterLive = data["keywordValidAfterLive"]
628
-
629
- if "autoNotifyPayEnable" in data:
630
- autoNotifyPayEnable = data["autoNotifyPayEnable"]
631
- if "autoNotifyPayMessage" in data:
632
- autoNotifyPayMessage = data["autoNotifyPayMessage"]
633
- if "autoNotifyPayButton" in data:
634
- autoNotifyPayButton = data["autoNotifyPayButton"]
635
- if "autoNotifyPayTime" in data:
636
- autoNotifyPayTime = data["autoNotifyPayTime"]
637
-
638
- if "stockEnable" in data:
639
- stockEnable = data["stockEnable"]
640
- if "stockIime" in data:
641
- stockIime = data["stockIime"]
642
-
643
- if "lowOfQuantityEnable" in data:
644
- lowOfQuantityEnable = data["lowOfQuantityEnable"]
645
- if "lowOfQuantitySound" in data:
646
- lowOfQuantitySound = data["lowOfQuantitySound"]
647
- if "lowOfQuantityQuantity" in data:
648
- lowOfQuantityQuantity = data["lowOfQuantityQuantity"]
649
-
650
- if "has_interaction_message" in data:
651
- has_interaction_message = data["has_interaction_message"]
652
- if "has_interaction_message_button" in data:
653
- has_interaction_message_button = data["has_interaction_message_button"]
654
- if "no_interaction_message_first" in data:
655
- no_interaction_message_first = data["no_interaction_message_first"]
656
- if "first_message_button" in data:
657
- first_message_button = data["first_message_button"]
658
- if "second_message" in data:
659
- second_message = data["second_message"]
660
- if "second_message_button" in data:
661
- second_message_button = data["second_message_button"]
662
- if "need_send_message" in data:
663
- need_send_message = data["need_send_message"]
664
- # if "message_button" in data:
665
- # message_button = data["message_button"]
666
- if "has_link" in data:
667
- has_link = data["has_link"]
668
- # platform = platform.upper()
615
+ stamp = int(time.time())
616
+
617
+ title = data.get("title", title)
618
+ salesDescription = data.get("salesDescription", salesDescription)
619
+ salesOwner = data.get("salesOwner", salesOwner)
620
+ platform = data.get("platform", platform)
621
+ patternModel = data.get("patternModel", patternModel)
622
+ keywordValidInLive = data.get("keywordValidInLive", keywordValidInLive)
623
+ keywordValidAfterLive = data.get("keywordValidAfterLive", keywordValidAfterLive)
624
+
625
+ autoNotifyPayEnable = data.get("autoNotifyPayEnable", autoNotifyPayEnable)
626
+ autoNotifyPayMessage = data.get("autoNotifyPayMessage", autoNotifyPayMessage)
627
+ autoNotifyPayButton = data.get("autoNotifyPayButton", autoNotifyPayButton)
628
+ autoNotifyPayTime = data.get("autoNotifyPayTime", autoNotifyPayTime)
629
+
630
+ stockEnable = data.get("stockEnable", stockEnable)
631
+ stockExpireTime = data.get("stockExpireTime")
632
+
633
+ lowOfQuantityEnable = data.get("lowOfQuantityEnable", lowOfQuantityEnable)
634
+ lowOfQuantitySound = data.get("lowOfQuantitySound", lowOfQuantitySound)
635
+ lowOfQuantityQuantity = data.get("lowOfQuantityQuantity", lowOfQuantityQuantity)
636
+
637
+ has_interaction_message = data.get("has_interaction_message", has_interaction_message)
638
+ has_interaction_message_button = data.get("has_interaction_message_button", has_interaction_message_button)
639
+ no_interaction_message_first = data.get("no_interaction_message_first", no_interaction_message_first)
640
+ first_message_button = data.get("first_message_button", first_message_button)
641
+ second_message = data.get("second_message", second_message)
642
+ second_message_button = data.get("second_message_button", second_message_button)
643
+ need_send_message = data.get("need_send_message", need_send_message)
644
+ has_link = data.get("has_link", has_link)
645
+
646
+
669
647
  body = {}
670
648
  if platform.lower() in ("fb_group","facebook","instagram"):
671
649
  body = {
@@ -899,15 +877,6 @@ def add_live(data):
899
877
  return response
900
878
 
901
879
 
902
- # def get_live_info(data):
903
- # """查询直播间信息"""
904
- # env = data["env"]
905
- # headers = data["headers"]
906
- # sales_id = data["sales_id"]
907
- # url = "%s/api/posts/live/sales/%s" % (env, sales_id)
908
- # response = requests.get(url,headers=headers).json()
909
- # return response
910
-
911
880
  def edit_live_info(data):
912
881
  """
913
882
  直播前编辑直播间信息:prepare
@@ -956,76 +925,47 @@ def edit_live_info(data):
956
925
  productRecommendMessageEnable = True
957
926
  platform = "FB_GROUP"
958
927
  type = "prepare"
959
- if "type" in data:
960
- type = data["type"]
961
- if "title" in data:
962
- title = data["title"]
963
- if "salesDescription" in data:
964
- title = data["salesDescription"]
965
- if "salesOwner" in data:
966
- title = data["salesOwner"]
967
- if "platform" in data:
968
- platform = data["platform"]
969
- if "patternModel" in data:
970
- patternModel = data["patternModel"]
971
- if "keywordValidInLive" in data:
972
- keywordValidInLive = data["keywordValidInLive"]
973
- if "keywordValidAfterLive" in data:
974
- keywordValidAfterLive = data["keywordValidAfterLive"]
975
- if "autoNotifyPayEnable" in data:
976
- autoNotifyPayEnable = data["autoNotifyPayEnable"]
977
- if "autoNotifyPayMessage" in data:
978
- autoNotifyPayMessage = data["autoNotifyPayMessage"]
979
- if "autoNotifyPayButton" in data:
980
- autoNotifyPayButton = data["autoNotifyPayButton"]
981
- if "autoNotifyPayTime" in data:
982
- autoNotifyPayTime = data["autoNotifyPayTime"]
983
- if "stockEnable" in data:
984
- stockEnable = data["stockEnable"]
985
- if "stockExpireTime" in data:
986
- stockExpireTime = data["stockExpireTime"]
987
- if "lowOfQuantityEnable" in data:
988
- lowOfQuantityEnable = data["lowOfQuantityEnable"]
989
- if "lowOfQuantitySound" in data:
990
- lowOfQuantitySound = data["lowOfQuantitySound"]
991
- if "lowOfQuantityQuantity" in data:
992
- lowOfQuantityQuantity = data["lowOfQuantityQuantity"]
993
- if "has_interaction_message" in data:
994
- has_interaction_message = data["has_interaction_message"]
995
- if "has_interaction_message_button" in data:
996
- has_interaction_message_button = data["has_interaction_message_button"]
997
- if "no_interaction_message_first" in data:
998
- no_interaction_message_first = data["no_interaction_message_first"]
999
- if "first_message_button" in data:
1000
- first_message_button = data["first_message_button"]
1001
- if "second_message" in data:
1002
- second_message = data["second_message"]
1003
- if "second_message_button" in data:
1004
- second_message_button = data["second_message_button"]
1005
- if "need_send_message" in data:
1006
- need_send_message = data["need_send_message"]
1007
- # if "message_button" in data:
1008
- # message_button = data["message_button"]
1009
- if "has_link" in data:
1010
- has_link = data["has_link"]
1011
- if "commentIntent" in data:
1012
- commentIntent = data["commentIntent"]
1013
- if "allOutOfStockMessage" in data:
1014
- allOutOfStockMessage = data["allOutOfStockMessage"]
1015
- if "allOutOfStockEnable" in data:
1016
- allOutOfStockEnable = data["allOutOfStockEnable"]
1017
- if "welcomeMessage" in data:
1018
- welcomeMessage = data["welcomeMessage"]
1019
- if "welcomeMessageEnable" in data:
1020
- welcomeMessageEnable = data["welcomeMessageEnable"]
1021
- if "welcomeComment" in data:
1022
- welcomeComment = data["welcomeComment"]
1023
- if "welcomeCommentEnable" in data:
1024
- welcomeCommentEnable = data["welcomeCommentEnable"]
1025
- if "productRecommendMessage" in data:
1026
- productRecommendMessage = data["productRecommendMessage"]
1027
- if "productRecommendMessageEnable" in data:
1028
- productRecommendMessageEnable = data["productRecommendMessageEnable"]
928
+ type = data.get("type",type)
929
+ title = data.get("title", title)
930
+ salesDescription = data.get("salesDescription", salesDescription)
931
+ salesOwner = data.get("salesOwner", salesOwner)
932
+ platform = data.get("platform", platform)
933
+ patternModel = data.get("patternModel", patternModel)
934
+ keywordValidAfterLive = data.get("keywordValidAfterLive", keywordValidAfterLive)
935
+ keywordValidInLive = data.get("keywordValidInLive", keywordValidInLive)
936
+
937
+ autoNotifyPayEnable = data.get("autoNotifyPayEnable", autoNotifyPayEnable)
938
+ autoNotifyPayMessage = data.get("autoNotifyPayMessage", autoNotifyPayMessage)
939
+ autoNotifyPayButton = data.get("autoNotifyPayButton", autoNotifyPayButton)
940
+ autoNotifyPayTime = data.get("autoNotifyPayTime", autoNotifyPayTime)
941
+
942
+ stockEnable = data.get("stockEnable", stockEnable)
943
+ stockExpireTime = data.get("stockExpireTime", stockExpireTime)
944
+
945
+ lowOfQuantityEnable = data.get("lowOfQuantityEnable", lowOfQuantityEnable)
946
+ lowOfQuantitySound = data.get("lowOfQuantitySound", lowOfQuantitySound)
947
+ lowOfQuantityQuantity = data.get("lowOfQuantityQuantity", lowOfQuantityQuantity)
948
+
949
+ has_interaction_message = data.get("has_interaction_message", has_interaction_message)
950
+ has_interaction_message_button = data.get("has_interaction_message_button", has_interaction_message_button)
951
+ no_interaction_message_first = data.get("no_interaction_message_first", no_interaction_message_first)
952
+ first_message_button = data.get("first_message_button", first_message_button)
953
+ second_message = data.get("second_message", second_message)
954
+ second_message_button = data.get("second_message_button", second_message_button)
955
+ need_send_message = data.get("need_send_message", need_send_message)
956
+ has_link = data.get("has_link", has_link)
957
+ commentIntent = data.get("commentIntent", commentIntent)
958
+
959
+ allOutOfStockMessage = data.get("allOutOfStockMessage", allOutOfStockMessage)
960
+ allOutOfStockEnable = data.get("allOutOfStockEnable", allOutOfStockEnable)
961
+ welcomeMessage = data.get("welcomeMessage", welcomeMessage)
962
+ welcomeMessageEnable = data.get("welcomeMessageEnable", welcomeMessageEnable)
963
+ welcomeComment = data.get("welcomeComment", welcomeComment)
964
+ welcomeCommentEnable = data.get("welcomeCommentEnable", welcomeCommentEnable)
965
+ productRecommendMessage = data.get("productRecommendMessage", productRecommendMessage)
966
+ productRecommendMessageEnable = data.get("productRecommendMessageEnable", productRecommendMessageEnable)
967
+
968
+
1029
969
  platformChannels = []
1030
970
  startTime = None
1031
971
  endTime = None
@@ -1337,90 +1277,57 @@ def save_global_config(data):
1337
1277
  #视频观看人数
1338
1278
  show_number = True
1339
1279
  show_share = True
1280
+ stamp = int(time.time())
1281
+ title = "直播间标题%d"%stamp
1282
+ salesDescription = "直播间描述%d" % stamp
1283
+ salesOwner = "直播间主%d" % stamp
1284
+ platform = "FACEBOOK"
1285
+ title = data.get("title",title)
1286
+ salesDescription = data.get("salesDescription", salesDescription)
1287
+ salesOwner = data.get("salesOwner", salesOwner)
1288
+ platform = data.get("platform", platform)
1289
+ patternModel = data.get("patternModel", patternModel)
1290
+ keywordValidInLive = data.get("keywordValidInLive", keywordValidInLive)
1291
+ keywordValidAfterLive = data.get("keywordValidAfterLive", keywordValidAfterLive)
1340
1292
 
1341
- if "title" in data:
1342
- title = data["title"]
1343
- if "salesDescription" in data:
1344
- title = data["salesDescription"]
1345
- if "salesOwner" in data:
1346
- title = data["salesOwner"]
1347
- if "platform" in data:
1348
- platform = data["platform"]
1349
- if "patternModel" in data:
1350
- patternModel = data["patternModel"]
1351
- if "keywordValidInLive" in data:
1352
- keywordValidInLive = data["keywordValidInLive"]
1353
- if "keywordValidAfterLive" in data:
1354
- keywordValidAfterLive = data["keywordValidAfterLive"]
1355
-
1356
- if "autoNotifyPayEnable" in data:
1357
- autoNotifyPayEnable = data["autoNotifyPayEnable"]
1358
- if "autoNotifyPayMessage" in data:
1359
- autoNotifyPayMessage = data["autoNotifyPayMessage"]
1360
- if "autoNotifyPayButton" in data:
1361
- autoNotifyPayButton = data["autoNotifyPayButton"]
1362
- if "autoNotifyPayTime" in data:
1363
- autoNotifyPayTime = data["autoNotifyPayTime"]
1364
-
1365
- if "stockEnable" in data:
1366
- stockEnable = data["stockEnable"]
1367
- if "stockExpireTime" in data:
1368
- stockExpireTime = data["stockExpireTime"]
1369
-
1370
- if "lowOfQuantityEnable" in data:
1371
- lowOfQuantityEnable = data["lowOfQuantityEnable"]
1372
- if "lowOfQuantitySound" in data:
1373
- lowOfQuantitySound = data["lowOfQuantitySound"]
1374
- if "lowOfQuantityQuantity" in data:
1375
- lowOfQuantityQuantity = data["lowOfQuantityQuantity"]
1376
-
1377
- if "has_interaction_message" in data:
1378
- has_interaction_message = data["has_interaction_message"]
1379
- if "has_interaction_message_button" in data:
1380
- has_interaction_message_button = data["has_interaction_message_button"]
1381
- if "no_interaction_message_first" in data:
1382
- no_interaction_message_first = data["no_interaction_message_first"]
1383
- if "first_message_button" in data:
1384
- first_message_button = data["first_message_button"]
1385
- if "second_message" in data:
1386
- second_message = data["second_message"]
1387
- if "second_message_button" in data:
1388
- second_message_button = data["second_message_button"]
1389
- if "need_send_message" in data:
1390
- need_send_message = data["need_send_message"]
1391
- # if "message_button" in data:
1392
- # message_button = data["message_button"]
1393
- if "has_link" in data:
1394
- has_link = data["has_link"]
1395
- if "commentIntent" in data:
1396
- commentIntent = data["commentIntent"]
1397
-
1398
- if "allOutOfStockMessage" in data:
1399
- allOutOfStockMessage = data["allOutOfStockMessage"]
1400
- if "allOutOfStockEnable" in data:
1401
- allOutOfStockEnable = data["allOutOfStockEnable"]
1402
-
1403
- if "welcomeMessage" in data:
1404
- welcomeMessage = data["welcomeMessage"]
1405
- if "welcomeMessageEnable" in data:
1406
- welcomeMessageEnable = data["welcomeMessageEnable"]
1407
-
1408
- if "welcomeComment" in data:
1409
- welcomeComment = data["welcomeComment"]
1410
- if "welcomeCommentEnable" in data:
1411
- welcomeCommentEnable = data["welcomeCommentEnable"]
1412
-
1413
- if "show_number" in data:
1414
- show_number = data["show_number"]
1415
- if "show_share" in data:
1416
- show_share = data["show_share"]
1417
-
1418
- if "fbProductRecommendMessage" in data:
1419
- fbProductRecommendMessage = data["fbProductRecommendMessage"]
1420
- if "igProductRecommendMessage" in data:
1421
- igProductRecommendMessage = data["igProductRecommendMessage"]
1422
- if "slProductRecommendMessage" in data:
1423
- slProductRecommendMessage = data["slProductRecommendMessage"]
1293
+ autoNotifyPayEnable = data.get("autoNotifyPayEnable", autoNotifyPayEnable)
1294
+ autoNotifyPayMessage = data.get("autoNotifyPayMessage", autoNotifyPayMessage)
1295
+ autoNotifyPayButton = data.get("autoNotifyPayButton", autoNotifyPayButton)
1296
+ autoNotifyPayTime = data.get("autoNotifyPayTime", autoNotifyPayTime)
1297
+
1298
+ stockEnable = data.get("stockEnable", stockEnable)
1299
+ stockExpireTime = data.get("stockExpireTime", stockExpireTime)
1300
+
1301
+ lowOfQuantityEnable = data.get("lowOfQuantityEnable", lowOfQuantityEnable)
1302
+ lowOfQuantitySound = data.get("lowOfQuantitySound", lowOfQuantitySound)
1303
+ lowOfQuantityQuantity = data.get("lowOfQuantityQuantity", lowOfQuantityQuantity)
1304
+
1305
+
1306
+ has_interaction_message = data.get("has_interaction_message", has_interaction_message)
1307
+ has_interaction_message_button = data.get("has_interaction_message_button", has_interaction_message_button)
1308
+ no_interaction_message_first = data.get("no_interaction_message_first", no_interaction_message_first)
1309
+ first_message_button = data.get("first_message_button", first_message_button)
1310
+ second_message = data.get("second_message", second_message)
1311
+ second_message_button = data.get("second_message_button", second_message_button)
1312
+ need_send_message = data.get("need_send_message", need_send_message)
1313
+ has_link = data.get("has_link", has_link)
1314
+ commentIntent = data.get("commentIntent", commentIntent)
1315
+
1316
+ allOutOfStockMessage = data.get("allOutOfStockMessage", allOutOfStockMessage)
1317
+ allOutOfStockEnable = data.get("allOutOfStockEnable", allOutOfStockEnable)
1318
+
1319
+ welcomeMessage = data.get("welcomeMessage", welcomeMessage)
1320
+ welcomeMessageEnable = data.get("welcomeMessageEnable", welcomeMessageEnable)
1321
+
1322
+ welcomeComment = data.get("welcomeComment", welcomeComment)
1323
+ welcomeCommentEnable = data.get("welcomeCommentEnable", welcomeCommentEnable)
1324
+
1325
+ show_number = data.get("show_number", show_number)
1326
+ show_share = data.get("show_share", show_share)
1327
+
1328
+ fbProductRecommendMessage = data.get("fbProductRecommendMessage", fbProductRecommendMessage)
1329
+ igProductRecommendMessage = data.get("igProductRecommendMessage", igProductRecommendMessage)
1330
+ slProductRecommendMessage = data.get("slProductRecommendMessage", slProductRecommendMessage)
1424
1331
 
1425
1332
 
1426
1333
  body = {
@@ -1583,15 +1490,6 @@ def get_global_config(data):
1583
1490
 
1584
1491
 
1585
1492
 
1586
-
1587
- outOfStock = {
1588
- "en":"The following product(s) doesn't have enough stock, please select other products, thanks!\n❗️{products}".replace("️{products}","ffddd"),
1589
- "zh-cn":"以下商品库存不足,请选购其他商品,谢谢!\n❗️{products}".replace("️{products}","ffddd"),
1590
- "zh-hant":"以下商品庫存不足,請選購其他商品,謝謝!\n❗️{products}".replace("️{products}","ffddd")
1591
- }
1592
-
1593
-
1594
-
1595
1493
  def remove_live_product(data):
1596
1494
  env = data["env"]
1597
1495
  headers = data["headers"]
@@ -1656,10 +1554,8 @@ def search_product_set(data):
1656
1554
  sales_id = data["sales_id"]
1657
1555
  query = ""
1658
1556
  pageNum = 1
1659
- if "pageNum" in data:
1660
- pageNum = data["pageNum"]
1661
- if "query" in data:
1662
- query = data["query"]
1557
+ pageNum = data.get("pageNum", pageNum)
1558
+ query = data.get("query", query)
1663
1559
  url = "%s/admin/api/bff-web/live/sale/%s/sale_list/product_set"%(env,sales_id)
1664
1560
  param = {"pageNum":pageNum,"pageSize":10,"query":query,"queryType":"PRODUCT_NAME"}
1665
1561
  # print(param)
@@ -1673,10 +1569,8 @@ def get_product_set(data):
1673
1569
  sales_id = data["sales_id"]
1674
1570
  query = ""
1675
1571
  pageNum = 1
1676
- if "pageNum" in data:
1677
- pageNum = data["pageNum"]
1678
- if "query" in data:
1679
- query = data["query"]
1572
+ pageNum = data.get("pageNum",pageNum)
1573
+ query = data.get("query", query)
1680
1574
  url = "%s/admin/api/bff-web/live/sale/%s/product/product_set/list"%(env,sales_id)
1681
1575
  param = {"pageNum":pageNum,"pageSize":10,"query":query}
1682
1576
  # print(param)
@@ -1692,6 +1586,7 @@ def get_product_set(data):
1692
1586
  return res
1693
1587
 
1694
1588
  def get_sales_keyword(data):
1589
+ """查询直播间关键字"""
1695
1590
  env = data["env"]
1696
1591
  headers = data["headers"]
1697
1592
  sales_id = data["sales_id"]
@@ -2034,6 +1929,7 @@ def enable_auto_reply(data):
2034
1929
  }
2035
1930
  try:
2036
1931
  response = requests.put(url,headers=headers,json=body).json()
1932
+ return response
2037
1933
  except Exception:
2038
1934
  print("更改自动回复状态失败:",response)
2039
1935
 
@@ -2078,6 +1974,7 @@ def edit_auto_reply(data):
2078
1974
  }
2079
1975
  try:
2080
1976
  response = requests.put(url,headers=headers,json=body).json()
1977
+ return response
2081
1978
  except Exception:
2082
1979
  print("编辑自动回复失败:",response)
2083
1980
 
@@ -2094,6 +1991,7 @@ def delete_auto_reply(data):
2094
1991
  }
2095
1992
  try:
2096
1993
  response = requests.delete(url,headers=headers,json=body).json()
1994
+ return response
2097
1995
  except Exception:
2098
1996
  print("删除自动回复状态失败:",response)
2099
1997
 
@@ -2115,7 +2013,10 @@ def handler_auto_reply(data):
2115
2013
 
2116
2014
 
2117
2015
  if __name__=="__main__":
2118
- pass
2016
+ data = {'headers': {'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkZmQxYjNiMDc0M2JmYWU4YTFkODk4NzczNjgyZWVkZCIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjVlYjkwMzVhYjA5ZDEyNjU4NTFmOTU2ZiJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.Y90xLfYVAp9yByHo7Vc7A3hHrp6hX9X9Lg4mg_WiE_I', 'lang': 'en', 'Content-Type': 'application/json'}, 'auto_reply_id': '1883003621597597697', 'env': 'https://front-admin-preview.shoplineapp.com', 'sales_id': '95828', 'keyword': 'hello1737778021', 'post_id': '108513131786753_770459907444238', 'platform': 'facebook', 'page_id': '108513131786753', 'key': '5e3bba98882fc0fb22a0607238bc5b8f', 'user_id': '4888641737778025'}
2017
+ data["keyword"] ="hhkfasfjasfjashfahfagagag"
2018
+ user_id, name, comment_id = send__live_comment(data)
2019
+ print(name)
2119
2020
 
2120
2021
 
2121
2022
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.7.2
3
+ Version: 2.7.4
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.7.2',
5
+ version='2.7.4',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),