Commit 375b8c3a by 泽锋 李

新增review拉取服务

parent fefbff55
......@@ -583,5 +583,35 @@ namespace AutoTurnOver.DB
//throw new Exception("lms 调拨单时效 接口异常: " + ex.StackTrace);
}
}
/// <summary>
/// 查询review
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static List<api_pps_review_response_dto.result_dto.data_dto> GetReview(api_pps_review_request_dto data)
{
try
{
//查询采购建议明细
string url = ConfigHelper.GetValue("pps-sys:review");
string resultStr = HttpHelper.Request(url, RequestType.POST, data.ToJson(), "application/json", timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<api_pps_review_response_dto>();
if (result == null)
{
return new List<api_pps_review_response_dto.result_dto.data_dto>();
}
else
{
return result.result.reviewList;
}
}
catch (Exception ex)
{
return new List<api_pps_review_response_dto.result_dto.data_dto>();
//throw new Exception("平台费 接口异常: " + ex.Message);
//throw new Exception("平台费 接口异常: " + ex.StackTrace);
}
}
}
}
......@@ -1230,6 +1230,53 @@ where id=@id
}
/// <summary>
/// 刷新fba的昨日review
/// </summary>
public static void ResetFbaExtendReview(DateTime date)
{
// 时间点
// 最近1天
int page = 0;
int rows = 100;
while (true)
{
page++;
var configs = _connection.Query<dc_config_fba_extend>($@" select * from dc_config_fba_extend limit {(page - 1) * rows},{rows} ").ToList();
if (configs == null || configs.Count <= 0)
{
break;
}
foreach (var item in configs.GroupBy(s=>s.web_site))
{
// 查询review
var reviews = ApiUtility.GetReview(new api_pps_review_request_dto { Site= item.Key,Type = 1,AsinList = item.Select(s=>s.asin).ToList()});
foreach (var asinItem in item.AsEnumerable())
{
var tempReview = reviews.FirstOrDefault(s => s.asin == asinItem.asin) ?? new api_pps_review_response_dto.result_dto.data_dto();
_connection.Execute($@" update dc_config_fba_extend set
review_count=@review_count,
review_score=@review_score,
review_reset_date = now()
where id=@id
", new
{
review_count = tempReview.totalComments,
review_score = tempReview.score,
id = asinItem.id
});
}
}
}
}
}
......
......@@ -25,6 +25,13 @@ namespace AutoTurnOver.DB
public decimal bailun_sku_quantity_ordered_7 { get; set; }
public decimal amount_sales_usd_30 { get; set; }
public decimal bailun_sku_quantity_ordered_30 { get; set; }
/// <summary>
///
/// </summary>
public decimal? review_count { get; set; }
public decimal? review_score { get; set; }
public DateTime? review_reset_date { get; set; }
}
public class dc_config_fba_extend_temp_dto
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.ApiDto
{
public class api_pps_review_request_dto
{
/// <summary>
/// 1 等于过去 2 =今天
/// </summary>
public int Type { get; set; }
public string Site { get; set; }
public List<string> AsinList { get; set; }
}
public class api_pps_review_response_dto
{
public result_dto result { get; set; }
public int statusCode { get; set; }
public string message { get; set; }
public class result_dto
{
public string site { get; set; }
public List<data_dto> reviewList { get; set; }
public class data_dto
{
public string asin { get; set; }
public string sku { get; set; }
public decimal? score { get; set; }
public decimal? totalComments { get; set; }
}
}
}
}
......@@ -58,6 +58,12 @@ namespace ResetOutofstock
daily.ResetFbaExtendSales(now);
Console.WriteLine($"结束 刷新fba历史销量,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 0 && now.Minute == 06)
{
Console.WriteLine($"开始 刷新fba昨日review,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
daily.ResetFbaExtendReview(now);
Console.WriteLine($"结束 刷新fba昨日review,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 2 && now.Minute == 23)
{
if (now.DayOfWeek == DayOfWeek.Monday)
......
......@@ -29,7 +29,8 @@ namespace ResetOutofstock
//report.PurchaseWeekBackUp();
//await new TaskDownloadServices().Download();
//daily.ResetFbaExtendSales(DateTime.Now);
dc_aims_transfer_warehouse_dao.TransferWarehouseTask();
//dc_aims_transfer_warehouse_dao.TransferWarehouseTask();
//daily.ResetFbaExtendReview(DateTime.Now);
}
catch (Exception ex)
......
......@@ -42,7 +42,7 @@ namespace ResetOutofstock
Task.Factory.StartNew(() =>
{
Console.WriteLine($"开始 init ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
daily.ResetFbaExtendSales(DateTime.Now);
daily.ResetFbaExtendReview(DateTime.Now);
Console.WriteLine($"结束 init ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
});
......
......@@ -26,5 +26,8 @@
"list": "http://supplier.bailuntec.com/Api/ListSupplierAllByTime"
},
"api_finance_body": "http://cw.bailuntec.com/API/API/GetCompanyMainBody",
"api_trans_temp_schedule": "http://api.wms.bailuntec.com/api/services/app/AllotScheduleService/GetTempSchedulePageList"
"api_trans_temp_schedule": "http://api.wms.bailuntec.com/api/services/app/AllotScheduleService/GetTempSchedulePageList",
"pps-sys": {
"review": "https://pps.bailuntec.com/Api/amazon/analyze/Download/GetReviewInfoBy"
}
}
......@@ -27,5 +27,8 @@
"list": "http://supplier.bailuntec.com/Api/ListSupplierAllByTime"
},
"api_finance_body": "http://cw.bailuntec.com/API/API/GetCompanyMainBody",
"api_trans_temp_schedule": "http://api.wms.bailuntec.com/api/services/app/AllotScheduleService/GetTempSchedulePageList"
"api_trans_temp_schedule": "http://api.wms.bailuntec.com/api/services/app/AllotScheduleService/GetTempSchedulePageList",
"pps-sys": {
"review": "https://pps.bailuntec.com/Api/amazon/analyze/Download/GetReviewInfoBy"
}
}
......@@ -26,5 +26,8 @@
"list": "http://supplier.bailuntec.com/Api/ListSupplierAllByTime"
},
"api_finance_body": "http://cw.bailuntec.com/API/API/GetCompanyMainBody",
"api_trans_temp_schedule": "http://api.wms.bailuntec.com/api/services/app/AllotScheduleService/GetTempSchedulePageList"
"api_trans_temp_schedule": "http://api.wms.bailuntec.com/api/services/app/AllotScheduleService/GetTempSchedulePageList",
"pps-sys": {
"review": "http://172.31.13.156/Api/amazon/analyze/Download/GetReviewInfoBy"
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment