mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
UIGF import denial on invalid itemid
This commit is contained in:
@@ -1347,6 +1347,15 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 数据包含异常物品, Id:{0} 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ServiceGachaLogUIGFImportItemInvalidFormat {
|
||||
get {
|
||||
return ResourceManager.GetString("ServiceGachaLogUIGFImportItemInvalidFormat", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 请求验证密钥失败 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -602,6 +602,9 @@
|
||||
<data name="ServiceGachaLogHutaoCloudServiceNotAllowed" xml:space="preserve">
|
||||
<value>祈愿记录上传服务不可用</value>
|
||||
</data>
|
||||
<data name="ServiceGachaLogUIGFImportItemInvalidFormat" xml:space="preserve">
|
||||
<value>数据包含异常物品, Id:{0}</value>
|
||||
</data>
|
||||
<data name="ServiceGachaLogUrlProviderAuthkeyRequestFailed" xml:space="preserve">
|
||||
<value>请求验证密钥失败</value>
|
||||
</data>
|
||||
|
||||
@@ -56,6 +56,14 @@ internal sealed partial class UIGFImportService : IUIGFImportService
|
||||
_ => new(),
|
||||
};
|
||||
|
||||
// 越早的记录手工导入的可能性越高
|
||||
// 错误率相对来说会更高
|
||||
// 因此从尾部开始查找
|
||||
if (toAdd.LastOrDefault(item => item.ItemId is 0U) is { } item)
|
||||
{
|
||||
ThrowHelper.InvalidOperation(SH.ServiceGachaLogUIGFImportItemInvalidFormat.Format(item.Id));
|
||||
}
|
||||
|
||||
await gachaLogDbService.AddGachaItemsAsync(toAdd).ConfigureAwait(false);
|
||||
return archive;
|
||||
}
|
||||
|
||||
@@ -351,6 +351,7 @@ internal sealed partial class GachaLogViewModel : Abstraction.ViewModel
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
// 导入物品中存在无效的项
|
||||
infoBarService.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user