mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
signIn improvement
This commit is contained in:
@@ -2112,6 +2112,15 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 获取签到次数失败 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ServiceSignInInfoRequestFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("ServiceSignInInfoRequestFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 获取奖励列表失败 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -857,6 +857,9 @@
|
||||
<data name="ServiceSignInClaimRewardFailedFormat" xml:space="preserve">
|
||||
<value>签到失败,{0}</value>
|
||||
</data>
|
||||
<data name="ServiceSignInInfoRequestFailed" xml:space="preserve">
|
||||
<value>获取签到次数失败</value>
|
||||
</data>
|
||||
<data name="ServiceSignInRewardListRequestFailed" xml:space="preserve">
|
||||
<value>获取奖励列表失败</value>
|
||||
</data>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Snap.Hutao.Core.DependencyInjection.Abstraction;
|
||||
using Snap.Hutao.ViewModel.User;
|
||||
using Snap.Hutao.Web.Hoyolab.Takumi.Event.BbsSignReward;
|
||||
@@ -27,7 +26,7 @@ internal sealed partial class SignInService : ISignInService
|
||||
{
|
||||
Response<SignInResult> resultResponse = await signInClient.SignAsync(userAndUid, token).ConfigureAwait(false);
|
||||
|
||||
if (resultResponse.IsOk())
|
||||
if (resultResponse.IsOk(showInfoBar: false))
|
||||
{
|
||||
Response<SignInRewardInfo> infoResponse = await signInClient.GetInfoAsync(userAndUid, token).ConfigureAwait(false);
|
||||
if (infoResponse.IsOk())
|
||||
@@ -38,13 +37,18 @@ internal sealed partial class SignInService : ISignInService
|
||||
}
|
||||
else
|
||||
{
|
||||
return new(false, "获取签到次数失败");
|
||||
return new(false, SH.ServiceSignInInfoRequestFailed);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string message = resultResponse.Message;
|
||||
|
||||
if (resultResponse.ReturnCode == (int)KnownReturnCode.AlreadySignedIn)
|
||||
{
|
||||
return new(true, message);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(message))
|
||||
{
|
||||
message = $"RiskCode: {resultResponse.Data?.RiskCode}";
|
||||
|
||||
@@ -11,19 +11,9 @@ namespace Snap.Hutao.Web.Hoyolab.Takumi.Event.BbsSignReward;
|
||||
/// </summary>
|
||||
internal interface ISignInClient
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取
|
||||
/// </summary>
|
||||
/// <param name="user">用户信息</param>
|
||||
/// <param name="token">token</param>
|
||||
/// <returns>结果</returns>
|
||||
ValueTask<Response<SignInRewardInfo>> GetInfoAsync(UserAndUid userAndUid, CancellationToken token = default(CancellationToken));
|
||||
|
||||
ValueTask<Response<Reward>> GetRewardAsync(Model.Entity.User user, CancellationToken token = default);
|
||||
|
||||
/// <summary>
|
||||
/// 签到
|
||||
/// </summary>
|
||||
/// <param name="userAndUid">用户信息</param>
|
||||
/// <param name="token">token</param>
|
||||
/// <returns>签到结果</returns>
|
||||
ValueTask<Response<SignInResult>> SignAsync(UserAndUid userAndUid, CancellationToken token = default);
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,11 @@ internal sealed partial class SignInClientOversea : ISignInClient
|
||||
private readonly JsonSerializerOptions options;
|
||||
private readonly ILogger<SignInClient> logger;
|
||||
|
||||
public ValueTask<Response<SignInRewardInfo>> GetInfoAsync(UserAndUid userAndUid, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
return ValueTask.FromException<Response<SignInRewardInfo>>(new NotSupportedException());
|
||||
}
|
||||
|
||||
public async ValueTask<Response<Reward>> GetRewardAsync(Model.Entity.User user, CancellationToken token = default)
|
||||
{
|
||||
Response<Reward>? resp = await httpClient
|
||||
@@ -62,4 +67,4 @@ internal sealed partial class SignInClientOversea : ISignInClient
|
||||
|
||||
return Response.Response.DefaultIfNull(resp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,5 +48,5 @@ internal sealed class SignInRewardInfo
|
||||
/// 漏签天数
|
||||
/// </summary>
|
||||
[JsonPropertyName("sign_cnt_missed")]
|
||||
public bool SignCountMissed { get; set; }
|
||||
public int SignCountMissed { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user