提交实体类

This commit is contained in:
zpc 2024-10-10 01:13:46 +08:00
parent 3b0d56a0ce
commit 37b3e2049e
16 changed files with 1145 additions and 9 deletions

View File

@ -17,4 +17,8 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\1-utile\HuanMeng.DotNetCore\HuanMeng.DotNetCore.csproj" />
</ItemGroup>
</Project>

View File

@ -46,13 +46,16 @@ namespace <#= NamespaceHint #>;
<#
}
#>
public partial class <#= Options.ContextName #> : DbContext
/// <summary>
/// 云游戏实体类
/// </summary>
public partial class <#= Options.ContextName #> : MultiTenantDbContext//DbContext
{
<#
if (!Options.SuppressOnConfiguring)
{
#>
public <#= Options.ContextName #>()
public <#= Options.ContextName #>() : base(null)
{
}
@ -60,14 +63,37 @@ public partial class <#= Options.ContextName #> : DbContext
}
#>
public <#= Options.ContextName #>(DbContextOptions<<#= Options.ContextName #>> options)
: base(options)
: base(null, options)
{
}
/// <summary>
///
/// </summary>
/// <param name="tenantInfo"></param>
public <#= Options.ContextName #>(ITenantInfo tenantInfo) : base(tenantInfo)
{
}
/// <summary>
///
/// </summary>
/// <param name="tenantInfo"></param>
/// <param name="options"></param>
public <#= Options.ContextName #>(ITenantInfo tenantInfo, DbContextOptions<<#= Options.ContextName #>> options) : base(tenantInfo, options)
{
}
<#
foreach (var entityType in Model.GetEntityTypes().Where(e => !e.IsSimpleManyToManyJoinEntityType()))
{
#>
/// <summary>
/// <#=entityType.GetComment()??"" #>
/// </summary>
public virtual DbSet<<#= entityType.Name #>> <#= entityType.GetDbSetName() #> { get; set; }
<#
@ -81,7 +107,6 @@ public partial class <#= Options.ContextName #> : DbContext
if (!Options.SuppressConnectionStringWarning)
{
#>
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
<#
}
@ -296,7 +321,8 @@ public partial class <#= Options.ContextName #> : DbContext
usings.AddRange(propertyFluentApiCalls.GetRequiredUsings());
#>
j.IndexerProperty<<#= code.Reference(property.ClrType) #>>(<#= code.Literal(property.Name) #>)<#= code.Fragment(propertyFluentApiCalls, indent: 7) #>;
j.IndexerProperty<<#= code.Reference(property.ClrType) #>>(<#= code.Literal(property.Name) #>)<#= code.Fragment(propertyFluentApiCalls, indent: 7) #>;
<#
}
#>
@ -304,7 +330,13 @@ public partial class <#= Options.ContextName #> : DbContext
<#
anyEntityTypeConfiguration = true;
}
#>
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
<#
// If any signicant code was generated, append it to the main environment

View File

@ -26,8 +26,8 @@
var usings = new List<string>
{
"System",
"System.Collections.Generic"
// "System",
//"System.Collections.Generic",
};
if (Options.UseDataAnnotations)
@ -64,8 +64,10 @@ namespace <#= NamespaceHint #>;
}
}
#>
public partial class <#= EntityType.Name #>
public partial class <#= EntityType.Name #>: MultiTenantEntity
{
public <#= EntityType.Name #>() { }
<#
var firstProperty = true;
foreach (var property in EntityType.GetProperties().OrderBy(p => p.GetColumnOrder() ?? -1))
@ -75,6 +77,15 @@ public partial class <#= EntityType.Name #>
WriteLine("");
}
if(property.Name=="TenantId"){
#>
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
<#
continue;
}
if (!string.IsNullOrEmpty(property.GetComment()))
{
#>
@ -100,8 +111,9 @@ public partial class <#= EntityType.Name #>
var needsNullable = Options.UseNullableReferenceTypes && property.IsNullable && !property.ClrType.IsValueType;
var needsInitializer = Options.UseNullableReferenceTypes && !property.IsNullable && !property.ClrType.IsValueType;
#>
public <#= code.Reference(property.ClrType) #><#= needsNullable ? "?" : "" #> <#= property.Name #> { get; set; }<#= needsInitializer ? " = null!;" : "" #>
public virtual <#= code.Reference(property.ClrType) #><#= needsNullable ? "?" : "" #> <#= property.Name #> { get; set; }<#= needsInitializer ? " = null!;" : "" #>
<#
firstProperty = false;
}

View File

@ -0,0 +1,474 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 云游戏实体类
/// </summary>
public partial class CloudGamingUserContext : MultiTenantDbContext//DbContext
{
public CloudGamingUserContext() : base(null)
{
}
public CloudGamingUserContext(DbContextOptions<CloudGamingUserContext> options)
: base(null, options)
{
}
/// <summary>
///
/// </summary>
/// <param name="tenantInfo"></param>
public CloudGamingUserContext(ITenantInfo tenantInfo) : base(tenantInfo)
{
}
/// <summary>
///
/// </summary>
/// <param name="tenantInfo"></param>
/// <param name="options"></param>
public CloudGamingUserContext(ITenantInfo tenantInfo, DbContextOptions<CloudGamingUserContext> options) : base(tenantInfo, options)
{
}
/// <summary>
/// 用户表
/// </summary>
public virtual DbSet<T_User> T_User { get; set; }
/// <summary>
/// 用户货币表
/// </summary>
public virtual DbSet<T_User_Currency> T_User_Currency { get; set; }
/// <summary>
/// 用户金额记录表
/// </summary>
public virtual DbSet<T_User_Currency_Log> T_User_Currency_Log { get; set; }
/// <summary>
/// 用户扩展表
/// </summary>
public virtual DbSet<T_User_Data> T_User_Data { get; set; }
/// <summary>
/// 意向订单表
/// </summary>
public virtual DbSet<T_User_IntentOrder> T_User_IntentOrder { get; set; }
/// <summary>
/// 小程序登录表
/// </summary>
public virtual DbSet<T_User_MiniProgram_Account> T_User_MiniProgram_Account { get; set; }
/// <summary>
/// 订单完成表
/// </summary>
public virtual DbSet<T_User_Order> T_User_Order { get; set; }
/// <summary>
/// 订单详情表
/// </summary>
public virtual DbSet<T_User_OrderItems> T_User_OrderItems { get; set; }
/// <summary>
/// 手机号登录表
/// </summary>
public virtual DbSet<T_User_Phone_Account> T_User_Phone_Account { get; set; }
/// <summary>
/// 用户单点登录表
/// </summary>
public virtual DbSet<T_User_Token> T_User_Token { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseSqlServer("Server=192.168.1.17;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<T_User>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__T_User__3214EC073733108B");
entity.ToTable(tb => tb.HasComment("用户表"));
entity.Property(e => e.Id).HasComment("用户Id");
entity.Property(e => e.CreatedAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.IDCard)
.HasMaxLength(64)
.HasComment("身份证号");
entity.Property(e => e.Ip)
.HasMaxLength(100)
.HasComment("Ip地址")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.IsTest).HasComment("是否是测试账号");
entity.Property(e => e.LastLoginAt)
.HasComment("最后一次登录时间")
.HasColumnType("datetime");
entity.Property(e => e.LastLoginType).HasComment("最后一次登录方式,1手机号2默认登录");
entity.Property(e => e.NickName)
.HasMaxLength(100)
.HasComment("用户昵称")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.RegisterType).HasComment("首次注册方式");
entity.Property(e => e.State).HasComment("0正常1注销");
entity.Property(e => e.TenantId).HasComment("租户Id");
entity.Property(e => e.UpdatedAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.UserIconUrl)
.HasMaxLength(300)
.HasComment("用户头像")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.UserName)
.HasMaxLength(100)
.HasComment("姓名")
.UseCollation("Chinese_PRC_CI_AS");
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
modelBuilder.Entity<T_User_Currency>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__T_User_C__3214EC0728E86D78");
entity.ToTable(tb => tb.HasComment("用户货币表"));
entity.Property(e => e.CreateAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.CurrencyMoney)
.HasComment("货币余额")
.HasColumnType("decimal(10, 2)");
entity.Property(e => e.CurrencyName)
.HasMaxLength(20)
.HasComment("货币名称")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.CurrencyType).HasComment("货币类型 付费币、免费币");
entity.Property(e => e.TenantId).HasComment("租户Id");
entity.Property(e => e.UpdateAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.UserId).HasComment("用户Id");
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
modelBuilder.Entity<T_User_Currency_Log>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__T_User_C__3214EC07DBD26048");
entity.ToTable(tb => tb.HasComment("用户金额记录表"));
entity.Property(e => e.Consume)
.HasComment("金额")
.HasColumnType("decimal(10, 2)");
entity.Property(e => e.ConsumeType).HasComment("消耗类型,0消耗1增加");
entity.Property(e => e.CreateAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.CurrencyType).HasComment("金额类型");
entity.Property(e => e.ExpiresAt)
.HasComment("消耗的结束时间")
.HasColumnType("datetime");
entity.Property(e => e.GameId)
.HasMaxLength(200)
.HasComment("消耗的游戏Id");
entity.Property(e => e.IsShow).HasComment("是否显示给用户");
entity.Property(e => e.OrderId)
.HasMaxLength(64)
.HasComment("订单号")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.Remarks)
.HasMaxLength(200)
.HasComment("备注")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.TenantId).HasComment("租户");
entity.Property(e => e.Title)
.HasMaxLength(200)
.HasComment("标题")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.UpdateAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.UserId).HasComment("用户");
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
modelBuilder.Entity<T_User_Data>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__T_UsersD__3214EC0738D57E8A");
entity.ToTable(tb => tb.HasComment("用户扩展表"));
entity.HasIndex(e => new { e.TenantId, e.UserId }, "UserData_index");
entity.Property(e => e.Id).HasComment("主键");
entity.Property(e => e.CreateAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.Email)
.HasMaxLength(255)
.HasComment("邮箱");
entity.Property(e => e.PhoneNum)
.HasMaxLength(20)
.HasComment("手机号");
entity.Property(e => e.TenantId).HasComment("多租户");
entity.Property(e => e.UpdateAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.UserId).HasComment("用户Id");
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
modelBuilder.Entity<T_User_IntentOrder>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__T_User_I__3214EC07D27A8CE9");
entity.ToTable(tb => tb.HasComment("意向订单表"));
entity.Property(e => e.Id).HasComment("主键");
entity.Property(e => e.CreatedAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.IntentAt)
.HasComment("订单创建时间")
.HasColumnType("datetime");
entity.Property(e => e.Method)
.HasMaxLength(10)
.HasComment("支付方式")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.Notes)
.HasMaxLength(200)
.HasComment("备注")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.OrderId)
.HasMaxLength(64)
.HasComment("订单Id")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.Price)
.HasComment("价格")
.HasColumnType("money");
entity.Property(e => e.ProductId)
.HasMaxLength(50)
.HasComment("产品id")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.Quantity).HasComment("数量");
entity.Property(e => e.Status).HasComment("状态");
entity.Property(e => e.TenantId).HasComment("租户");
entity.Property(e => e.UpdatedAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.UserId).HasComment("用户Id");
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
modelBuilder.Entity<T_User_MiniProgram_Account>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__T_User_M__3214EC073889A8B9");
entity.ToTable(tb => tb.HasComment("小程序登录表"));
entity.Property(e => e.Id).HasComment("主键");
entity.Property(e => e.CreateAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.OpenId)
.HasMaxLength(200)
.HasComment("用户唯一标识")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.SessionKey)
.HasMaxLength(200)
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.TenantId).HasComment("租户");
entity.Property(e => e.Unionid)
.HasMaxLength(200)
.HasComment("用户在开放平台的唯一标识符,若当前小程序已绑定到微信开放平台账号下会返回,详见")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.UpdateAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.UserId).HasComment("用户Id");
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
modelBuilder.Entity<T_User_Order>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__T_Order__3214EC07C8DD7EE1");
entity.ToTable(tb => tb.HasComment("订单完成表"));
entity.Property(e => e.CreatedAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.OrderDate)
.HasComment("订单创建时间")
.HasColumnType("datetime");
entity.Property(e => e.OrderId)
.HasMaxLength(64)
.HasComment("订单编号")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.PaymentDate)
.HasComment("订单支付时间")
.HasColumnType("datetime");
entity.Property(e => e.PaymentDay).HasComment("订单创建天");
entity.Property(e => e.PaymentMethod)
.HasMaxLength(10)
.HasComment("订单支付方式")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.ProductId)
.HasMaxLength(100)
.HasComment("购买的产品Id")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.Status).HasComment("订单状态");
entity.Property(e => e.TenantId).HasComment("租户");
entity.Property(e => e.TotalPrice)
.HasComment("价格")
.HasColumnType("money");
entity.Property(e => e.UpdatedAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.UserId).HasComment("用户Id");
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
modelBuilder.Entity<T_User_OrderItems>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__T_OrderI__3214EC077E53EC22");
entity.ToTable(tb => tb.HasComment("订单详情表"));
entity.Property(e => e.OrderId)
.HasMaxLength(64)
.HasComment("订单id")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.PayUrl)
.HasComment("支付地址")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.PaymentInfo)
.HasComment("支付信息")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.Product).HasComment("产品id、主键");
entity.Property(e => e.ProductId)
.HasMaxLength(100)
.HasComment("产品id")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.RewardInfo)
.HasComment("发放奖励信息")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.RewardTips)
.HasComment("发放奖励提示")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.TenantId).HasComment("租户");
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
modelBuilder.Entity<T_User_Phone_Account>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__T_User_P__3214EC07987BDDB2");
entity.ToTable(tb => tb.HasComment("手机号登录表"));
entity.Property(e => e.Id).HasComment("主键");
entity.Property(e => e.CreatedAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.IsLogout).HasComment("是否注销");
entity.Property(e => e.LastLoginAt)
.HasComment("最后一次登录时间")
.HasColumnType("datetime");
entity.Property(e => e.NikeName)
.HasMaxLength(100)
.HasComment("用户昵称")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.PhoneNum)
.HasMaxLength(50)
.IsUnicode(false)
.HasComment("手机号")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.TenantId).HasComment("租户Id");
entity.Property(e => e.UpdatedAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.UserId).HasComment("用户Id");
entity.Property(e => e.VerificationCode)
.HasMaxLength(10)
.IsUnicode(false)
.HasComment("验证码")
.UseCollation("Chinese_PRC_CI_AS");
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
modelBuilder.Entity<T_User_Token>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__T_User_T__3214EC072DF12976");
entity.ToTable(tb => tb.HasComment("用户单点登录表"));
entity.Property(e => e.CreateAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.ExpiresAt)
.HasComment("过期时间")
.HasColumnType("datetime");
entity.Property(e => e.TenantId).HasComment("租户");
entity.Property(e => e.Token).HasComment("登录token");
entity.Property(e => e.UpdateAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.UserId).HasComment("用户Id");
//添加全局筛选器
if (this.TenantInfo != null)
{
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
}
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

View File

@ -0,0 +1,81 @@
using System;
namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 用户表
/// </summary>
public partial class T_User: MultiTenantEntity
{
public T_User() { }
/// <summary>
/// 用户Id
/// </summary>
public virtual int Id { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
/// <summary>
/// 用户昵称
/// </summary>
public virtual string NickName { get; set; } = null!;
/// <summary>
/// 身份证号
/// </summary>
public virtual string? IDCard { get; set; }
/// <summary>
/// 姓名
/// </summary>
public virtual string? UserName { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime CreatedAt { get; set; }
/// <summary>
/// 首次注册方式
/// </summary>
public virtual int RegisterType { get; set; }
/// <summary>
/// 最后一次登录方式,1手机号2默认登录
/// </summary>
public virtual int LastLoginType { get; set; }
/// <summary>
/// 最后一次登录时间
/// </summary>
public virtual DateTime LastLoginAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public virtual DateTime UpdatedAt { get; set; }
/// <summary>
/// Ip地址
/// </summary>
public virtual string? Ip { get; set; }
/// <summary>
/// 0正常1注销
/// </summary>
public virtual int State { get; set; }
/// <summary>
/// 用户头像
/// </summary>
public virtual string? UserIconUrl { get; set; }
/// <summary>
/// 是否是测试账号
/// </summary>
public virtual bool? IsTest { get; set; }
}

View File

@ -0,0 +1,48 @@
using System;
namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 用户货币表
/// </summary>
public partial class T_User_Currency: MultiTenantEntity
{
public T_User_Currency() { }
public virtual int Id { get; set; }
/// <summary>
/// 货币类型 付费币、免费币
/// </summary>
public virtual int CurrencyType { get; set; }
/// <summary>
/// 货币名称
/// </summary>
public virtual string CurrencyName { get; set; } = null!;
/// <summary>
/// 货币余额
/// </summary>
public virtual decimal CurrencyMoney { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public virtual DateTime UpdateAt { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime CreateAt { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public virtual int UserId { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -0,0 +1,78 @@
using System;
namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 用户金额记录表
/// </summary>
public partial class T_User_Currency_Log: MultiTenantEntity
{
public T_User_Currency_Log() { }
public virtual int Id { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
/// <summary>
/// 用户
/// </summary>
public virtual int UserId { get; set; }
/// <summary>
/// 标题
/// </summary>
public virtual string? Title { get; set; }
/// <summary>
/// 金额类型
/// </summary>
public virtual int CurrencyType { get; set; }
/// <summary>
/// 金额
/// </summary>
public virtual decimal Consume { get; set; }
/// <summary>
/// 消耗类型,0消耗1增加
/// </summary>
public virtual int ConsumeType { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Remarks { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime CreateAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public virtual DateTime UpdateAt { get; set; }
/// <summary>
/// 订单号
/// </summary>
public virtual string? OrderId { get; set; }
/// <summary>
/// 是否显示给用户
/// </summary>
public virtual bool IsShow { get; set; }
/// <summary>
/// 消耗的结束时间
/// </summary>
public virtual DateTime? ExpiresAt { get; set; }
/// <summary>
/// 消耗的游戏Id
/// </summary>
public virtual string? GameId { get; set; }
}

View File

@ -0,0 +1,46 @@
using System;
namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 用户扩展表
/// </summary>
public partial class T_User_Data: MultiTenantEntity
{
public T_User_Data() { }
/// <summary>
/// 主键
/// </summary>
public virtual int Id { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public virtual int UserId { get; set; }
/// <summary>
/// 手机号
/// </summary>
public virtual string? PhoneNum { get; set; }
/// <summary>
/// 邮箱
/// </summary>
public virtual string? Email { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime CreateAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public virtual DateTime UpdateAt { get; set; }
}

View File

@ -0,0 +1,76 @@
using System;
namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 意向订单表
/// </summary>
public partial class T_User_IntentOrder: MultiTenantEntity
{
public T_User_IntentOrder() { }
/// <summary>
/// 主键
/// </summary>
public virtual int Id { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public virtual int UserId { get; set; }
/// <summary>
/// 产品id
/// </summary>
public virtual string ProductId { get; set; } = null!;
/// <summary>
/// 支付方式
/// </summary>
public virtual string Method { get; set; } = null!;
/// <summary>
/// 价格
/// </summary>
public virtual decimal Price { get; set; }
/// <summary>
/// 数量
/// </summary>
public virtual int Quantity { get; set; }
/// <summary>
/// 状态
/// </summary>
public virtual int Status { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Notes { get; set; }
/// <summary>
/// 订单创建时间
/// </summary>
public virtual DateTime IntentAt { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime CreatedAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public virtual DateTime UpdatedAt { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
/// <summary>
/// 订单Id
/// </summary>
public virtual string OrderId { get; set; } = null!;
}

View File

@ -0,0 +1,48 @@
using System;
namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 小程序登录表
/// </summary>
public partial class T_User_MiniProgram_Account: MultiTenantEntity
{
public T_User_MiniProgram_Account() { }
/// <summary>
/// 主键
/// </summary>
public virtual int Id { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public virtual int UserId { get; set; }
/// <summary>
/// 用户唯一标识
/// </summary>
public virtual string OpenId { get; set; } = null!;
/// <summary>
/// 用户在开放平台的唯一标识符,若当前小程序已绑定到微信开放平台账号下会返回,详见
/// </summary>
public virtual string? Unionid { get; set; }
public virtual string? SessionKey { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime CreateAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public virtual DateTime UpdateAt { get; set; }
}

View File

@ -0,0 +1,73 @@
using System;
namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 订单完成表
/// </summary>
public partial class T_User_Order: MultiTenantEntity
{
public T_User_Order() { }
public virtual int Id { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
/// <summary>
/// 订单编号
/// </summary>
public virtual string OrderId { get; set; } = null!;
/// <summary>
/// 用户Id
/// </summary>
public virtual int UserId { get; set; }
/// <summary>
/// 订单创建时间
/// </summary>
public virtual DateTime OrderDate { get; set; }
/// <summary>
/// 订单支付时间
/// </summary>
public virtual DateTime PaymentDate { get; set; }
/// <summary>
/// 订单支付方式
/// </summary>
public virtual string PaymentMethod { get; set; } = null!;
/// <summary>
/// 购买的产品Id
/// </summary>
public virtual string ProductId { get; set; } = null!;
/// <summary>
/// 价格
/// </summary>
public virtual decimal TotalPrice { get; set; }
/// <summary>
/// 订单状态
/// </summary>
public virtual int Status { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime CreatedAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public virtual DateTime UpdatedAt { get; set; }
/// <summary>
/// 订单创建天
/// </summary>
public virtual DateOnly PaymentDay { get; set; }
}

View File

@ -0,0 +1,52 @@

namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 订单详情表
/// </summary>
public partial class T_User_OrderItems: MultiTenantEntity
{
public T_User_OrderItems() { }
public virtual int Id { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
/// <summary>
/// 产品id
/// </summary>
public virtual string ProductId { get; set; } = null!;
/// <summary>
/// 订单id
/// </summary>
public virtual string OrderId { get; set; } = null!;
/// <summary>
/// 发放奖励信息
/// </summary>
public virtual string? RewardInfo { get; set; }
/// <summary>
/// 产品id、主键
/// </summary>
public virtual int Product { get; set; }
/// <summary>
/// 支付信息
/// </summary>
public virtual string? PaymentInfo { get; set; }
/// <summary>
/// 发放奖励提示
/// </summary>
public virtual string? RewardTips { get; set; }
/// <summary>
/// 支付地址
/// </summary>
public virtual string? PayUrl { get; set; }
}

View File

@ -0,0 +1,61 @@
using System;
namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 手机号登录表
/// </summary>
public partial class T_User_Phone_Account: MultiTenantEntity
{
public T_User_Phone_Account() { }
/// <summary>
/// 主键
/// </summary>
public virtual int Id { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public virtual int UserId { get; set; }
/// <summary>
/// 手机号
/// </summary>
public virtual string PhoneNum { get; set; } = null!;
/// <summary>
/// 验证码
/// </summary>
public virtual string VerificationCode { get; set; } = null!;
/// <summary>
/// 最后一次登录时间
/// </summary>
public virtual DateTime LastLoginAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public virtual DateTime CreatedAt { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime UpdatedAt { get; set; }
/// <summary>
/// 用户昵称
/// </summary>
public virtual string? NikeName { get; set; }
/// <summary>
/// 是否注销
/// </summary>
public virtual bool IsLogout { get; set; }
}

View File

@ -0,0 +1,43 @@
using System;
namespace CloudGaming.Model.DbSqlServer.Db_User;
/// <summary>
/// 用户单点登录表
/// </summary>
public partial class T_User_Token: MultiTenantEntity
{
public T_User_Token() { }
public virtual int Id { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public virtual int UserId { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
/// <summary>
/// 登录token
/// </summary>
public virtual string? Token { get; set; }
/// <summary>
/// 过期时间
/// </summary>
public virtual DateTime? ExpiresAt { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime? CreateAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public virtual DateTime? UpdateAt { get; set; }
}

View File

@ -0,0 +1,6 @@

##在API项目里面执行使用连接字符串名称生成代码到model项目
```sh
--user
dotnet ef dbcontext scaffold "Server=192.168.1.17;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer -o DbSqlServer/Db_User/ --use-database-names --no-pluralize --force
```

View File

@ -0,0 +1,2 @@
global using HuanMeng.DotNetCore.MultiTenant;
global using HuanMeng.DotNetCore.MultiTenant.Contract;