|
@@ -60,7 +60,31 @@ namespace molilian.core
|
|
|
return string.Empty;
|
|
return string.Empty;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static string GetDeeplink(string url)
|
|
|
|
|
|
|
+ public static string GetDeeplink(string url, string clickId)
|
|
|
|
|
+ {
|
|
|
|
|
+ var config = TkConfigCore.Get();
|
|
|
|
|
+ if (string.IsNullOrEmpty(config.dp_style)) return GetDefaultStyleDeeplink(url);
|
|
|
|
|
+
|
|
|
|
|
+ Random rand = new();
|
|
|
|
|
+ int randomValue = rand.Next(0, 101);
|
|
|
|
|
+ if (randomValue > config.dp_style_percentage) return GetDefaultStyleDeeplink(url);
|
|
|
|
|
+
|
|
|
|
|
+ if (string.IsNullOrEmpty(clickId)) clickId = config.dp_style_default_str;
|
|
|
|
|
+
|
|
|
|
|
+ var ts = DateTime.Now.Convert2UnixTimestamp(true);
|
|
|
|
|
+
|
|
|
|
|
+ string virtual_params = $"{{\"category\":\"jump\",\"des\":\"HomePage\",\"m_param\":{{\"jdv\":\"0|oppo_seedling|-|widget|{clickId}|{ts}\"}}";
|
|
|
|
|
+ if (!string.IsNullOrEmpty(url))
|
|
|
|
|
+ {
|
|
|
|
|
+ virtual_params = $"{{\"category\":\"jump\",\"des\":\"m\",\"url\":\"{url}\",\"m_param\":{{\"jdv\":\"0|oppo_seedling|-|widget|{clickId}|{ts}\"}}}}";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ string result = $"openapp.jdmobile://virtual?params={virtual_params.UrlEncode()}";
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public static string GetDefaultStyleDeeplink(string url)
|
|
|
{
|
|
{
|
|
|
if (string.IsNullOrEmpty(url)) return "openapp.jdmobile://";
|
|
if (string.IsNullOrEmpty(url)) return "openapp.jdmobile://";
|
|
|
string virtual_params = $"{{\"category\":\"jump\",\"des\":\"m\",\"sourceValue\":\"babel-act\",\"sourceType\":\"babel\",\"url\":\"{url}\",\"M_sourceFrom\":\"h5auto\",\"msf_type\":\"auto\"}}";
|
|
string virtual_params = $"{{\"category\":\"jump\",\"des\":\"m\",\"sourceValue\":\"babel-act\",\"sourceType\":\"babel\",\"url\":\"{url}\",\"M_sourceFrom\":\"h5auto\",\"msf_type\":\"auto\"}}";
|
|
@@ -68,10 +92,11 @@ namespace molilian.core
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static JdDataDTO GetFormattedObject(string content, string ip = "", string oaid = "")
|
|
|
|
|
|
|
+ public static JdDataDTO GetFormattedObject(string content, string ip = "", string oaid = "", string clickId = "")
|
|
|
{
|
|
{
|
|
|
string shortLinkurl = GetLink(content);
|
|
string shortLinkurl = GetLink(content);
|
|
|
- string deeplink_url = GetDeeplink(shortLinkurl);
|
|
|
|
|
|
|
+ string deeplink_url = GetDeeplink(shortLinkurl, clickId);
|
|
|
|
|
+
|
|
|
return new JdDataDTO()
|
|
return new JdDataDTO()
|
|
|
{
|
|
{
|
|
|
message = string.Empty,
|
|
message = string.Empty,
|
|
@@ -110,6 +135,9 @@ namespace molilian.core
|
|
|
Referer = "http://www.jd.com",
|
|
Referer = "http://www.jd.com",
|
|
|
Proxy = ProxyNodesCore.RandomOne()
|
|
Proxy = ProxyNodesCore.RandomOne()
|
|
|
};
|
|
};
|
|
|
|
|
+#if DEBUG
|
|
|
|
|
+ client.Proxy = null;
|
|
|
|
|
+#endif
|
|
|
var response = client.Request(url);
|
|
var response = client.Request(url);
|
|
|
if (!response.Successed) return null;
|
|
if (!response.Successed) return null;
|
|
|
|
|
|
|
@@ -223,7 +251,7 @@ namespace molilian.core
|
|
|
// return result;
|
|
// return result;
|
|
|
//}
|
|
//}
|
|
|
|
|
|
|
|
- public async Task<JdDataDTO> JdParseAsync(string content, int commerceType, JdDataDTO result, CancellationToken cancellationToken = default)
|
|
|
|
|
|
|
+ public async Task<JdDataDTO> JdParseAsync(string content, int commerceType, string clickId, JdDataDTO result, CancellationToken cancellationToken = default)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
string message = "OK";
|
|
string message = "OK";
|
|
@@ -239,7 +267,7 @@ namespace molilian.core
|
|
|
result.accountName = string.Empty;
|
|
result.accountName = string.Empty;
|
|
|
result.content = content;
|
|
result.content = content;
|
|
|
result.shortLinkurl = url;
|
|
result.shortLinkurl = url;
|
|
|
- result.deeplink_url = GetDeeplink(url);
|
|
|
|
|
|
|
+ result.deeplink_url = GetDeeplink(url, clickId);
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
string shortLinkurl = url;
|
|
string shortLinkurl = url;
|
|
@@ -269,7 +297,7 @@ namespace molilian.core
|
|
|
result.accountName = string.Empty;
|
|
result.accountName = string.Empty;
|
|
|
result.content = content;
|
|
result.content = content;
|
|
|
result.shortLinkurl = url;
|
|
result.shortLinkurl = url;
|
|
|
- result.deeplink_url = GetDeeplink(url);
|
|
|
|
|
|
|
+ result.deeplink_url = GetDeeplink(url, clickId);
|
|
|
return result;
|
|
return result;
|
|
|
case LinkTypeEnum.other_aff:
|
|
case LinkTypeEnum.other_aff:
|
|
|
result.success = false;
|
|
result.success = false;
|
|
@@ -281,7 +309,7 @@ namespace molilian.core
|
|
|
result.accountName = string.Empty;
|
|
result.accountName = string.Empty;
|
|
|
result.content = content;
|
|
result.content = content;
|
|
|
result.shortLinkurl = url;
|
|
result.shortLinkurl = url;
|
|
|
- result.deeplink_url = GetDeeplink(url);
|
|
|
|
|
|
|
+ result.deeplink_url = GetDeeplink(url, clickId);
|
|
|
return result;
|
|
return result;
|
|
|
default:
|
|
default:
|
|
|
if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(result.itemId) ||
|
|
if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(result.itemId) ||
|
|
@@ -304,8 +332,8 @@ namespace molilian.core
|
|
|
{
|
|
{
|
|
|
LinkTypeEnum.other_aff or
|
|
LinkTypeEnum.other_aff or
|
|
|
LinkTypeEnum.baseDomain or
|
|
LinkTypeEnum.baseDomain or
|
|
|
- LinkTypeEnum.goods => JdUnionPlus.GetDeeplink(result.shortLinkurl),
|
|
|
|
|
- _ => JdUnionPlus.GetDeeplink(string.Empty),
|
|
|
|
|
|
|
+ LinkTypeEnum.goods => JdUnionPlus.GetDeeplink(result.shortLinkurl, clickId),
|
|
|
|
|
+ _ => JdUnionPlus.GetDeeplink(string.Empty, clickId),
|
|
|
};
|
|
};
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
@@ -325,8 +353,8 @@ namespace molilian.core
|
|
|
result.shortLinkurl = url;
|
|
result.shortLinkurl = url;
|
|
|
result.deeplink_url = result.link_type switch
|
|
result.deeplink_url = result.link_type switch
|
|
|
{
|
|
{
|
|
|
- LinkTypeEnum.other_aff or LinkTypeEnum.goods => JdUnionPlus.GetDeeplink(result.shortLinkurl),
|
|
|
|
|
- _ => JdUnionPlus.GetDeeplink(string.Empty),
|
|
|
|
|
|
|
+ LinkTypeEnum.other_aff or LinkTypeEnum.goods => JdUnionPlus.GetDeeplink(result.shortLinkurl, clickId),
|
|
|
|
|
+ _ => JdUnionPlus.GetDeeplink(string.Empty, clickId),
|
|
|
};
|
|
};
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
@@ -345,14 +373,14 @@ namespace molilian.core
|
|
|
switch (_account.work_mode)
|
|
switch (_account.work_mode)
|
|
|
{
|
|
{
|
|
|
case JdUnionWorkMode.SiteApi:
|
|
case JdUnionWorkMode.SiteApi:
|
|
|
- result = await GetPromotionBySiteAsync(result, url, cancellationToken);
|
|
|
|
|
|
|
+ result = await GetPromotionBySiteAsync(result, url, clickId, cancellationToken);
|
|
|
break;
|
|
break;
|
|
|
case JdUnionWorkMode.AffApi:
|
|
case JdUnionWorkMode.AffApi:
|
|
|
- result = await GetPromotionByAffAsync(result, url, cancellationToken);
|
|
|
|
|
|
|
+ result = await GetPromotionByAffAsync(result, url, clickId, cancellationToken);
|
|
|
break;
|
|
break;
|
|
|
case JdUnionWorkMode.Crawler:
|
|
case JdUnionWorkMode.Crawler:
|
|
|
default:
|
|
default:
|
|
|
- result = await GetPromotionByCrawlerAsync(result, url, cancellationToken);
|
|
|
|
|
|
|
+ result = await GetPromotionByCrawlerAsync(result, url, clickId, cancellationToken);
|
|
|
|
|
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|