fix: 门店资质日期字段改为date

This commit is contained in:
2026-01-20 13:09:06 +08:00
parent de54b64efc
commit 3385674490
17 changed files with 14948 additions and 35 deletions

View File

@@ -625,6 +625,8 @@ public sealed class TakeoutAppDbContext(
builder.Property(x => x.QualificationType).HasConversion<int>();
builder.Property(x => x.FileUrl).HasMaxLength(500).IsRequired();
builder.Property(x => x.DocumentNumber).HasMaxLength(100);
builder.Property(x => x.IssuedAt).HasColumnType("date");
builder.Property(x => x.ExpiresAt).HasColumnType("date");
builder.Property(x => x.SortOrder).HasDefaultValue(100);
builder.HasIndex(x => new { x.TenantId, x.StoreId });
builder.HasIndex(x => x.ExpiresAt)

View File

@@ -105,11 +105,12 @@ public sealed class StoreSchedulerService(
public async Task<int> CheckQualificationExpiryAsync(DateTime now, CancellationToken cancellationToken)
{
// 1. 查询过期门店
var today = DateOnly.FromDateTime(now);
var expiredStoreIds = await context.StoreQualifications
.AsNoTracking()
.Where(qualification => qualification.DeletedAt == null
&& qualification.ExpiresAt.HasValue
&& qualification.ExpiresAt.Value < now)
&& qualification.ExpiresAt.Value < today)
.Select(qualification => qualification.StoreId)
.Distinct()
.ToListAsync(cancellationToken);