huangyifan 5 mesiacov pred
rodič
commit
f0a2b22c81
1 zmenil súbory, kde vykonal 11 pridanie a 10 odobranie
  1. 11 10
      sync_amz_data/public/sp_api_client.py

+ 11 - 10
sync_amz_data/public/sp_api_client.py

@@ -1330,6 +1330,14 @@ class SpApiRequest:
         shopReportday_E = (datetime.now().date() + timedelta(days=days)).strftime("%Y-%m-%d")
         # print(shopReportday)
         # print("1"*50)
+        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'
         para = {"reportType": ReportType.GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA,#GET_SELLER_FEEDBACK_DATA,# GET_FLAT_FILE_RETURNS_DATA_BY_RETURN_DATE |GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA
                  "dataStartTime": shopReportday,
                 "dataEndTime": shopReportday_E, "reportOptions":{"reportPeriod": "DAY"}}
@@ -1340,14 +1348,7 @@ 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 '')
@@ -1612,8 +1613,8 @@ class SpApiRequest:
 if __name__ == '__main__':
     # for days in range(-17,-2):
     #     SpApiRequest.get_allShops("GET_FLAT_FILE_RETURNS_DATA_BY_RETURN_DATE",days=days,**{})
-    for days in range(-5,-2):
-        SpApiRequest.get_allShops("GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",days=days,**{})
+    for days in range(-5,-60,-1):
+        SpApiRequest.get_allShops("GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA",days=days,**{})
     #
     # SpApiRequest.listing_infoTable()
     # rel = SpApiRequest.get_catelog(account_name='AM-ZOSI-US',country=Marketplaces.US,asin='B0B8CPHSL4')