|
@@ -15,6 +15,7 @@ using System.Security.Cryptography;
|
|
|
using System.Data;
|
|
using System.Data;
|
|
|
using System.Threading.Channels;
|
|
using System.Threading.Channels;
|
|
|
using YunhuiKit;
|
|
using YunhuiKit;
|
|
|
|
|
+using System.IO;
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace molilian.core
|
|
namespace molilian.core
|
|
@@ -33,6 +34,7 @@ namespace molilian.core
|
|
|
channel = item.channel,
|
|
channel = item.channel,
|
|
|
ip = item.ip,
|
|
ip = item.ip,
|
|
|
oaid = item.oaid,
|
|
oaid = item.oaid,
|
|
|
|
|
+ mktId = item.mktId,
|
|
|
itemId = item.itemId,
|
|
itemId = item.itemId,
|
|
|
itemName = item.itemName,
|
|
itemName = item.itemName,
|
|
|
taoToken = item.taoToken,
|
|
taoToken = item.taoToken,
|
|
@@ -59,7 +61,7 @@ namespace molilian.core
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- public static async Task<TkDataDTO> GetLinkSummaryAsync(TkPoolDTO account, string itemId, string mktId, string itemTitle)
|
|
|
|
|
|
|
+ public static async Task<(int, TkDataDTO)> GetLinkSummaryAsync(TkPoolDTO account, string itemId, string mktId, string itemTitle)
|
|
|
{
|
|
{
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
@@ -86,7 +88,7 @@ namespace molilian.core
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
var redisServer = EndPointCore.GetRedisServer(node);
|
|
var redisServer = EndPointCore.GetRedisServer(node);
|
|
|
- if (string.IsNullOrEmpty(redisServer)) return null;
|
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(redisServer)) return (0, null);
|
|
|
|
|
|
|
|
|
|
|
|
|
using var scope = await RedisClientFactory.CreateScopeAsync(redisServer);
|
|
using var scope = await RedisClientFactory.CreateScopeAsync(redisServer);
|
|
@@ -102,18 +104,18 @@ namespace molilian.core
|
|
|
if (!string.IsNullOrEmpty(mktId))
|
|
if (!string.IsNullOrEmpty(mktId))
|
|
|
{
|
|
{
|
|
|
result = await redis.GetAsync<TkDataDTO>($":cache:order_summary:{relatedId}:mktId:{mktId}");
|
|
result = await redis.GetAsync<TkDataDTO>($":cache:order_summary:{relatedId}:mktId:{mktId}");
|
|
|
- if (result != null) return result;
|
|
|
|
|
|
|
+ if (result != null) return (1, result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(itemId))
|
|
if (!string.IsNullOrEmpty(itemId))
|
|
|
{
|
|
{
|
|
|
result = await redis.GetAsync<TkDataDTO>($":cache:order_summary:{relatedId}:{itemId}");
|
|
result = await redis.GetAsync<TkDataDTO>($":cache:order_summary:{relatedId}:{itemId}");
|
|
|
- if (result != null) return result;
|
|
|
|
|
|
|
+ if (result != null) return (2, result);
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(itemTitle))
|
|
if (!string.IsNullOrEmpty(itemTitle))
|
|
|
{
|
|
{
|
|
|
result = await redis.GetAsync<TkDataDTO>($":cache:order_summary:{relatedId}:{itemTitle}");
|
|
result = await redis.GetAsync<TkDataDTO>($":cache:order_summary:{relatedId}:{itemTitle}");
|
|
|
- if (result != null) return result;
|
|
|
|
|
|
|
+ if (result != null) return (3, result);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -121,16 +123,16 @@ namespace molilian.core
|
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
}
|
|
}
|
|
|
- return null;
|
|
|
|
|
|
|
+ return (0, null);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
var results = await Task.WhenAll(tasks);
|
|
var results = await Task.WhenAll(tasks);
|
|
|
- return results.FirstOrDefault(r => r != null);
|
|
|
|
|
|
|
+ return results.FirstOrDefault(r => r != (0, null));
|
|
|
}
|
|
}
|
|
|
catch (Exception)
|
|
catch (Exception)
|
|
|
{
|
|
{
|
|
|
// TODO: 添加日志记录
|
|
// TODO: 添加日志记录
|
|
|
- return null;
|
|
|
|
|
|
|
+ return (0, null);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -201,7 +203,7 @@ namespace molilian.core
|
|
|
DateTime now = DateTime.Now;
|
|
DateTime now = DateTime.Now;
|
|
|
if (item.tbPaidTime < now.AddDays(-24)) return false;
|
|
if (item.tbPaidTime < now.AddDays(-24)) return false;
|
|
|
|
|
|
|
|
- var summary = await GetLinkSummaryAsync(account, item.itemId, item.mktId, item.itemTitle);
|
|
|
|
|
|
|
+ (int match_type, var summary) = await GetLinkSummaryAsync(account, item.itemId, item.mktId, item.itemTitle);
|
|
|
if (summary == null) return false;
|
|
if (summary == null) return false;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -239,6 +241,8 @@ namespace molilian.core
|
|
|
DateTime expTime = now.Hour >= 21 ? now.AddHours(3) : now.Date.AddDays(1);
|
|
DateTime expTime = now.Hour >= 21 ? now.AddHours(3) : now.Date.AddDays(1);
|
|
|
var data = new TkOrderTrackingDTO()
|
|
var data = new TkOrderTrackingDTO()
|
|
|
{
|
|
{
|
|
|
|
|
+ match_type = match_type,
|
|
|
|
|
+
|
|
|
channel = summary.channel,
|
|
channel = summary.channel,
|
|
|
accountId = item.accountId,
|
|
accountId = item.accountId,
|
|
|
accountName = accountName,
|
|
accountName = accountName,
|