mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
add signin client back
This commit is contained in:
@@ -89,6 +89,8 @@ internal static class AvatarIds
|
|||||||
public static readonly AvatarId Lynette = 10000083;
|
public static readonly AvatarId Lynette = 10000083;
|
||||||
public static readonly AvatarId Lyney = 10000084;
|
public static readonly AvatarId Lyney = 10000084;
|
||||||
public static readonly AvatarId Freminet = 10000085;
|
public static readonly AvatarId Freminet = 10000085;
|
||||||
|
public static readonly AvatarId Wriothesley = 10000086;
|
||||||
|
public static readonly AvatarId Neuvillette = 10000087;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查该角色是否为主角
|
/// 检查该角色是否为主角
|
||||||
@@ -111,7 +113,7 @@ internal static class AvatarIds
|
|||||||
{
|
{
|
||||||
[PlayerBoy] = new()
|
[PlayerBoy] = new()
|
||||||
{
|
{
|
||||||
Name = "旅行者",
|
Name = SH.ModelMetadataAvatarPlayerName,
|
||||||
Icon = "UI_AvatarIcon_PlayerBoy",
|
Icon = "UI_AvatarIcon_PlayerBoy",
|
||||||
SideIcon = "UI_AvatarIcon_Side_PlayerBoy",
|
SideIcon = "UI_AvatarIcon_Side_PlayerBoy",
|
||||||
Quality = Intrinsic.QualityType.QUALITY_ORANGE,
|
Quality = Intrinsic.QualityType.QUALITY_ORANGE,
|
||||||
@@ -119,7 +121,7 @@ internal static class AvatarIds
|
|||||||
|
|
||||||
[PlayerGirl] = new()
|
[PlayerGirl] = new()
|
||||||
{
|
{
|
||||||
Name = "旅行者",
|
Name = SH.ModelMetadataAvatarPlayerName,
|
||||||
Icon = "UI_AvatarIcon_PlayerGirl",
|
Icon = "UI_AvatarIcon_PlayerGirl",
|
||||||
SideIcon = "UI_AvatarIcon_Side_PlayerGirl",
|
SideIcon = "UI_AvatarIcon_Side_PlayerGirl",
|
||||||
Quality = Intrinsic.QualityType.QUALITY_ORANGE,
|
Quality = Intrinsic.QualityType.QUALITY_ORANGE,
|
||||||
|
|||||||
@@ -753,6 +753,15 @@ namespace Snap.Hutao.Resource.Localization {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 旅行者 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
internal static string ModelMetadataAvatarPlayerName {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ModelMetadataAvatarPlayerName", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 {0} 月 {1} 日 的本地化字符串。
|
/// 查找类似 {0} 月 {1} 日 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -369,6 +369,9 @@
|
|||||||
<value>单手剑</value>
|
<value>单手剑</value>
|
||||||
<comment>Need EXACT same string in game</comment>
|
<comment>Need EXACT same string in game</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ModelMetadataAvatarPlayerName" xml:space="preserve">
|
||||||
|
<value>旅行者</value>
|
||||||
|
</data>
|
||||||
<data name="ModelMetadataFetterInfoBirthdayFormat" xml:space="preserve">
|
<data name="ModelMetadataFetterInfoBirthdayFormat" xml:space="preserve">
|
||||||
<value>{0} 月 {1} 日</value>
|
<value>{0} 月 {1} 日</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using MetadataReliquary = Snap.Hutao.Model.Metadata.Reliquary.Reliquary;
|
|||||||
using ModelAvatarInfo = Snap.Hutao.Web.Enka.Model.AvatarInfo;
|
using ModelAvatarInfo = Snap.Hutao.Web.Enka.Model.AvatarInfo;
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.AvatarInfo.Factory;
|
namespace Snap.Hutao.Service.AvatarInfo.Factory;
|
||||||
|
|
||||||
internal sealed class SummaryReliquarySubPropertyCompositionInfo
|
internal sealed class SummaryReliquarySubPropertyCompositionInfo
|
||||||
{
|
{
|
||||||
public SummaryReliquarySubPropertyCompositionInfo(FightProperty type)
|
public SummaryReliquarySubPropertyCompositionInfo(FightProperty type)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<TextBox
|
<TextBox
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
PlaceholderText="{shcm:ResourceString Name=ViewDialogCultivateProjectInputPlaceholder}"
|
PlaceholderText="{shcm:ResourceString Name=ViewDialogCultivateProjectInputPlaceholder}"
|
||||||
Text="{x:Bind Text, Mode=TwoWay}"/>
|
Text="{x:Bind Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
Margin="0,8,0,0"
|
Margin="0,8,0,0"
|
||||||
Content="{shcm:ResourceString Name=ViewDialogCultivateProjectAttachUid}"
|
Content="{shcm:ResourceString Name=ViewDialogCultivateProjectAttachUid}"
|
||||||
|
|||||||
@@ -168,6 +168,49 @@ internal static class ApiEndpoints
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到活动Id
|
||||||
|
/// </summary>
|
||||||
|
public const string SignInRewardActivityId = "e202009291139501";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到
|
||||||
|
/// </summary>
|
||||||
|
public const string SignInRewardHome = $"{ApiTakumi}/event/bbs_sign_reward/home?act_id={SignInRewardActivityId}";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到
|
||||||
|
/// </summary>
|
||||||
|
public const string SignInRewardSign = $"{ApiTakumi}/event/bbs_sign_reward/sign";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 补签
|
||||||
|
/// </summary>
|
||||||
|
public const string SignInRewardReSign = $"{ApiTakumi}/event/bbs_sign_reward/resign";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 补签信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uid">uid</param>
|
||||||
|
/// <returns>补签信息字符串</returns>
|
||||||
|
public static string SignInRewardResignInfo(in PlayerUid uid)
|
||||||
|
{
|
||||||
|
return $"{ApiTakumi}/event/bbs_sign_reward/resign_info?act_id={SignInRewardActivityId}®ion={uid.Region}&uid={uid.Value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uid">uid</param>
|
||||||
|
/// <returns>签到信息字符串</returns>
|
||||||
|
public static string SignInRewardInfo(in PlayerUid uid)
|
||||||
|
{
|
||||||
|
return $"{ApiTakumi}/event/bbs_sign_reward/info?act_id={SignInRewardActivityId}®ion={uid.Region}&uid={uid.Value}";
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region ApiTakumiEventCalculate
|
#region ApiTakumiEventCalculate
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Web.Hoyolab.Takumi.Event.BbsSignReward;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 奖励物品
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class Award
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 图标
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("icon")]
|
||||||
|
public string Icon { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("name")]
|
||||||
|
public string Name { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 个数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("cnt")]
|
||||||
|
public string Count { get; set; } = default!;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Web.Hoyolab.Takumi.Event.BbsSignReward;
|
||||||
|
|
||||||
|
internal sealed class Reward
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 月份
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("month")]
|
||||||
|
public string? Month { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 奖励列表
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("awards")]
|
||||||
|
public List<Award>? Awards { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 支持补签
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("resign")]
|
||||||
|
public bool Resign { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
|
||||||
|
using Snap.Hutao.ViewModel.User;
|
||||||
|
using Snap.Hutao.Web.Hoyolab.DynamicSecret;
|
||||||
|
using Snap.Hutao.Web.Response;
|
||||||
|
using System.Net.Http;
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Web.Hoyolab.Takumi.Event.BbsSignReward;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到客户端
|
||||||
|
/// </summary>
|
||||||
|
[ConstructorGenerated]
|
||||||
|
[HttpClient(HttpClientConfiguration.XRpc)]
|
||||||
|
internal sealed partial class SignInClient
|
||||||
|
{
|
||||||
|
private readonly HttpClient httpClient;
|
||||||
|
private readonly JsonSerializerOptions options;
|
||||||
|
private readonly ILogger<SignInClient> logger;
|
||||||
|
|
||||||
|
public async ValueTask<Response<SignInRewardInfo>> GetInfoAsync(UserAndUid userAndUid, CancellationToken token = default)
|
||||||
|
{
|
||||||
|
Response<SignInRewardInfo>? resp = await httpClient
|
||||||
|
.SetUser(userAndUid.User, CookieType.CookieToken)
|
||||||
|
.UseDynamicSecret(DynamicSecretVersion.Gen2, SaltType.LK2, true)
|
||||||
|
.TryCatchGetFromJsonAsync<Response<SignInRewardInfo>>(ApiEndpoints.SignInRewardInfo(userAndUid.Uid), options, logger, token)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
return Response.Response.DefaultIfNull(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask<Response<SignInRewardReSignInfo>> GetResignInfoAsync(UserAndUid userAndUid, CancellationToken token = default)
|
||||||
|
{
|
||||||
|
Response<SignInRewardReSignInfo>? resp = await httpClient
|
||||||
|
.SetUser(userAndUid.User, CookieType.CookieToken)
|
||||||
|
.UseDynamicSecret(DynamicSecretVersion.Gen2, SaltType.LK2, true)
|
||||||
|
.TryCatchGetFromJsonAsync<Response<SignInRewardReSignInfo>>(ApiEndpoints.SignInRewardResignInfo(userAndUid.Uid), options, logger, token)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
return Response.Response.DefaultIfNull(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask<Response<Reward>> GetRewardAsync(User user, CancellationToken token = default)
|
||||||
|
{
|
||||||
|
Response<Reward>? resp = await httpClient
|
||||||
|
.SetUser(user.Entity, CookieType.CookieToken)
|
||||||
|
.TryCatchGetFromJsonAsync<Response<Reward>>(ApiEndpoints.SignInRewardHome, options, logger, token)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
return Response.Response.DefaultIfNull(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask<Response<SignInResult>> ReSignAsync(UserAndUid userAndUid, CancellationToken token = default)
|
||||||
|
{
|
||||||
|
SignInData data = new(userAndUid.Uid);
|
||||||
|
|
||||||
|
Response<SignInResult>? resp = await httpClient
|
||||||
|
.SetUser(userAndUid.User, CookieType.CookieToken)
|
||||||
|
.UseDynamicSecret(DynamicSecretVersion.Gen2, SaltType.LK2, true)
|
||||||
|
.TryCatchPostAsJsonAsync<SignInData, Response<SignInResult>>(ApiEndpoints.SignInRewardReSign, data, options, logger, token)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
return Response.Response.DefaultIfNull(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask<Response<SignInResult>> SignAsync(UserAndUid userAndUid, CancellationToken token = default)
|
||||||
|
{
|
||||||
|
Response<SignInResult>? resp = await httpClient
|
||||||
|
.SetUser(userAndUid.User, CookieType.CookieToken)
|
||||||
|
.UseDynamicSecret(DynamicSecretVersion.Gen2, SaltType.LK2, true)
|
||||||
|
.TryCatchPostAsJsonAsync<SignInData, Response<SignInResult>>(ApiEndpoints.SignInRewardSign, new SignInData(userAndUid.Uid), options, logger, token)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
return Response.Response.DefaultIfNull(resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Web.Hoyolab.Takumi.Event.BbsSignReward;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到提交数据
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class SignInData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 构造一个新的签到提交数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uid">uid</param>
|
||||||
|
public SignInData(in PlayerUid uid)
|
||||||
|
{
|
||||||
|
Region = uid.Region;
|
||||||
|
Uid = uid.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 活动Id
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("act_id")]
|
||||||
|
public string ActivityId { get; } = ApiEndpoints.SignInRewardActivityId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地区代码
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("region")]
|
||||||
|
public string Region { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Uid
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("uid")]
|
||||||
|
public string Uid { get; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Web.Hoyolab.Takumi.Event.BbsSignReward;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到结果
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class SignInResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通常是 ""
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("code")]
|
||||||
|
public string Code { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通常是 ""
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("risk_code")]
|
||||||
|
public int RiskCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通常是 ""
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("gt")]
|
||||||
|
public string Gt { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通常是 ""
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("challenge")]
|
||||||
|
public string Challenge { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通常是 ""
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("success")]
|
||||||
|
public int Success { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Web.Hoyolab.Takumi.Event.BbsSignReward;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到信息
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class SignInRewardInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 累积签到天数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("total_sign_day")]
|
||||||
|
public int TotalSignDay { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// yyyy-MM-dd
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("today")]
|
||||||
|
public string? Today { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 今日是否已签到
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("is_sign")]
|
||||||
|
public bool IsSign { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ?
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("is_sub")]
|
||||||
|
public bool IsSub { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否首次绑定
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("first_bind")]
|
||||||
|
public bool FirstBind { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否为当月第一次
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("month_first")]
|
||||||
|
public bool MonthFirst { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 漏签天数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("sign_cnt_missed")]
|
||||||
|
public bool SignCountMissed { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Web.Hoyolab.Takumi.Event.BbsSignReward;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 补签说明
|
||||||
|
/// </summary>
|
||||||
|
public class SignInRewardReSignInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 当日补签次数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("resign_cnt_daily")]
|
||||||
|
public bool ResignCountDaily { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当月补签次数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("resign_cnt_monthly")]
|
||||||
|
public bool ResignCountMonthly { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当日补签次数限制
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("resign_limit_daily")]
|
||||||
|
public bool ResignLimitDaily { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当月补签次数限制
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("resign_limit_monthly")]
|
||||||
|
public bool ResignLimitMonthly { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 漏签次数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("sign_cnt_missed")]
|
||||||
|
public bool SignCountMissed { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 米游币个数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("coin_cnt")]
|
||||||
|
public bool CoinCount { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 补签需要的米游币个数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("coin_cost")]
|
||||||
|
public bool CoinCost { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 规则
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("rule")]
|
||||||
|
public string Rule { get; set; } = default!;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user