修复一些bug

This commit is contained in:
chfei committed 2026-11-10 09:54:12 +08:00
1 parent 9bb17a67d2
commit f4913b4fc2
7 files changed
+38 -10

No files matched your search

@@ -124,12 +124,16 @@ internal static class IntegrationChecks
Check(!await db.Select<GoodsViolationLogEntity>().Where(x => x.GoodsId == first).AnyAsync(), "reporting alone creates no log");
await violations.RecordLogsAsync([
new() { ShopId = "shop-a", GoodsId = first, ReasonId = (int)existingReasonId, Action = ViolationLogAction.Report },
]);
await violations.RecordLogsAsync([
new() { ShopId = "shop-a", GoodsId = first, ReasonId = (int)existingReasonId, Action = ViolationLogAction.Report },
new() { ShopId = "shop-c", GoodsId = first, ReasonId = (int)ignoredReasonId, Action = ViolationLogAction.Report },
new() { ShopId = "shop-c", GoodsId = first, ReasonId = (int)ignoredReasonId, Action = ViolationLogAction.Report }
]);
var reportLogs = await violations.GetLogsAsync(["shop-a", "shop-c"], first, 0, 50);
Check(reportLogs.Count == 2 && reportLogs.All(x => x.Action == ViolationLogAction.Report)
&& reportLogs.Any(x => x.ShopId == "shop-a" && x.ReasonId == existingReasonId)
&& reportLogs.Any(x => x.ShopId == "shop-c" && x.ReasonId == ignoredReasonId), "keep report source and ignored reasons");
&& reportLogs.Any(x => x.ShopId == "shop-c" && x.ReasonId == ignoredReasonId), "skip existing and in-batch duplicate events while keeping new events and their sources");
foreach (var action in new[] { ViolationLogAction.AutoListingExcluded, ViolationLogAction.AutoOffShelf })
await violations.RecordLogsAsync([new() { ShopId = "shop-b", GoodsId = first, ReasonId = (int)existingReasonId, Action = action }]);
var latest = (await violations.GetLogsAsync(["shop-b"], first, 0, 1)).Single();