Browse Source

sync modify

huangyifan 5 tháng trước cách đây
mục cha
commit
cb68e3b496

+ 11 - 4
sync_amz_data/public/sp_api_client.py

@@ -1252,7 +1252,7 @@ class SpApiRequest:
         client = get_client(host='3.93.43.158', port=8123, username='root',
                             password='6f0eyLuiVn3slzbGWpzI')
         tmp_df = client.query_df(
-            """select date from ams.performance where seller_id='%s' and country_code='%s' and date='%s' and isFeedback=1""" % (
+            """select * from ams.performance where seller_id='%s' and country_code='%s' and date='%s' and isFeedback=1""" % (
             seller_id, country_code, shopReportday))
         if len(tmp_df) > 0:
             print("数据已存在")
@@ -1323,6 +1323,14 @@ class SpApiRequest:
             return pd.DataFrame()
         if len(decom_df) == 0:
             return reportid
+        client = get_client(host='3.93.43.158', port=8123, username='root',
+                            password='6f0eyLuiVn3slzbGWpzI')
+        tmp_df = client.query_df(
+            """select * from ams.performance where seller_id='%s' and country_code='%s' and date='%s' and isFeedback=0""" % (
+            seller_id, country_code, shopReportday))
+        if len(tmp_df) > 0:
+            print("数据已存在")
+            return 'Done'
         # print("2"*100)
         decom_df[decom_df.select_dtypes(float).columns] = decom_df[decom_df.select_dtypes(float).columns].applymap(
             lambda x: str(x) if not pd.isna(x) else '')
@@ -1348,8 +1356,7 @@ class SpApiRequest:
         df_fbaR['comment'].fillna("", inplace=True)
         # df_fbaR[['order_id','sku','asin','fnsku','detailed_disposition','product_name','isFeedback','date']]
 
-        client = get_client(host='3.93.43.158', port=8123, username='root',
-                            password='6f0eyLuiVn3slzbGWpzI')
+
         try:
             client.insert_df(table='ams.performance', df=df_fbaR[
             ['order_id', 'sku', 'asin', 'fnsku', 'detailed_disposition', 'product_name', 'isFeedback', 'date',
@@ -1373,7 +1380,7 @@ class SpApiRequest:
         shopReportday_E = (datetime.now() + timedelta(days=days)).strftime("%Y-%m-%d")
         client = get_client(host='3.93.43.158', port=8123, username='root',
                             password='6f0eyLuiVn3slzbGWpzI')
-        tmp_df = client.query_df("""select date from ams.performance where seller_id='%s' and country_code='%s' and date='%s' and isFeedback=0""" % (seller_id,country_code,shopReportday))
+        tmp_df = client.query_df("""select * from ams.return_record where seller_id='%s' and country_code='%s' and ReportDate='%s'""" % (seller_id,country_code,shopReportday))
         if len(tmp_df)>0:
             print("数据已存在")
             return 'Done'

+ 1 - 1
sync_get_order_data.py

@@ -8,7 +8,7 @@ from datetime import datetime,timedelta
 
 def func_run():
     try:
-        for days in (-2,-3):
+        for days in (-2,-3,-4,-5):
 
             sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",days=days,**{})
             time.sleep(5)

+ 1 - 1
sync_listing_order_Retry.py

@@ -6,7 +6,7 @@ def func_run():
     days = -4
     for d_ in (-2,-3,-4,-5):
         try:
-            sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",days=d_,**{})
+            sp_api_client.SpApiRequest.get_allShops("GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA",days=d_,**{})
         except Exception as e:
             print(e)