sc-common-interface 3.0.3__tar.gz → 3.0.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-3.0.3 → sc_common_interface-3.0.5}/PKG-INFO +1 -1
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/LiveCommonInterface.py +133 -11
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/PostCommonInterface.py +10 -10
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/setup.py +1 -1
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/CommonOa.py +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/McCommonInterface.py +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/OperaMysql.py +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/OperaRedis.py +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/ScPulsar.py +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/ScWebsocket.py +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/__init__.py +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/setup.cfg +0 -0
{sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -2510,27 +2510,33 @@ def add_product_to_live(data):
|
|
|
2510
2510
|
def send_comment():
|
|
2511
2511
|
timStamp = int(time.time())
|
|
2512
2512
|
|
|
2513
|
-
key = "a2f4cae7b637eb42967ef5ab6a6a3ff7"
|
|
2514
|
-
url = "https://front-service.shoplinestg.com/facebook/webhook"
|
|
2515
|
-
post_id = "
|
|
2516
|
-
page_id = "119305964434044"
|
|
2513
|
+
# key = "a2f4cae7b637eb42967ef5ab6a6a3ff7"
|
|
2514
|
+
# url = "https://front-service.shoplinestg.com/facebook/webhook"
|
|
2515
|
+
# post_id = "119305964434044_1342551670179146"
|
|
2516
|
+
# page_id = "119305964434044"
|
|
2517
2517
|
|
|
2518
2518
|
# message = "fb文3本消息%d"%timStamp
|
|
2519
2519
|
# message = "%d" % random.randint(3, 999)
|
|
2520
|
-
message = "
|
|
2520
|
+
message = "方法"
|
|
2521
2521
|
|
|
2522
2522
|
# 生产
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2523
|
+
key = 'a2f4cae7b637eb42967ef5ab6a6a3ff7'
|
|
2524
|
+
url = 'https://front-admin.shoplineapp.com/facebook/webhook'
|
|
2525
|
+
post_id = "107977035056574_1829322521133522"
|
|
2526
|
+
page_id = "107977035056574"
|
|
2527
|
+
|
|
2528
|
+
#预发
|
|
2529
|
+
# key = '5e3bba98882fc0fb22a0607238bc5b8f'
|
|
2530
|
+
# url = 'https://front-admin-preview.shoplineapp.com/facebook/webhook'
|
|
2531
|
+
# post_id = "106411048594439_1764064707792500"
|
|
2532
|
+
# page_id = "106411048594439"
|
|
2527
2533
|
|
|
2528
2534
|
randnum = random.randint(1, 1000)
|
|
2529
2535
|
user_id = "4724508317%d%d" % (timStamp, randnum)
|
|
2530
2536
|
# user_id = "47245083171744792310"0
|
|
2531
2537
|
name = "️%d%dtest" % (randnum, timStamp)
|
|
2532
2538
|
contentbody = {"entry": [{"id": page_id, "time": timStamp, "changes": [{"value": {
|
|
2533
|
-
"from": {"id": user_id,
|
|
2539
|
+
"from": {"id": user_id,"name":name},
|
|
2534
2540
|
"post": {"status_type": "added_video", "is_published": True, "updated_time": "2024-10-16T13:28:29+0000",
|
|
2535
2541
|
"permalink_url": "https://www.facebook.com/161726309710099/videos/3266941630279674",
|
|
2536
2542
|
"promotion_status": "inactive", "id": post_id}, "message": message, "post_id": post_id,
|
|
@@ -2539,6 +2545,7 @@ def send_comment():
|
|
|
2539
2545
|
"parent_id": post_id, "verb": "add"}, "field": "feed"}]}], "object": "page"}
|
|
2540
2546
|
# print("contentbody", contentbody)
|
|
2541
2547
|
# contentbody["entry"][0]["time"] = time
|
|
2548
|
+
print(contentbody)
|
|
2542
2549
|
|
|
2543
2550
|
signdata = hmac.new(key.encode('utf-8'), json.dumps(contentbody).encode('utf-8'), hashlib.sha1).hexdigest()
|
|
2544
2551
|
signdata = signdata
|
|
@@ -2546,8 +2553,123 @@ def send_comment():
|
|
|
2546
2553
|
headers = {"Content-Type": "application/json", "x-hub-signature": "sha1=%s" % signdata}
|
|
2547
2554
|
res = requests.post(url, headers=headers, data=contentbody)
|
|
2548
2555
|
# print(res.content)
|
|
2556
|
+
def create_single_product(data):
|
|
2557
|
+
"""
|
|
2558
|
+
新增无规格商品
|
|
2559
|
+
:param data:
|
|
2560
|
+
:return: 返回新增的商品的spu_id
|
|
2561
|
+
"""
|
|
2562
|
+
env = data["env"]
|
|
2563
|
+
headers = data["headers"]
|
|
2564
|
+
sales_id = data["sales_id"]
|
|
2565
|
+
quantity = 1000
|
|
2566
|
+
if "quantity" in data:
|
|
2567
|
+
quantity = data["quantity"]
|
|
2568
|
+
url = "%s/api/posts/post/sales/%s/product/create" % (env, sales_id)
|
|
2569
|
+
product_name = "post接口新增商品多规格商品名称%d" % int(time.time())
|
|
2570
|
+
if "product_name" in data:
|
|
2571
|
+
product_name = data["product_name"]
|
|
2572
|
+
keyword = "post接口新增商品多规格商品关键字%d" % int(time.time())
|
|
2573
|
+
if "keyword" in data:
|
|
2574
|
+
keyword = data["keyword"]
|
|
2575
|
+
body = {"customNumber": keyword, "quantity": quantity, "unlimitedQuantity": False, "productName": product_name,
|
|
2576
|
+
"imageUrl": "https://s3-ap-southeast-1.amazonaws.com/static.shoplineapp.com/sc-admin/product-default.png",
|
|
2577
|
+
"price": 3}
|
|
2578
|
+
response = requests.post(url, headers=headers, json=body).json()
|
|
2579
|
+
spu_id = response["data"]
|
|
2580
|
+
return spu_id
|
|
2581
|
+
|
|
2582
|
+
|
|
2583
|
+
|
|
2584
|
+
def get_bulk_edit_keyword(data):
|
|
2585
|
+
global customNumber, pre_keyword, spu
|
|
2586
|
+
keyword_type = data.get("keyword_type","keyList")
|
|
2587
|
+
if keyword_type=="customNumber":
|
|
2588
|
+
customNumber = "前和后关键字%d"%int(time.time())
|
|
2589
|
+
customNumber = data.get("customNumber",customNumber)
|
|
2590
|
+
elif keyword_type=="keyList":
|
|
2591
|
+
pre_keyword = "前缀关键字%d"%int(time.time())
|
|
2592
|
+
pre_keyword = data.get("keyList", pre_keyword)
|
|
2593
|
+
#拿到直播间商品信息
|
|
2594
|
+
response = get_live_product(data)
|
|
2595
|
+
product_page_result = response["data"]["product_page_result"]["list"]
|
|
2596
|
+
spuList = []
|
|
2597
|
+
bulk_edit_body = {"spuList":spuList}
|
|
2598
|
+
if product_page_result!=[]:
|
|
2599
|
+
for product in product_page_result:
|
|
2600
|
+
spu = {}
|
|
2601
|
+
product_info = product["product_info"]
|
|
2602
|
+
product_id = product_info["id"]
|
|
2603
|
+
spu["spuId"] = product_id
|
|
2604
|
+
spu["defaultKey"] = ""
|
|
2605
|
+
if keyword_type=="customNumber":
|
|
2606
|
+
spu["customNumbers"] = [customNumber]
|
|
2607
|
+
else:
|
|
2608
|
+
spu["customNumbers"] = []
|
|
2609
|
+
sku_product_list = product["sku_product_list"]
|
|
2610
|
+
sku_list = []
|
|
2611
|
+
num = 1
|
|
2612
|
+
for sku in sku_product_list:
|
|
2613
|
+
sku_dict = {}
|
|
2614
|
+
sku_id = sku["sku_id"]
|
|
2615
|
+
sku_dict["skuId"] = sku_id
|
|
2616
|
+
if keyword_type=="customNumber":
|
|
2617
|
+
sku_dict["keyList"] = []
|
|
2618
|
+
else:
|
|
2619
|
+
keyword = pre_keyword+str(num)
|
|
2620
|
+
sku_dict["keyList"] = [keyword]
|
|
2621
|
+
num+=1
|
|
2622
|
+
sku_list.append(sku_dict)
|
|
2623
|
+
spu["skuList"] = sku_list
|
|
2624
|
+
break
|
|
2625
|
+
spuList.append(spu)
|
|
2626
|
+
else:
|
|
2627
|
+
# 给直播间创建商品
|
|
2628
|
+
spu_id = create_single_product(data)
|
|
2629
|
+
spu = {}
|
|
2630
|
+
spu["spuId"] = spu_id
|
|
2631
|
+
spu["defaultKey"] = ""
|
|
2632
|
+
if keyword_type == "customNumber":
|
|
2633
|
+
spu["customNumbers"] = [customNumber]
|
|
2634
|
+
else:
|
|
2635
|
+
spu["customNumbers"] = []
|
|
2636
|
+
skuList = []
|
|
2637
|
+
sku = {}
|
|
2638
|
+
sku["skuId"] = spu_id
|
|
2639
|
+
if keyword_type == "customNumber":
|
|
2640
|
+
sku["keyList"] = []
|
|
2641
|
+
else:
|
|
2642
|
+
sku["keyList"] = [pre_keyword]
|
|
2643
|
+
skuList.append(sku)
|
|
2644
|
+
spu["skuList"] = skuList
|
|
2645
|
+
spuList.append(spu)
|
|
2646
|
+
return bulk_edit_body
|
|
2647
|
+
|
|
2648
|
+
def syn_line_product(data):
|
|
2649
|
+
env = data["env"]
|
|
2650
|
+
headers = data["headers"]
|
|
2651
|
+
sales_id = data["sales_id"]
|
|
2652
|
+
product_id = data["product_id"]
|
|
2653
|
+
line_status = data.get("line_status","HIDDEN")
|
|
2654
|
+
url = "%s/api/posts/post/sales/%s/spu/%s/status?status=%s"%(env,sales_id,product_id,line_status)
|
|
2655
|
+
response = requests.post(url,headers=headers).json()
|
|
2656
|
+
return response
|
|
2657
|
+
|
|
2658
|
+
|
|
2659
|
+
|
|
2660
|
+
|
|
2661
|
+
|
|
2662
|
+
|
|
2663
|
+
|
|
2664
|
+
|
|
2665
|
+
|
|
2666
|
+
|
|
2549
2667
|
|
|
2550
2668
|
|
|
2551
2669
|
if __name__ == "__main__":
|
|
2552
|
-
|
|
2670
|
+
for i in range(60):
|
|
2671
|
+
send_comment()
|
|
2672
|
+
|
|
2673
|
+
|
|
2674
|
+
|
|
2553
2675
|
|
{sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/PostCommonInterface.py
RENAMED
|
@@ -305,12 +305,12 @@ def modify_lucky_draw(data):
|
|
|
305
305
|
tagFriendsNum = 0
|
|
306
306
|
if "tagFriendsNum" in data:
|
|
307
307
|
tagFriendsNum = data["tagFriendsNum"]
|
|
308
|
-
taskTypes = ["COMMENT"]
|
|
309
|
-
if "taskTypes" in data:
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
308
|
+
taskTypes = data.get("taskTypes",["COMMENT"])
|
|
309
|
+
# if "taskTypes" in data:
|
|
310
|
+
# if "taskTypes" =="order":
|
|
311
|
+
# taskTypes = ["HAD_ORDER", "COMMENT"]
|
|
312
|
+
# elif "taskTypes" == "like":
|
|
313
|
+
# taskTypes = ["LIKED_POST", "COMMENT"]
|
|
314
314
|
activityInfo = {"keyword": keyword, "autoAward": autoAward, "tagFriendsNum": tagFriendsNum, "taskTypes": taskTypes}
|
|
315
315
|
winReplyComment = "🎁 恭喜您中奖!请与小编联系确认领奖细节!"
|
|
316
316
|
if "winReplyComment" in data:
|
|
@@ -496,7 +496,7 @@ def create_fb_text_post(data):
|
|
|
496
496
|
body = {"postDescription":postDescription,"platform":platform,
|
|
497
497
|
"url":[],"mediaFbid":[],"pageId":page_id}
|
|
498
498
|
response = requests.post(url,headers=headers,json=body).json()
|
|
499
|
-
print("创建贴文返回",response)
|
|
499
|
+
# print("创建贴文返回",response)
|
|
500
500
|
post_id = response["data"]["post_id"]
|
|
501
501
|
post_pid = response["data"]["id"]
|
|
502
502
|
return post_id,post_pid,response
|
|
@@ -877,6 +877,7 @@ def get_comment_user(data):
|
|
|
877
877
|
query = data["query"]
|
|
878
878
|
params["query"] = query
|
|
879
879
|
url = "%s/api/posts/post/comments"%env
|
|
880
|
+
# print(params)
|
|
880
881
|
response = requests.get(url, headers=headers,params=params).json()
|
|
881
882
|
print(response)
|
|
882
883
|
post_user_id = jsonpath(response, "$..id")[0]
|
|
@@ -1713,7 +1714,6 @@ def edit_message(data):
|
|
|
1713
1714
|
|
|
1714
1715
|
|
|
1715
1716
|
|
|
1716
|
-
|
|
1717
1717
|
if __name__=="__main__":
|
|
1718
|
-
|
|
1719
|
-
|
|
1718
|
+
pass
|
|
1719
|
+
|
|
File without changes
|
{sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc_common_interface-3.0.3 → sc_common_interface-3.0.5}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|