|
@@ -16,7 +16,7 @@ namespace molilian.core
|
|
|
public partial class UnionParseCore
|
|
public partial class UnionParseCore
|
|
|
{
|
|
{
|
|
|
public static async Task<APIResult> DeeplinkTaobaoParseAsync(string content, int commerceType,
|
|
public static async Task<APIResult> DeeplinkTaobaoParseAsync(string content, int commerceType,
|
|
|
- string ip = "", string oaid = "", string riskStrategy = "", int launchScene = 0,
|
|
|
|
|
|
|
+ string ip = "", string oaid = "", string riskStrategy = "", int launchScene = -1,
|
|
|
int accountid = 0)
|
|
int accountid = 0)
|
|
|
{
|
|
{
|
|
|
bool other_aff = false;
|
|
bool other_aff = false;
|
|
@@ -61,37 +61,45 @@ namespace molilian.core
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- (bool isTaobaUrl, string shortLinkurl) = AlimamaPlus.IsTaobaoUrl(parseResult.url);
|
|
|
|
|
- if (!isTaobaUrl)
|
|
|
|
|
|
|
+ if (!AlimamaPlus.IsShortLink(parseResult.url))
|
|
|
{
|
|
{
|
|
|
- result.success = false;
|
|
|
|
|
- result.channel = TkChannelEnum.tb;
|
|
|
|
|
- result.link_type = LinkTypeEnum.unknown;
|
|
|
|
|
- result.success = false;
|
|
|
|
|
- result.message = "放弃转链";
|
|
|
|
|
- result.reason = "无效商品id";
|
|
|
|
|
-
|
|
|
|
|
- if (!result.success)
|
|
|
|
|
|
|
+ (bool isTaobaUrl, string shortLinkurl) = AlimamaPlus.IsTaobaoUrl(parseResult.url);
|
|
|
|
|
+ if (!isTaobaUrl)
|
|
|
{
|
|
{
|
|
|
- result.deeplink_url = string.Empty;
|
|
|
|
|
|
|
+ result.success = false;
|
|
|
|
|
+ result.channel = TkChannelEnum.tb;
|
|
|
|
|
+ result.link_type = LinkTypeEnum.unknown;
|
|
|
|
|
+ result.success = false;
|
|
|
|
|
+ result.message = "放弃转链";
|
|
|
|
|
+ result.reason = "无效商品id";
|
|
|
|
|
+
|
|
|
|
|
+ if (!result.success)
|
|
|
|
|
+ {
|
|
|
|
|
+ result.deeplink_url = string.Empty;
|
|
|
|
|
+ }
|
|
|
|
|
+ _ = TkLogCore.ParseLogAsync(result);
|
|
|
|
|
+ return TaobaoParseOutput(result, swData, new
|
|
|
|
|
+ {
|
|
|
|
|
+ result.success,
|
|
|
|
|
+ result.commercial,
|
|
|
|
|
+ result.message,
|
|
|
|
|
+ result.content,
|
|
|
|
|
+ result.itemName,
|
|
|
|
|
+ other_aff,
|
|
|
|
|
+ result.deeplink_url,
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- _ = TkLogCore.ParseLogAsync(result);
|
|
|
|
|
- return TaobaoParseOutput(result, swData, new
|
|
|
|
|
- {
|
|
|
|
|
- result.success,
|
|
|
|
|
- result.commercial,
|
|
|
|
|
- result.message,
|
|
|
|
|
- result.content,
|
|
|
|
|
- result.itemName,
|
|
|
|
|
- other_aff,
|
|
|
|
|
- result.deeplink_url,
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ result.shortLinkurl = shortLinkurl;
|
|
|
|
|
+ result.content = shortLinkurl;
|
|
|
|
|
+ content = shortLinkurl;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ result.content = parseResult.url;
|
|
|
|
|
+ result.shortLinkurl = parseResult.url;
|
|
|
|
|
+ content = parseResult.url;
|
|
|
}
|
|
}
|
|
|
- result.shortLinkurl = shortLinkurl;
|
|
|
|
|
result.deeplink_url = string.Empty;
|
|
result.deeplink_url = string.Empty;
|
|
|
- result.content = shortLinkurl;
|
|
|
|
|
- content = shortLinkurl;
|
|
|
|
|
|
|
|
|
|
string reason = string.Empty;
|
|
string reason = string.Empty;
|
|
|
|
|
|
|
@@ -454,7 +462,7 @@ namespace molilian.core
|
|
|
|
|
|
|
|
|
|
|
|
|
public static async Task<APIResult> DeeplinkJdParseAsync(string content, int commerceType, string ip, string oaid,
|
|
public static async Task<APIResult> DeeplinkJdParseAsync(string content, int commerceType, string ip, string oaid,
|
|
|
- string riskStrategy = "", int launchScene = 0,
|
|
|
|
|
|
|
+ string riskStrategy = "", int launchScene = -1,
|
|
|
int accountid = 0, string clickId = "", CancellationToken cancellationToken = default)
|
|
int accountid = 0, string clickId = "", CancellationToken cancellationToken = default)
|
|
|
{
|
|
{
|
|
|
var config = TkConfigCore.Get();
|
|
var config = TkConfigCore.Get();
|
|
@@ -662,7 +670,23 @@ namespace molilian.core
|
|
|
_ = TkLogCore.ParseLogAsync(result);
|
|
_ = TkLogCore.ParseLogAsync(result);
|
|
|
return PddParseOutput(result);
|
|
return PddParseOutput(result);
|
|
|
}
|
|
}
|
|
|
- var account = PddPoolCore.GetOne(PddUnionWorkMode.All, accountid, "dp");
|
|
|
|
|
|
|
+ PddPoolDTO account = null;
|
|
|
|
|
+ string lockKey;
|
|
|
|
|
+ long cis_num = 0;
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < 3; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ account = PddPoolCore.GetOne(PddUnionWorkMode.All, accountid, "dp");
|
|
|
|
|
+ if (account == null) continue;
|
|
|
|
|
+
|
|
|
|
|
+ if (account.cis_limit > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ lockKey = $"pdd_cis_limit_{result.accountId}";
|
|
|
|
|
+ cis_num = RedisHelper.Get<long>(lockKey);
|
|
|
|
|
+ if (cis_num > 0) continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
if (account == null)
|
|
if (account == null)
|
|
|
{
|
|
{
|
|
|
result.success = false;
|
|
result.success = false;
|
|
@@ -674,6 +698,27 @@ namespace molilian.core
|
|
|
}
|
|
}
|
|
|
result.accountId = account.id;
|
|
result.accountId = account.id;
|
|
|
result.accountName = account.name;
|
|
result.accountName = account.name;
|
|
|
|
|
+ result.proxy_node = account.nodeName;
|
|
|
|
|
+
|
|
|
|
|
+ if (account.cis_limit > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ // 更新当前分钟的使用统计
|
|
|
|
|
+ PddPoolCore.UpdateAccountUsage(account.id);
|
|
|
|
|
+
|
|
|
|
|
+ lockKey = $"pdd_cis_limit_{result.accountId}";
|
|
|
|
|
+ cis_num = RedisHelper.IncrBy(lockKey);
|
|
|
|
|
+ if (cis_num > 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ result.success = false;
|
|
|
|
|
+ result.message = "放弃转链";
|
|
|
|
|
+ result.reason = $"没有匹配账号{cis_num}";
|
|
|
|
|
+ result.deeplink_url = PddUnionPlus.GetDeeplink(result.rawContent);
|
|
|
|
|
+ _ = TkLogCore.ParseLogAsync(result);
|
|
|
|
|
+ return PddParseOutput(result);
|
|
|
|
|
+ }
|
|
|
|
|
+ RedisHelper.Expire(lockKey, TimeSpan.FromMilliseconds(account.cis_limit));
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
var plus = new PddUnionPlus(account);
|
|
var plus = new PddUnionPlus(account);
|
|
|
|
|
|
|
@@ -721,7 +766,12 @@ namespace molilian.core
|
|
|
}
|
|
}
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- string param = content.GetContentPart("params=", "");
|
|
|
|
|
|
|
+ string param = content.GetContentPart("params=", "&");
|
|
|
|
|
+ if (string.IsNullOrEmpty(param))
|
|
|
|
|
+ {
|
|
|
|
|
+ param = content.GetContentPart("params=", "");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
param = param.UrlDecode();
|
|
param = param.UrlDecode();
|
|
|
var root = param.Convert2JsonElement();
|
|
var root = param.Convert2JsonElement();
|
|
|
string category = root.Read("category", string.Empty);
|
|
string category = root.Read("category", string.Empty);
|
|
@@ -801,7 +851,14 @@ namespace molilian.core
|
|
|
return resust;
|
|
return resust;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- string itemid_pattern = "(?:pc_detail\\.itemId\\.\\d+&id=|detail\\.tmall\\.com\\/item\\.htm\\?id=)(\\d+)";
|
|
|
|
|
|
|
+ string itemid_pattern = "(?:pc_detail\\.itemId\\.\\d+&id=|(?:detail|item).*?[?&]id=)(\\d+)";
|
|
|
|
|
+ //https://h5.m.taobao.com/awp/core/detail.htm?id=951950415328
|
|
|
|
|
+ //taobao://item.taobao.com/item.htm?id=950190032209
|
|
|
|
|
+ //https://main.m.taobao.com/detail/index.html?id=908945171430&price=148.9&sourceType=item&suid=9a9921f6-5610-497c-9bb3-94427da5fbc0&ut_sk=1.aFUBza6VAN8DAOC0tQdyzNek_21646297_1753594384153.Copy.ShareGlobalNavigation_1&un=8ad28c612754fb28d9e5b32ae03d1ada&share_crt_v=1&un_site=0&spm=a2159r.13376460.0.0&tbSocialPopKey=shareItem&sp_tk=MnluVjQ0N2tDUXU%3D&cpp=1&shareurl=true&short_name=h.hOFywxY0R9ZuBR4&bxsign=scduUbJTmvx63UiuFdNYy6FDvPx0iaKQu9uyc1zfURgLpCZqHIO1Aqj8fgZ6_ZUy-rJeS1ZH3PiAGcemxyFqpeN5BTKnDbDuU77d6sqWD2TVok-8K3nspP6YVfAZBvzfx7WLVAMu3X6119Ru_1ooSt9ug&tk=2ynV447kCQu&app=chrome&x-ssr=true&slk_gid=gid_er_sidebar_0&action=ali.open.nav&module=h5&bootImage=0&slk_sid=2nf7IO8XhWICAd9KM5hOtK8k_1753783603680&slk_t=1753783605292&slk_gid=gid_er_sidebar_0&afcPromotionOpen=false&bc_fl_src=h5_huanduan&source=slk_dp
|
|
|
|
|
+ //https://main.m.taobao.com/detail/index.html?id=937709627060&price=208.9&sourceType=item&suid=48a4d791-127c-45d7-b580-a63097897697&ut_sk=1.aFUBza6VAN8DAOC0tQdyzNek_21646297_1753594384153.Copy.ShareGlobalNavigation_1&un=8ad28c612754fb28d9e5b32ae03d1ada&share_crt_v=1&un_site=0&spm=a2159r.13376460.0.0&tbSocialPopKey=shareItem&sp_tk=SG42aTQ0NzFMc3Y%3D&cpp=1&shareurl=true&short_name=h.hOCuiAd32dv9wBK&bxsign=scd0KcwU22FkrzJ77bVvMLnP0u4_5wpLz1ERfC-eCQE1wk21BYNMuT-w0I07gisSMdabKmlWh9F6DwW5DXLagikYvHjSD7Eh5n2n6kmyw1aF-dZWuqzGkI9Z-AHw-rffwjrPx1cXEsQ35HqOwmmkMEiYw&tk=Hn6i4471Lsv&app=chrome&x-ssr=true&slk_gid=gid_er_sidebar_0&action=ali.open.nav&module=h5&bootImage=0&slk_sid=580NIcIpZVQBASQOANYD2H43_1753783601070&slk_t=1753783605251&slk_gid=gid_er_sidebar_0&afcPromotionOpen=false&bc_fl_src=h5_huanduan&source=slk_dp
|
|
|
|
|
+ //https://main.m.taobao.com/detail/index.html?spm=a224e.7913437.1.1849716&id=672205270263&sku_properties=210158085%3A170720673&_bind=true&bc_fl_src=tmall_market_llb_1_1849716&llbPlatform=pc&agentId=1685089&llbIsd=1&bxsign=llbirWpI8yJlJLibTbWOXuYbuykv0WCTORO2Hj7JqVtdGau62UJiz2xO%2FZSIjdwbOudIUUsdN51H41YisrOLI53ZMhblPS9ZMyVhFDisOySHmk%3D&ntfMsId=65df6cbb682a0779f23141a7efd9c391&llbOsd=1&mm_unid=1_11192113_560501015e6d5754040c0255026f5353086656040b075e&jlogid=0718172753b3bfbd&x-ssr=true&slk_gid=gid_er_sidebar_0&bc_fl_src=tmall_market_llb_1_1849716&action=ali.open.nav&module=h5&bootImage=0&slk_sid=rnd07d9b9_1753784332640&slk_t=1753784332860&slk_gid=gid_er_sidebar_0&afcPromotionOpen=false&source=slk_dp
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
var regex = new Regex(itemid_pattern);
|
|
var regex = new Regex(itemid_pattern);
|
|
|
var match = regex.Match(content);
|
|
var match = regex.Match(content);
|
|
@@ -839,13 +896,39 @@ tbopen://m.taobao.com/tbopen/index.html?h5Url=https%3A%2F%2Fku.m.taobao.com%2Fmi
|
|
|
return resust;
|
|
return resust;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (url.Contains("s.click.taobao.com"))
|
|
|
|
|
|
|
+ if (AlimamaPlus.IsAffLink(url))
|
|
|
{
|
|
{
|
|
|
resust.success = false;
|
|
resust.success = false;
|
|
|
resust.reason = "其他推广链接";
|
|
resust.reason = "其他推广链接";
|
|
|
return resust;
|
|
return resust;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (url.Contains("ali_trackid="))
|
|
|
|
|
+ {
|
|
|
|
|
+ resust.success = false;
|
|
|
|
|
+ resust.reason = "其他推广链接";
|
|
|
|
|
+ return resust;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (AlimamaPlus.IsShortLink(url))
|
|
|
|
|
+ {
|
|
|
|
|
+ resust.success = true;
|
|
|
|
|
+ resust.url = url;
|
|
|
|
|
+ return resust;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ regex = new Regex(itemid_pattern);
|
|
|
|
|
+ match = regex.Match(url);
|
|
|
|
|
+ if (match.Success)
|
|
|
|
|
+ {
|
|
|
|
|
+ string itemId = match.Groups[1].Value;
|
|
|
|
|
+ string item_url = $"https://item.taobao.com/item.htm?id={itemId}";
|
|
|
|
|
+
|
|
|
|
|
+ resust.success = true;
|
|
|
|
|
+ resust.url = item_url;
|
|
|
|
|
+ return resust;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
resust.success = false;
|
|
resust.success = false;
|
|
|
resust.reason = "未知链接";
|
|
resust.reason = "未知链接";
|
|
|
return resust;
|
|
return resust;
|