|
|
@@ -5,6 +5,7 @@ using System.Drawing.Printing;
|
|
|
using System.Runtime.InteropServices;
|
|
|
using System.Text.Json;
|
|
|
using System.Text.RegularExpressions;
|
|
|
+using System.Xml.Linq;
|
|
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
|
|
|
|
|
namespace molilian.core
|
|
|
@@ -18,25 +19,25 @@ namespace molilian.core
|
|
|
//DateTime endTime = DateTime.Now;
|
|
|
//DateTime startTime = endTime.AddDays(-90);
|
|
|
//if (_accountId == 3) endTime = DateTime.Parse("2024-04-07");
|
|
|
-//#if DEBUG
|
|
|
+ //#if DEBUG
|
|
|
|
|
|
-// startTime = DateTime.Parse("2024-05-01");
|
|
|
-// endTime = DateTime.Parse("2024-06-01");
|
|
|
+ // startTime = DateTime.Parse("2024-05-01");
|
|
|
+ // endTime = DateTime.Parse("2024-06-01");
|
|
|
|
|
|
|
|
|
-// int total = 0;
|
|
|
+ // int total = 0;
|
|
|
|
|
|
-// List<DateTime> orderTimes = new List<DateTime>();
|
|
|
+ // List<DateTime> orderTimes = new List<DateTime>();
|
|
|
|
|
|
-// for (DateTime date = startTime; date <= endTime; date = date.AddDays(1))
|
|
|
-// {
|
|
|
-// orderTimes.Add(date);
|
|
|
-// }
|
|
|
+ // for (DateTime date = startTime; date <= endTime; date = date.AddDays(1))
|
|
|
+ // {
|
|
|
+ // orderTimes.Add(date);
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
-//#else
|
|
|
+ //#else
|
|
|
|
|
|
-//#endif
|
|
|
+ //#endif
|
|
|
|
|
|
//当日往前查询
|
|
|
(int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = GetTkOrders(startTime, endTime, DateTime.MinValue, false, sleep);
|
|
|
@@ -572,8 +573,12 @@ SET order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
|
|
|
|
|
|
string GetRawItemId(string mktId)
|
|
|
{
|
|
|
+ string body = string.Empty, location = string.Empty;
|
|
|
try
|
|
|
{
|
|
|
+ string lock_key = $"lock:GetRawItemId:disabled";
|
|
|
+ int count = RedisHelper.Get<int>(lock_key);
|
|
|
+ if (count > 0) return null;
|
|
|
|
|
|
string cacheKey = $":cache:mkt2itemId:{mktId}";
|
|
|
|
|
|
@@ -609,7 +614,24 @@ SET order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
|
|
|
throw response.ResponseException;
|
|
|
}
|
|
|
|
|
|
- var body = response.Body();
|
|
|
+ location = response.ResponseMessage?.Headers?.Location?.ToString();
|
|
|
+ if (!string.IsNullOrEmpty(location) && location.Contains("err.taobao.com/error1.html"))
|
|
|
+ {
|
|
|
+ RedisHelper.Set(lock_key, 1, 60);
|
|
|
+
|
|
|
+ string message = $"【GetRawItemId】{_accountId}:{_accountName}\t{_proxy?.Address}\n" +
|
|
|
+ $"{mktId}\n{location}";
|
|
|
+
|
|
|
+ NotifyCore.Notify(new NifyMessage
|
|
|
+ {
|
|
|
+ message = message,
|
|
|
+ priority = NifyMessagePriority.high,
|
|
|
+ tags = ["red_circle"]
|
|
|
+ });
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ body = response.Body();
|
|
|
var root = body.Convert2JsonElement();
|
|
|
itemId = root.PathRead<string>("model.item.itemId");
|
|
|
if (!string.IsNullOrEmpty(itemId))
|
|
|
@@ -620,7 +642,9 @@ SET order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- string message = $"【GetRawItemId】[{mktId}\n{ex.Message}\n{ex.StackTrace}";
|
|
|
+ string message = $"【GetRawItemId】{_accountId}:{_accountName}\t{_proxy?.Address}\n" +
|
|
|
+ $"{mktId}\n{location}\n{body}\n{ex.Message}";
|
|
|
+
|
|
|
NotifyCore.Notify(new NifyMessage
|
|
|
{
|
|
|
message = message,
|