feat: 套餐增加推荐标识与标签
This commit is contained in:
@@ -84,6 +84,16 @@ public sealed record CreateTenantPackageCommand : IRequest<TenantPackageDto>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TenantPackagePublishStatus? PublishStatus { get; init; }
|
public TenantPackagePublishStatus? PublishStatus { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否推荐展示(运营推荐标识)。
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRecommended { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 套餐标签(用于展示与对比页)。
|
||||||
|
/// </summary>
|
||||||
|
public string[] Tags { get; init; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 展示排序,数值越小越靠前。
|
/// 展示排序,数值越小越靠前。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -89,6 +89,16 @@ public sealed record UpdateTenantPackageCommand : IRequest<TenantPackageDto?>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TenantPackagePublishStatus? PublishStatus { get; init; }
|
public TenantPackagePublishStatus? PublishStatus { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否推荐展示(运营推荐标识)。
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRecommended { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 套餐标签(用于展示与对比页)。
|
||||||
|
/// </summary>
|
||||||
|
public string[] Tags { get; init; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 展示排序,数值越小越靠前。
|
/// 展示排序,数值越小越靠前。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -90,6 +90,16 @@ public sealed class TenantPackageDto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TenantPackagePublishStatus PublishStatus { get; init; }
|
public TenantPackagePublishStatus PublishStatus { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否推荐展示(运营推荐标识)。
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRecommended { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 套餐标签(用于展示与对比页)。
|
||||||
|
/// </summary>
|
||||||
|
public string[] Tags { get; init; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 展示排序,数值越小越靠前。
|
/// 展示排序,数值越小越靠前。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ public sealed class CreateTenantPackageCommandHandler(ITenantPackageRepository p
|
|||||||
IsPublicVisible = request.IsPublicVisible,
|
IsPublicVisible = request.IsPublicVisible,
|
||||||
IsAllowNewTenantPurchase = request.IsAllowNewTenantPurchase,
|
IsAllowNewTenantPurchase = request.IsAllowNewTenantPurchase,
|
||||||
PublishStatus = request.PublishStatus ?? TenantPackagePublishStatus.Draft,
|
PublishStatus = request.PublishStatus ?? TenantPackagePublishStatus.Draft,
|
||||||
|
IsRecommended = request.IsRecommended,
|
||||||
|
Tags = request.Tags ?? [],
|
||||||
SortOrder = request.SortOrder
|
SortOrder = request.SortOrder
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -50,9 +50,13 @@ public sealed class UpdateTenantPackageCommandHandler(ITenantPackageRepository p
|
|||||||
{
|
{
|
||||||
package.PublishStatus = request.PublishStatus.Value;
|
package.PublishStatus = request.PublishStatus.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 4. (空行后) 更新展示配置(推荐与标签)
|
||||||
|
package.IsRecommended = request.IsRecommended;
|
||||||
|
package.Tags = request.Tags ?? [];
|
||||||
package.SortOrder = request.SortOrder;
|
package.SortOrder = request.SortOrder;
|
||||||
|
|
||||||
// 4. 持久化并返回
|
// 5. (空行后) 持久化并返回
|
||||||
await packageRepository.UpdateAsync(package, cancellationToken);
|
await packageRepository.UpdateAsync(package, cancellationToken);
|
||||||
await packageRepository.SaveChangesAsync(cancellationToken);
|
await packageRepository.SaveChangesAsync(cancellationToken);
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,8 @@ internal static class TenantMapping
|
|||||||
IsPublicVisible = package.IsPublicVisible,
|
IsPublicVisible = package.IsPublicVisible,
|
||||||
IsAllowNewTenantPurchase = package.IsAllowNewTenantPurchase,
|
IsAllowNewTenantPurchase = package.IsAllowNewTenantPurchase,
|
||||||
PublishStatus = package.PublishStatus,
|
PublishStatus = package.PublishStatus,
|
||||||
|
IsRecommended = package.IsRecommended,
|
||||||
|
Tags = package.Tags ?? [],
|
||||||
SortOrder = package.SortOrder
|
SortOrder = package.SortOrder
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,16 @@ public sealed class TenantPackage : AuditableEntityBase
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TenantPackagePublishStatus PublishStatus { get; set; } = TenantPackagePublishStatus.Draft;
|
public TenantPackagePublishStatus PublishStatus { get; set; } = TenantPackagePublishStatus.Draft;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否推荐展示(运营推荐标识)。
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRecommended { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 套餐标签(用于展示与对比页,如:推荐/性价比/旗舰)。
|
||||||
|
/// </summary>
|
||||||
|
public string[] Tags { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 展示排序,数值越小越靠前。
|
/// 展示排序,数值越小越靠前。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -694,6 +694,14 @@ public sealed class TakeoutAppDbContext(
|
|||||||
.HasDefaultValue(true)
|
.HasDefaultValue(true)
|
||||||
.HasSentinel(true)
|
.HasSentinel(true)
|
||||||
.HasComment("是否允许新租户购买/选择(仅影响新购)。");
|
.HasComment("是否允许新租户购买/选择(仅影响新购)。");
|
||||||
|
|
||||||
|
// 4. (空行后) 展示配置:推荐标识与标签(用于套餐展示页/对比页)
|
||||||
|
builder.Property(x => x.IsRecommended)
|
||||||
|
.HasDefaultValue(false)
|
||||||
|
.HasComment("是否推荐展示(运营推荐标识)。");
|
||||||
|
builder.Property(x => x.Tags)
|
||||||
|
.HasColumnType("text[]")
|
||||||
|
.HasComment("套餐标签(用于展示与对比页)。");
|
||||||
builder.Property(x => x.SortOrder).HasDefaultValue(0).HasComment("展示排序,数值越小越靠前。");
|
builder.Property(x => x.SortOrder).HasDefaultValue(0).HasComment("展示排序,数值越小越靠前。");
|
||||||
builder.HasIndex(x => new { x.IsActive, x.SortOrder });
|
builder.HasIndex(x => new { x.IsActive, x.SortOrder });
|
||||||
builder.HasIndex(x => new { x.PublishStatus, x.IsActive, x.IsPublicVisible, x.IsAllowNewTenantPurchase, x.SortOrder });
|
builder.HasIndex(x => new { x.PublishStatus, x.IsActive, x.IsPublicVisible, x.IsAllowNewTenantPurchase, x.SortOrder });
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace TakeoutSaaS.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddTenantPackageRecommendationAndTags : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "IsRecommended",
|
||||||
|
table: "tenant_packages",
|
||||||
|
type: "boolean",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false,
|
||||||
|
comment: "是否推荐展示(运营推荐标识)。");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string[]>(
|
||||||
|
name: "Tags",
|
||||||
|
table: "tenant_packages",
|
||||||
|
type: "text[]",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new string[0],
|
||||||
|
comment: "套餐标签(用于展示与对比页)。");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IsRecommended",
|
||||||
|
table: "tenant_packages");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Tags",
|
||||||
|
table: "tenant_packages");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6261,6 +6261,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
|||||||
.HasDefaultValue(true)
|
.HasDefaultValue(true)
|
||||||
.HasComment("是否对外可见(展示页/套餐列表可见性)。");
|
.HasComment("是否对外可见(展示页/套餐列表可见性)。");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRecommended")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("boolean")
|
||||||
|
.HasDefaultValue(false)
|
||||||
|
.HasComment("是否推荐展示(运营推荐标识)。");
|
||||||
|
|
||||||
b.Property<int?>("MaxAccountCount")
|
b.Property<int?>("MaxAccountCount")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasComment("允许创建的最大账号数。");
|
.HasComment("允许创建的最大账号数。");
|
||||||
@@ -6307,6 +6313,11 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
|||||||
.HasDefaultValue(0)
|
.HasDefaultValue(0)
|
||||||
.HasComment("展示排序,数值越小越靠前。");
|
.HasComment("展示排序,数值越小越靠前。");
|
||||||
|
|
||||||
|
b.PrimitiveCollection<string[]>("Tags")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text[]")
|
||||||
|
.HasComment("套餐标签(用于展示与对比页)。");
|
||||||
|
|
||||||
b.Property<DateTime?>("UpdatedAt")
|
b.Property<DateTime?>("UpdatedAt")
|
||||||
.HasColumnType("timestamp with time zone")
|
.HasColumnType("timestamp with time zone")
|
||||||
.HasComment("最近一次更新时间(UTC),从未更新时为 null。");
|
.HasComment("最近一次更新时间(UTC),从未更新时为 null。");
|
||||||
|
|||||||
Reference in New Issue
Block a user