feat: 套餐增加推荐标识与标签

This commit is contained in:
2025-12-15 22:32:02 +08:00
parent 2ed814fbe7
commit 9c28790f5e
11 changed files with 6893 additions and 1 deletions

View File

@@ -694,6 +694,14 @@ public sealed class TakeoutAppDbContext(
.HasDefaultValue(true)
.HasSentinel(true)
.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.HasIndex(x => new { x.IsActive, x.SortOrder });
builder.HasIndex(x => new { x.PublishStatus, x.IsActive, x.IsPublicVisible, x.IsAllowNewTenantPurchase, x.SortOrder });

View File

@@ -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");
}
}
}

View File

@@ -6261,6 +6261,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasDefaultValue(true)
.HasComment("是否对外可见(展示页/套餐列表可见性)。");
b.Property<bool>("IsRecommended")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasComment("是否推荐展示(运营推荐标识)。");
b.Property<int?>("MaxAccountCount")
.HasColumnType("integer")
.HasComment("允许创建的最大账号数。");
@@ -6307,6 +6313,11 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasDefaultValue(0)
.HasComment("展示排序,数值越小越靠前。");
b.PrimitiveCollection<string[]>("Tags")
.IsRequired()
.HasColumnType("text[]")
.HasComment("套餐标签(用于展示与对比页)。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");