sc-common-interface 2.3.3__tar.gz → 2.3.5__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.
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/PKG-INFO +1 -1
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface/LiveCommonInterface.py +2 -1
- sc-common-interface-2.3.5/sc_common_interface/McCommonInterface.py +130 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface/PostCommonInterface.py +100 -36
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface.egg-info/SOURCES.txt +1 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/setup.py +1 -1
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface/Platform.py +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface/__init__.py +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/setup.cfg +0 -0
{sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -145,9 +145,10 @@ def send_mc_message(data):
|
|
|
145
145
|
i = platform_list.index(platform)
|
|
146
146
|
page_id = info["data"]["relatedPostList"][i]["page_id"]
|
|
147
147
|
platform = info["data"]["relatedPostList"][i]["platform"]
|
|
148
|
+
mid = "m_hhAqPhSlMTY4En2oWjSB59T3BFjeU97DdDV4WHr3DLWnPrO0iCsjQlG3hBN%d-sBlT26-6oNg" % stamp
|
|
148
149
|
body = {"entry": [{"id": "%s" % page_id, "messaging": [{"message":
|
|
149
150
|
{
|
|
150
|
-
"mid":
|
|
151
|
+
"mid": mid,
|
|
151
152
|
"text": "%s" % message},
|
|
152
153
|
"recipient": {"id": "%s" % page_id},
|
|
153
154
|
"sender": {"id": "%s" % user_id}, "timestamp": stamp}],
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
import requests
|
|
3
|
+
import json
|
|
4
|
+
from jsonpath import jsonpath
|
|
5
|
+
import time
|
|
6
|
+
import random
|
|
7
|
+
import hmac
|
|
8
|
+
from hashlib import sha1
|
|
9
|
+
import random
|
|
10
|
+
|
|
11
|
+
def send_mc_message(data):
|
|
12
|
+
env = data["env"]
|
|
13
|
+
key = data["key"]
|
|
14
|
+
stamp = int(time.time()*1000)
|
|
15
|
+
user_id = "488864%d" % int(time.time())
|
|
16
|
+
if "user_id" in data:
|
|
17
|
+
user_id = data['user_id']
|
|
18
|
+
name = "test live%d" % int(time.time())
|
|
19
|
+
if "name" in data:
|
|
20
|
+
name = data['name']
|
|
21
|
+
message = "接口测试普通留言"
|
|
22
|
+
if "message" in data:
|
|
23
|
+
message = data['message']
|
|
24
|
+
page_id = ""
|
|
25
|
+
if "page_id" in data:
|
|
26
|
+
page_id = data['page_id']
|
|
27
|
+
platform = "FACEBOOK"
|
|
28
|
+
if "platform" in data:
|
|
29
|
+
platform = data['platform']
|
|
30
|
+
type = "text"
|
|
31
|
+
if "type" in data:
|
|
32
|
+
type = data["type"]
|
|
33
|
+
mid = "m_hhAqPhSlMTY4En2oWjSB59T3BFjeU97DdDV4WHr3DLWnPrO0iCsjQlG3hBN%d-sBlT26-6oNg" % stamp
|
|
34
|
+
if "mid" in data:
|
|
35
|
+
mid = data["mid"]
|
|
36
|
+
body={}
|
|
37
|
+
if "body" in data:
|
|
38
|
+
body = data["body"]
|
|
39
|
+
if platform.upper() == "FACEBOOK":
|
|
40
|
+
if type=="text":
|
|
41
|
+
body = {"entry": [{"id": "%s" % page_id, "messaging": [{"message":
|
|
42
|
+
{
|
|
43
|
+
"mid": mid,
|
|
44
|
+
"text": "%s" % message},
|
|
45
|
+
"recipient": {"id": "%s" % page_id},
|
|
46
|
+
"sender": {"id": "%s" % user_id}, "timestamp": stamp}],
|
|
47
|
+
"time": stamp}], "object": "page"}
|
|
48
|
+
elif type=="gif":
|
|
49
|
+
body = {"entry": [{"id": "%s" % page_id, "messaging": [{"message":{
|
|
50
|
+
"mid": mid,
|
|
51
|
+
"attachments": [{"type": "image", "payload": {
|
|
52
|
+
"url": "https://cdn.fbsbx.com/v/t59.2708-21/267652425_2742112282760223_8342075864203047385_n.gif?_nc_cat=107\u0026ccb=1-7\u0026_nc_sid=cf94fc\u0026_nc_ohc=aa48LfY75iUQ7kNvgFdUHh0\u0026_nc_ht=cdn.fbsbx.com\u0026oh=03_Q7cD1QE9ftiyK21HTVYBWqW8JAaA-rEYS0ydqSuWlLUW5LwslA\u0026oe=66F73B3C"}}]
|
|
53
|
+
},
|
|
54
|
+
"recipient": {"id": "%s" % page_id},
|
|
55
|
+
"sender": {"id": "%s" % user_id}, "timestamp": stamp}],
|
|
56
|
+
"time": stamp}], "object": "page"}
|
|
57
|
+
elif type=="picture":
|
|
58
|
+
body = {"entry": [{"id": "%s" % page_id, "messaging": [{"message": {
|
|
59
|
+
"mid": mid,
|
|
60
|
+
"attachments": [{"type": "image", "payload": {
|
|
61
|
+
"url": "https://cdn.fbsbx.com/v/t59.2708-21/267652425_2742112282760223_8342075864203047385_n.gif?_nc_cat=107\u0026ccb=1-7\u0026_nc_sid=cf94fc\u0026_nc_ohc=aa48LfY75iUQ7kNvgFdUHh0\u0026_nc_ht=cdn.fbsbx.com\u0026oh=03_Q7cD1QE9ftiyK21HTVYBWqW8JAaA-rEYS0ydqSuWlLUW5LwslA\u0026oe=66F73B3C"}}]
|
|
62
|
+
},
|
|
63
|
+
"recipient": {"id": "%s" % page_id},
|
|
64
|
+
"sender": {"id": "%s" % user_id}, "timestamp": stamp}],
|
|
65
|
+
"time": stamp}], "object": "page"}
|
|
66
|
+
elif type =="template":
|
|
67
|
+
body = {"object":"page","entry":[{"id":"%s" % page_id,"time":stamp,"messaging":[{"sender":{"id":"%s" % user_id},"recipient":{"id":"%s" % page_id},"timestamp":stamp,"message":{"mid":mid,"text":"Hi,name1716183125。感謝您的支持和信任。這是您的訂單,請盡快完成付款。\n\n訂單編號:\n#20240926134206449\n創建時間:\n2024-09-26 20:42:10\n\n待付款金額:฿70.11","is_echo":True,"app_id":197583024153108,"metadata":"MC3.0_61b096beb7bef100245dbd8b","attachments":[{"type":"template","payload":{"template_type":"button","buttons":[{"type":"web_url","url":"https://message-center.shoplineapp.com/admin/user/order-checkout/634553c44e79c6f331c4ba1fe744199b?merchant_id=61b096beb7bef100245dbd8b\u0026locale=zh-hant","title":"去支付"}]}}]}}]}],"Fbe":False}
|
|
68
|
+
elif type == "video":
|
|
69
|
+
body = {"entry": [{"id": "%s" % page_id, "messaging": [{"message": {
|
|
70
|
+
"mid": mid,
|
|
71
|
+
"attachments": [{"type": "video", "payload": {
|
|
72
|
+
"url": "https://video.xx.fbcdn.net/v/t42.3356-2/432615672_8029825447033772_7739712335639564092_n.mp4?_nc_cat=108\u0026ccb=1-7\u0026_nc_sid=4f86bc\u0026_nc_ohc=b4-Y6xX1rtUQ7kNvgFmSRk_\u0026_nc_ht=video.xx\u0026_nc_gid=A-Pz8fTYZc89Un5kLMoLJMv\u0026oh=03_Q7cD1QG_WI1uD77MmN9xKAxXx3tZOL8muTvMgCFpNENoI9S7lw\u0026oe=66F74642"}}]
|
|
73
|
+
},
|
|
74
|
+
"recipient": {"id": "%s" % page_id},
|
|
75
|
+
"sender": {"id": "%s" % user_id}, "timestamp": stamp}],
|
|
76
|
+
"time": stamp}], "object": "page"}
|
|
77
|
+
elif type == "audio":
|
|
78
|
+
body = {"entry": [{"id": "%s" % page_id, "messaging": [{"message": {
|
|
79
|
+
"mid": mid,
|
|
80
|
+
"attachments": [{"type": "audio", "payload": {
|
|
81
|
+
"url": "https://cdn.fbsbx.com/v/t59.3654-21/461150567_1761086874427012_6172811562215217140_n.wav/audio_clip.wav?_nc_cat=101\u0026ccb=1-7\u0026_nc_sid=d61c36\u0026_nc_ohc=L5BQtwl4CAgQ7kNvgGHihOx\u0026_nc_ht=cdn.fbsbx.com\u0026_nc_gid=AP5AR1-XZNRACEs4Q2hlS7w\u0026oh=03_Q7cD1QGwgqbQ-_sc078THHpQqaTSy83Xg9FpPv9DfswxesIBWw\u0026oe=66F754B6"}}]
|
|
82
|
+
},
|
|
83
|
+
"recipient": {"id": "%s" % page_id},
|
|
84
|
+
"sender": {"id": "%s" % user_id}, "timestamp": stamp}],
|
|
85
|
+
"time": stamp}], "object": "page"}
|
|
86
|
+
elif type == "file":
|
|
87
|
+
body = {"entry": [{"id": "%s" % page_id, "messaging": [{"message": {
|
|
88
|
+
"mid": mid,
|
|
89
|
+
"attachments": [{"type": "file", "payload": {
|
|
90
|
+
"url": "https://cdn.fbsbx.com/v/t59.2708-21/372887834_1477966239657135_964223859622790441_n.xls/shopline.xls?_nc_cat=104\u0026ccb=1-7\u0026_nc_sid=2b0e22\u0026_nc_ohc=HD1EWsL_GAMQ7kNvgH1XAqH\u0026_nc_ht=cdn.fbsbx.com\u0026_nc_gid=AbQ5mUwXgVRLcTg_SDMsXuQ\u0026oh=03_Q7cD1QGbJ5rcs9fnkSYImAoSTVMEYZzCn0Uop0a1LT06MItUHw\u0026oe=66F743BF"}}]
|
|
91
|
+
},
|
|
92
|
+
"recipient": {"id": "%s" % page_id},
|
|
93
|
+
"sender": {"id": "%s" % user_id}, "timestamp": stamp}],
|
|
94
|
+
"time": stamp}], "object": "page"}
|
|
95
|
+
elif type == "image":
|
|
96
|
+
body = {"entry": [{"id": "%s" % page_id, "messaging": [{"message": {
|
|
97
|
+
"mid": mid,
|
|
98
|
+
"attachments": [{"type": "image", "payload": {
|
|
99
|
+
"url": "https://scontent.xx.fbcdn.net/v/t1.15752-9/453334896_849046190144775_2687107896488738244_n.png?_nc_cat=106\u0026ccb=1-7\u0026_nc_sid=fc17b8\u0026_nc_ohc=PHylk2lIl2UQ7kNvgE62hJr\u0026_nc_ad=z-m\u0026_nc_cid=0\u0026_nc_ht=scontent.xx\u0026_nc_gid=A1lL9UZ_Rb3le2HUKS5-i7y\u0026oh=03_Q7cD1QFfWFzhNi_lgujYyTyBM5c5YPONyX7YXKLN4du04YHU7A\u0026oe=671CD669"}}]
|
|
100
|
+
},
|
|
101
|
+
"recipient": {"id": "%s" % page_id},
|
|
102
|
+
"sender": {"id": "%s" % user_id}, "timestamp": stamp}],
|
|
103
|
+
"time": stamp}], "object": "page"}
|
|
104
|
+
elif type == "product":
|
|
105
|
+
body = {"entry": [{"id": "%s" % page_id, "messaging": [{"message": {
|
|
106
|
+
"mid": mid,
|
|
107
|
+
"text":"Hi!快來看看我們為您挑選的精選商品👇\nhttps://shln.me/HT/gb0sQ"
|
|
108
|
+
},
|
|
109
|
+
"recipient": {"id": "%s" % page_id},
|
|
110
|
+
"sender": {"id": "%s" % user_id}, "timestamp": stamp}],
|
|
111
|
+
"time": stamp}], "object": "page"}
|
|
112
|
+
|
|
113
|
+
if platform.upper()=="INSTAGRAM":
|
|
114
|
+
body={"object":"instagram","entry":[{"time":stamp,"id":"%s"%page_id,"messaging":[{"sender":{"id":"%s"%user_id},"recipient":{"id":"%s"%page_id},
|
|
115
|
+
"timestamp":stamp,"message":{"mid":mid,"text":"%s"%message}}]}]}
|
|
116
|
+
url = "%s/facebook/webhook" % env
|
|
117
|
+
sign_text = hmac.new(key.encode("utf-8"), json.dumps(body).encode("utf-8"), sha1)
|
|
118
|
+
signData = sign_text.hexdigest()
|
|
119
|
+
header = {"Content-Type": "application/json", "x-hub-signature": "sha1=%s" % signData}
|
|
120
|
+
response = requests.post(url, headers=header, data=json.dumps(body))
|
|
121
|
+
return user_id, name,mid
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if __name__=="__main__":
|
|
125
|
+
data = {'env': 'https://front-admin-preview.shoplineapp.com', 'key': '5e3bba98882fc0fb22a0607238bc5b8f', 'page_id': '108513131786753'}
|
|
126
|
+
data["type"] = "product"
|
|
127
|
+
user_id, name,mid = send_mc_message(data)
|
|
128
|
+
# data["mid"] = mid
|
|
129
|
+
# send_mc_message(data)
|
|
130
|
+
|
{sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface/PostCommonInterface.py
RENAMED
|
@@ -480,15 +480,64 @@ def search_post_product(data):
|
|
|
480
480
|
headers = data["headers"]
|
|
481
481
|
url = "%s/api/posts/common/product/key/spu/list?page=1&searchType=ALL&pageSize=10"%env
|
|
482
482
|
response = requests.get(url, headers=headers).json()
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
483
|
+
items = response["data"]["openApiProductDetails"]
|
|
484
|
+
# productSpuKeyVos = response["data"]["productSpuKeyVos"][0]
|
|
485
|
+
# skuKeys = productSpuKeyVos["skuKeys"]
|
|
486
|
+
# spuId = productSpuKeyVos["spuId"]
|
|
487
|
+
# return skuKeys,spuId,response
|
|
488
|
+
type = "spu"
|
|
489
|
+
quantity = 100
|
|
490
|
+
if "type" in data:
|
|
491
|
+
type = data["type"]
|
|
492
|
+
if "quantity" in data:
|
|
493
|
+
quantity = data["quantity"]
|
|
494
|
+
if "query" in data:
|
|
495
|
+
query = data["query"]
|
|
496
|
+
variant_options_list = jsonpath(items, "$..variations")
|
|
497
|
+
product_info = ""
|
|
498
|
+
spu_id = ""
|
|
499
|
+
sku_id = ""
|
|
500
|
+
sku_id_quantity = []
|
|
501
|
+
|
|
502
|
+
for a, b in enumerate(variant_options_list):
|
|
503
|
+
if type == "spu" and b == [] and quantity != 0:
|
|
504
|
+
quantitys = items[a]["totalOrderableQuantity"]
|
|
505
|
+
unlimited_quantity = items[a]["unlimitedQuantity"]
|
|
506
|
+
if quantitys != 0 or unlimited_quantity == True:
|
|
507
|
+
product_info = items[a]
|
|
508
|
+
spu_id = items[a]["id"]
|
|
509
|
+
break
|
|
510
|
+
elif type == "sku" and b != [] and quantity != 0:
|
|
511
|
+
quantitys = items[a]["totalOrderableQuantity"]
|
|
512
|
+
unlimited_quantity = items[a]["unlimitedQuantity"]
|
|
513
|
+
if quantitys != 0 or unlimited_quantity == True:
|
|
514
|
+
product_info = items[a]
|
|
515
|
+
spu_id = items[a]["id"]
|
|
516
|
+
sku_id = jsonpath(items[a]["variations"], "$..id")
|
|
517
|
+
sku_id_quantity = jsonpath(items[a]["variations"], "$..totalOrderableQuantity")
|
|
518
|
+
break
|
|
519
|
+
elif type == "spu" and b == [] and quantity == 0:
|
|
520
|
+
quantitys = items[a]["totalOrderableQuantity"]
|
|
521
|
+
unlimited_quantity = items[a]["unlimitedQuantity"]
|
|
522
|
+
if quantitys != 0 or unlimited_quantity == True:
|
|
523
|
+
product_info = items[a]
|
|
524
|
+
spu_id = items[a]["id"]
|
|
525
|
+
break
|
|
526
|
+
elif type == "sku" and b != [] and quantity == 0:
|
|
527
|
+
quantitys = items[a]["totalOrderableQuantity"]
|
|
528
|
+
unlimited_quantity = items[a]["unlimited_quantity"]
|
|
529
|
+
if quantitys != 0 or unlimited_quantity == True:
|
|
530
|
+
product_info = items[a]
|
|
531
|
+
spu_id = items[a]["id"]
|
|
532
|
+
sku_id = jsonpath(items[a]["variations"], "$..id")
|
|
533
|
+
sku_id_quantity = jsonpath(items[a]["variations"], "$..totalOrderableQuantity")
|
|
534
|
+
break
|
|
535
|
+
return spu_id, sku_id, sku_id_quantity, product_info
|
|
487
536
|
|
|
488
537
|
|
|
489
538
|
def model_one_add_product(data):
|
|
490
539
|
"""
|
|
491
|
-
贴文销售模式1-模式3
|
|
540
|
+
贴文销售模式1-模式3添加商品,只添加第一个有库存商品到贴文
|
|
492
541
|
:param data:
|
|
493
542
|
:return:
|
|
494
543
|
"""
|
|
@@ -496,25 +545,27 @@ def model_one_add_product(data):
|
|
|
496
545
|
headers = data["headers"]
|
|
497
546
|
sales_id = data["sales_id"]
|
|
498
547
|
url = "%s/api/posts/post/sales/%s/products"%(env,sales_id)
|
|
499
|
-
|
|
548
|
+
spu_id, sku_id, sku_id_quantity, product_info = search_post_product(data)
|
|
549
|
+
# print("sku_id",sku_id)
|
|
500
550
|
skuList = []
|
|
501
551
|
body = {}
|
|
502
|
-
if
|
|
503
|
-
for index, sku in enumerate(
|
|
504
|
-
skuId = sku["skuId"]
|
|
505
|
-
spuId = sku["spuId"]
|
|
552
|
+
if len(sku_id) >1:
|
|
553
|
+
for index, sku in enumerate(sku_id):
|
|
554
|
+
# skuId = sku["skuId"]
|
|
555
|
+
# spuId = sku["spuId"]
|
|
506
556
|
sku_data = {}
|
|
507
|
-
sku_data["skuId"] =
|
|
557
|
+
sku_data["skuId"] = sku
|
|
508
558
|
sku_data["missCommonKey"] = False
|
|
509
559
|
sku_data["keyList"] = ["模式1关键字%d" % index]
|
|
510
560
|
skuList.append(sku_data)
|
|
511
561
|
# print(skuList)
|
|
512
|
-
if
|
|
562
|
+
if len(sku_id)<=1:
|
|
513
563
|
body = {
|
|
514
|
-
"spuList": [{"spuId":
|
|
564
|
+
"spuList": [{"spuId": spu_id, "missCommonKey": "false", "customNumbers": [], "keyList": ["无规格商品关键字"]}]}
|
|
515
565
|
else:
|
|
516
566
|
body = {
|
|
517
|
-
"spuList": [{"spuId":
|
|
567
|
+
"spuList": [{"spuId": spu_id, "missCommonKey": "false", "customNumbers": [], "skuList": skuList}]}
|
|
568
|
+
# print(body)
|
|
518
569
|
response = requests.post(url, headers=headers, json=body).json()
|
|
519
570
|
return response
|
|
520
571
|
|
|
@@ -528,25 +579,25 @@ def model_four_add_product(data):
|
|
|
528
579
|
headers = data["headers"]
|
|
529
580
|
sales_id = data["sales_id"]
|
|
530
581
|
url = "%s/api/posts/post/sales/%s/products"%(env,sales_id)
|
|
531
|
-
|
|
582
|
+
spu_id, sku_id, sku_id_quantity, product_info = search_post_product(data)
|
|
532
583
|
skuList = []
|
|
533
|
-
if
|
|
534
|
-
for index, sku in enumerate(
|
|
535
|
-
skuId = sku["skuId"]
|
|
536
|
-
spuId = sku["spuId"]
|
|
584
|
+
if len(sku_id) >1:
|
|
585
|
+
for index, sku in enumerate(sku_id):
|
|
586
|
+
# skuId = sku["skuId"]
|
|
587
|
+
# spuId = sku["spuId"]
|
|
537
588
|
sku_data = {}
|
|
538
|
-
sku_data["skuId"] =
|
|
589
|
+
sku_data["skuId"] = sku
|
|
539
590
|
sku_data["missCommonKey"] = False
|
|
540
591
|
skuList.append(sku_data)
|
|
541
592
|
# print(skuList)
|
|
542
593
|
customNumbers = "模式4接口关键字下单"
|
|
543
594
|
body = {}
|
|
544
|
-
if
|
|
595
|
+
if len(sku_id) <= 1:
|
|
545
596
|
body = {"spuList": [
|
|
546
|
-
{"spuId":
|
|
597
|
+
{"spuId": spu_id, "missCommonKey": "true", "customNumbers": [customNumbers], "customNumber": customNumbers}]}
|
|
547
598
|
else:
|
|
548
599
|
body = {"spuList": [
|
|
549
|
-
{"spuId":
|
|
600
|
+
{"spuId": spu_id, "missCommonKey": "false", "customNumbers": [customNumbers], "customNumber": customNumbers,
|
|
550
601
|
"skuList": skuList}]}
|
|
551
602
|
response = requests.post(url, headers=headers, json=body).json()
|
|
552
603
|
return response
|
|
@@ -731,7 +782,17 @@ def get_payment(data):
|
|
|
731
782
|
headers = data["headers"]
|
|
732
783
|
url ="%s/openApi/proxy/v1/payments?page=1&per_page=10&include_fields[]=config_data.tappay"%env
|
|
733
784
|
response = requests.get(url, headers=headers).json()
|
|
734
|
-
|
|
785
|
+
payment_types = [item["type"] for item in response["data"]["items"]]
|
|
786
|
+
payment_id = ""
|
|
787
|
+
for payment in payment_types:
|
|
788
|
+
# print(delivery)
|
|
789
|
+
if payment == "bank_transfer":
|
|
790
|
+
index = payment_types.index(payment)
|
|
791
|
+
payment_info = response["data"]["items"][index]
|
|
792
|
+
payment_id = payment_info["id"]
|
|
793
|
+
break
|
|
794
|
+
if payment_id == "":
|
|
795
|
+
payment_id = response["data"]["items"][0]["id"]
|
|
735
796
|
return payment_id,response
|
|
736
797
|
|
|
737
798
|
def get_delivery(data):
|
|
@@ -743,9 +804,20 @@ def get_delivery(data):
|
|
|
743
804
|
# print("物流data",data)
|
|
744
805
|
env = data["env"]
|
|
745
806
|
headers = data["headers"]
|
|
746
|
-
url = "%s/openApi/proxy/v1/delivery_options?page=1&per_page=
|
|
807
|
+
url = "%s/openApi/proxy/v1/delivery_options?page=1&per_page=998"%env
|
|
747
808
|
response = requests.get(url, headers=headers).json()
|
|
748
|
-
|
|
809
|
+
# print(response)
|
|
810
|
+
delivery_types = [item["region_type"] for item in response["data"]["items"]]
|
|
811
|
+
delivery_id = ""
|
|
812
|
+
for delivery in delivery_types:
|
|
813
|
+
# print(delivery)
|
|
814
|
+
if delivery == "custom":
|
|
815
|
+
index = delivery_types.index(delivery)
|
|
816
|
+
delivery_info = response["data"]["items"][index]
|
|
817
|
+
delivery_id = delivery_info["id"]
|
|
818
|
+
break
|
|
819
|
+
if delivery_id=="":
|
|
820
|
+
delivery_id = response["data"]["items"][0]["id"]
|
|
749
821
|
return delivery_id,response
|
|
750
822
|
|
|
751
823
|
def get_comment_user(data):
|
|
@@ -920,7 +992,7 @@ def manual_order(data):
|
|
|
920
992
|
"source_data": {"type": "fb", "source_id": page_id}, "customer_phone_country_code": "86",
|
|
921
993
|
"postcode": postcode}
|
|
922
994
|
res = requests.post(url,headers=headers,json=body)
|
|
923
|
-
print("创建订单返回",res.text)
|
|
995
|
+
# print("创建订单返回",res.text)
|
|
924
996
|
#获取订单ID
|
|
925
997
|
orderNumber = ""
|
|
926
998
|
if res.status_code==200:
|
|
@@ -1466,12 +1538,4 @@ def get_mc_order_link(url):
|
|
|
1466
1538
|
|
|
1467
1539
|
|
|
1468
1540
|
if __name__=="__main__":
|
|
1469
|
-
pass
|
|
1470
|
-
# headers = {"content-type": "application/json",
|
|
1471
|
-
# "authorization": "Bearer 11eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIzN2Y2MjY2M2IyMTI1MjIzMWZlMTc4MTE2ODhkNDliYSIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MjI5YTdiYWVhNzA2NDJhOGI2NWViZGEiLCJhcHBsaWNhdGlvbl9pZCI6IjYwZWVjNWViZjhkYzkyMDAwNjUyZTAwNiJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMteXkuc2hvcGxpbmVzdGcuY29tIiwiYXVkIjpbXSwic3ViIjoiNjIyOWE3YmFlYTcwNjQyYThiNjVlYmRhIn0.FwtntG1dAYWNUcEZf6WSehXQveEw_rvTSGPEM3xV9FA"}
|
|
1472
|
-
# data = {"env": "https://front-service.shoplinestg.com", "headers": headers, "platform": "FB_GROUP",
|
|
1473
|
-
# "sales_id": "84031", "page_id": "110842575060695",
|
|
1474
|
-
# "relationUrl": "https://www.facebook.com/groups/416632743936652/posts/823646243235298/"}
|
|
1475
|
-
# res = relate_post(data)
|
|
1476
|
-
# print(res)
|
|
1477
|
-
|
|
1541
|
+
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc-common-interface-2.3.3 → sc-common-interface-2.3.5}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|