Skip to content

Commit

Permalink
Merge pull request CnGal#842 from LittleFish-233/master
Browse files Browse the repository at this point in the history
steam链接添加跟踪信息
  • Loading branch information
LittleFish-233 authored Oct 7, 2024
2 parents d69ba4c + 6f29e1c commit 662270f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,16 @@ public string GetLink()
return GetLink(PublishPlatformType, Link);
}

public string GetLinkText()
{
return GetLinkText(PublishPlatformType, Link);
}

public static string GetLink(PublishPlatformType type,string link)
{
return type switch
{
PublishPlatformType.Steam => int.TryParse(link, out int steamId) ? "https://store.steampowered.com/app/" + link : link,
PublishPlatformType.Steam => int.TryParse(link, out int steamId) ? ($"https://store.steampowered.com/app/{link}?utm_source=cngal&utm_campaign=entries"): link,
PublishPlatformType.AppStore => "https://apps.apple.com/cn/app/" + link,
PublishPlatformType.GooglePlay => "https://play.google.com/store/apps/details?id=" + link,
PublishPlatformType.Epic => "https://store.epicgames.com/zh-CN/p/" + link,
Expand All @@ -245,6 +250,15 @@ public static string GetLink(PublishPlatformType type,string link)
_ => link
};
}

public static string GetLinkText(PublishPlatformType type, string link)
{
return type switch
{
PublishPlatformType.Steam => int.TryParse(link, out int steamId) ? "https://store.steampowered.com/app/" + link : link,
_ => null
};
}
}

public class EntryRoleViewModel:EntryInforTipViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<div>
@if (string.IsNullOrWhiteSpace(Model.Link) == false)
{
<CnGalWebSite.Shared.MasaComponent.Shared.Components.IconText Icon="@IconType.Link" Text="链接:" Url="@Model.GetLink()" Class="ma-1" ItemProp="url" />
<CnGalWebSite.Shared.MasaComponent.Shared.Components.IconText Icon="@IconType.Link" Text="链接:" Url="@Model.GetLink()" UrlText="@Model.GetLinkText()" Class="ma-1" ItemProp="url" />
}
@if (string.IsNullOrWhiteSpace(Model.Name) == false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ else
<span class="@(Class+" d-flex ma-1")" style=" word-break: break-all; align-items: center;">
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaIcon Type="@Icon" IconString="@IconString" />
<span style="word-break: keep-all;"> @Text</span>
<a href="@Url" target="_blank" itemprop="@ItemProp">@Url</a>
<a href="@Url" target="_blank" itemprop="@ItemProp">@(string.IsNullOrWhiteSpace(UrlText) ? Url : UrlText)</a>
</span>
}

Expand All @@ -37,6 +37,8 @@ else
[Parameter]
public string Url { get; set; }
[Parameter]
public string UrlText { get; set; }
[Parameter]
public IconType Icon { get; set; }
[Parameter]
public string IconString { get; set; }
Expand Down

0 comments on commit 662270f

Please sign in to comment.