sc-common-interface 2.8.5__tar.gz → 2.8.7__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.8.5
3
+ Version: 2.8.7
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -2176,18 +2176,32 @@ def handler_bidding(data):
2176
2176
 
2177
2177
 
2178
2178
  def check_14_day(data):
2179
- response = get_live_info(data)
2180
- start_time_timestamp = response["data"]["sales"]["start_time_timestamp"]
2181
- # 将毫秒转换为秒
2182
- start_time_timestamp = start_time_timestamp / 1000
2183
- # 计算 14 天的秒数
2184
- fourteen_days_seconds = 13 * 24 * 60 * 60
2185
- # 获取当前时间戳(秒)
2186
- current_time_seconds = time.time()
2187
2179
  flag = False
2188
- if (current_time_seconds - start_time_timestamp) >= fourteen_days_seconds:
2189
- flag =True
2190
- return flag
2180
+ try:
2181
+ response = get_live_info(data)
2182
+ code = response["code"]
2183
+ if code!="SUCCESS":
2184
+ flag =True
2185
+ return flag
2186
+ else:
2187
+ start_time_timestamp = response["data"]["sales"]["start_time_timestamp"]
2188
+ # 将毫秒转换为秒
2189
+ start_time_timestamp = start_time_timestamp / 1000
2190
+ # 计算 14 天的秒数
2191
+ fourteen_days_seconds = 13 * 24 * 60 * 60
2192
+ # 获取当前时间戳(秒)
2193
+ current_time_seconds = time.time()
2194
+
2195
+ if (current_time_seconds - start_time_timestamp) >= fourteen_days_seconds:
2196
+ flag = True
2197
+ return flag
2198
+ except Exception:
2199
+ flag = True
2200
+ return flag
2201
+
2202
+
2203
+
2204
+
2191
2205
 
2192
2206
  def get_fb_sales_id(data):
2193
2207
  """"查询返回指定直播间的salse_id
@@ -2225,7 +2239,7 @@ def get_receipt_sales_id(data):
2225
2239
  sales_id = data["sales_id"]
2226
2240
  flag = check_14_day(data)
2227
2241
  if flag:
2228
- #先从列表查出一个最新结束的直播间,还是不返回要求再创建直播和链接直播
2242
+ #先从列表查出一个最新结束的直播间,还是不返回要再创建直播和链接直播
2229
2243
  sales_id = get_fb_sales_id(data)
2230
2244
  data["sales_id"] = sales_id
2231
2245
  flag2 = check_14_day(data)
@@ -2252,12 +2266,28 @@ def delete_keyword_product_set(data):
2252
2266
  headers = data["headers"]
2253
2267
  product_id = data["product_id"]
2254
2268
  url = "%s/admin/api/bff-web/keyword/product_set"%env
2269
+ if isinstance(product_id, str):
2270
+ product_id = [product_id]
2255
2271
  body = {
2256
2272
  "ids": product_id
2257
2273
  }
2258
2274
  response = requests.delete(url,headers=headers,json=body).json()
2259
2275
  return response
2260
2276
 
2277
+ def delete_keyword_product(data):
2278
+ "删除关键字组件里的组合商品"
2279
+ "product_id为:[]"
2280
+ env = data["env"]
2281
+ headers = data["headers"]
2282
+ product_id = data["product_id"]
2283
+ url = "%s/api/posts/common/product/key/spu"%env
2284
+ if isinstance(product_id,str):
2285
+ product_id = [product_id]
2286
+ body = {
2287
+ "ids": product_id
2288
+ }
2289
+ response = requests.delete(url,headers=headers,json=body).json()
2290
+ return response
2261
2291
 
2262
2292
  def get_keyword_product_set(data):
2263
2293
  "查询关键字组件里的组合商品"
@@ -2412,18 +2442,25 @@ def add_product_to_live(data):
2412
2442
  return response
2413
2443
 
2414
2444
 
2445
+ def get_merchant_currency(data):
2446
+ env = data["env"]
2447
+ headers = data["headers"]
2415
2448
 
2416
2449
 
2417
2450
 
2418
2451
 
2419
2452
 
2420
2453
 
2454
+ if __name__=="__main__":
2455
+ from PostCommonInterface import *
2421
2456
 
2457
+ data = {'env': 'https://front-admin-preview.shoplineapp.com', 'headers': {'Content-Type': 'application/json',
2458
+ 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkZmQxYjNiMDc0M2JmYWU4YTFkODk4NzczNjgyZWVkZCIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjVlYjkwMzVhYjA5ZDEyNjU4NTFmOTU2ZiJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.Y90xLfYVAp9yByHo7Vc7A3hHrp6hX9X9Lg4mg_WiE_I',
2459
+ 'lang': 'en'}, 'sales_id': '552980'
2460
+ }
2461
+ __, response = get_comment_user(data)
2462
+ print(response)
2422
2463
 
2423
- if __name__=="__main__":
2424
- data = {'env': 'https://front-admin-preview.shoplineapp.com', 'headers': {'Content-Type': 'application/json', 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkZmQxYjNiMDc0M2JmYWU4YTFkODk4NzczNjgyZWVkZCIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjVlYjkwMzVhYjA5ZDEyNjU4NTFmOTU2ZiJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.Y90xLfYVAp9yByHo7Vc7A3hHrp6hX9X9Lg4mg_WiE_I', 'lang': 'en'}, 'platform': 'FB_GROUP', 'sales_id': '95828', 'keyword': ['test关键字组件直播间新增的关键字1739955629'], 'product_id': '65bba57da79d260023ac30ff'}
2425
- res = add_product_to_live(data)
2426
- print(res)
2427
2464
 
2428
2465
 
2429
2466
 
@@ -877,12 +877,13 @@ def get_comment_user(data):
877
877
  env = data["env"]
878
878
  headers = data["headers"]
879
879
  sales_id = data["sales_id"]
880
- params = {"pageNo":1,"pageSize":10,"salesId":sales_id}
880
+ params = {"pageNo":1,"pageSize":25,"salesId":sales_id}
881
881
  if "query" in data:
882
882
  query = data["query"]
883
883
  params["query"] = query
884
884
  url = "%s/api/posts/post/comments"%env
885
885
  response = requests.get(url, headers=headers,params=params).json()
886
+ print(response)
886
887
  post_user_id = jsonpath(response, "$..id")[0]
887
888
  return post_user_id,response
888
889
 
@@ -916,7 +917,7 @@ def post_edit_cart(data):
916
917
  def search_customer(data):
917
918
  env = data["env"]
918
919
  headers = data["headers"]
919
- phone = data["query"]
920
+ phone = data["phone"]
920
921
  url = "%s/openApi/proxy/v1/customers/search?query=%s&per_page=50&search_fields[]=mobile_phone" \
921
922
  "&search_fields[]=phones" % (env, phone)
922
923
  response = requests.get(url, headers=headers).json()
@@ -925,7 +926,7 @@ def search_customer(data):
925
926
  def merge_customer(data):
926
927
  env = data["env"]
927
928
  headers = data["headers"]
928
- phone = data["query"]
929
+ phone = data["phone"]
929
930
  __, response = get_comment_user(data)
930
931
  # print("留言面板查询返回",response)
931
932
  name = data["name"]
@@ -974,8 +975,7 @@ def manual_order(data):
974
975
  env = data["env"]
975
976
  headers = data["headers"]
976
977
  phone = "18776343453"
977
- if "query" in data:
978
- phone = data["query"]
978
+ phone = data.get("phone",phone)
979
979
  __, response = get_comment_user(data)
980
980
  name = jsonpath(response, "$..name")[0]
981
981
  user_id = jsonpath(response, "$..psid")[0]
@@ -983,7 +983,7 @@ def manual_order(data):
983
983
  data["name"] = name
984
984
  data["user_id"] = user_id
985
985
  data["page_id"] = page_id
986
- data["query"] = phone
986
+ data["phone"] = phone
987
987
  platform = "facebook"
988
988
  if "platform" in data:
989
989
  platform = data["platform"].upper()
@@ -1044,7 +1044,7 @@ def manual_order(data):
1044
1044
  "source_data": {"type": "fb", "source_id": page_id}, "customer_phone_country_code": "86",
1045
1045
  "postcode": postcode}
1046
1046
  res = requests.post(url,headers=headers,json=body)
1047
- # print("创建订单返回",res.text)
1047
+ print("创建订单返回",res.text)
1048
1048
  #获取订单ID
1049
1049
  orderNumber = ""
1050
1050
  if res.status_code==200:
@@ -1721,6 +1721,8 @@ def edit_message(data):
1721
1721
 
1722
1722
 
1723
1723
  if __name__=="__main__":
1724
- pass
1724
+ data = {'env': 'https://front-admin-preview.shoplineapp.com', 'headers': {'Content-Type': 'application/json', 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkZmQxYjNiMDc0M2JmYWU4YTFkODk4NzczNjgyZWVkZCIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjVlYjkwMzVhYjA5ZDEyNjU4NTFmOTU2ZiJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.Y90xLfYVAp9yByHo7Vc7A3hHrp6hX9X9Lg4mg_WiE_I', 'lang': 'en'}, 'sales_id': 553386, 'platform': 'FACEBOOK', 'prize_type': 'product', 'key': '5e3bba98882fc0fb22a0607238bc5b8f', 'type': 'activity'}
1725
+ orderNumber, customer_id, res = manual_order(data)
1726
+ print(orderNumber)
1725
1727
 
1726
1728
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.8.5
3
+ Version: 2.8.7
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.8.5',
5
+ version='2.8.7',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),