From 7555e52ca65f9c014f435781b02e31bcdb3ab226 Mon Sep 17 00:00:00 2001 From: saif Date: Fri, 10 Jan 2025 11:23:10 +0500 Subject: [PATCH] added shipping rates sync functionality --- config.json | 6 ++++-- utils.js | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index 7457669..be1aa5d 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "dev": { - "temu_orders_shipping_rates" : "D:/Projects/Crawlers/temu-label-crawler/temu_orders_shipping_rates", + "temu_orders_shipping_rates" : "D:/Projects/Crawlers/temu-label-crawler/shipping_rates", "temu_orders_path" : "D:/Projects/Crawlers/temu-label-crawler", "orders_path": "D:/Projects/Crawlers/amazon_crawler/data/orders", "voc_path":"D:/Projects/Crawlers/amazon_crawler/data/voc", @@ -13,6 +13,7 @@ "localhost_return_comments_path":"http://192.168.91.11:8080/uind/rest/cosmos/amazon-voc/return-comments/edit", "cosmos_path_reviews" : "https://portal.utopiaindustries.pk/uind/rest/cosmos/amazon-reviews/edit", "cosmos_temu_orders" : "http://192.168.90.228:8081/cosmos/temu/order-upload-json", + "cosmos_temu_order_shipping_rates" : "https://cosmos.utopiadeals.com/cosmos/order-shipping-rates-json", "shopify_products_path" : "D:/Projects/Crawlers/amazon_crawler/data/products", "shopify_variants_path" : "D:/Projects/Crawlers/amazon_crawler/data/variants", "amz_product_path" : "D:/Projects/Crawlers/amazon_crawler/data/products", @@ -34,7 +35,8 @@ "cosmos_path_orders_progress": "https://portal.utopiaindustries.pk/uind/rest/cosmos/amazon-orders-progress/edit", "cosmos_path_vocs" : "https://portal.utopiaindustries.pk/uind/rest/cosmos/amazon-voc/edit", "cosmos_path_reviews" : "https://portal.utopiaindustries.pk/uind/rest/cosmos/amazon-reviews/edit", - "cosmos_temu_orders" : "https://cosmos.utopiadeals.com/cosmos/temu/order-upload-json", + "cosmos_temu_orders" : "https://cosmos.utopiadeals.com/cosmos/temu/order-upload-json", + "cosmos_temu_order_shipping_rates" : "https://cosmos.utopiadeals.com/cosmos/order-shipping-rates-json", "temuLoginPage" : "https://seller.temu.com/login.html", "temuUnshippedOrdersPage" : "https://seller.temu.com/orders.html?activeTab=2", "temuOrderPage" : "https://seller.temu.com/order-detail.html?parent_order_sn=", diff --git a/utils.js b/utils.js index 3cbcae5..29ff928 100644 --- a/utils.js +++ b/utils.js @@ -291,6 +291,24 @@ exports.getTemuOrdersPage = getTemuOrdersPage; * check list */ const isEmpty = function (arr) { - return arr.length === 0; + return arr === undefined || arr.length === 0; } exports.isEmpty = isEmpty; + +/** + * daily pick pack from cosmos ( dimensions ) +*/ +const getSkuDailyPickPack = function( skuStr, date){ + return `https://cosmos.utopiadeals.com/cosmos/daily-pick-packs-json?marketplace=AMAZON_USA&skus=${skuStr}&from=${date}&to=${date}` +} +exports.getSkuDailyPickPack = getSkuDailyPickPack; + +/* +* +*/ +const getFirstDayToCurrentMonth = function( ){ + const now = new Date(); + const firstDay = new Date(now.getFullYear(), now.getMonth(), 2); + return firstDay.toISOString().split('T')[0]; +} +exports.getFirstDayToCurrentMonth = getFirstDayToCurrentMonth;