This commit is contained in:
tanglong 2025-06-27 16:03:09 +08:00
parent d7c64dc336
commit c13e3a8ca3
8 changed files with 7655 additions and 15 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace VOL.Core.Migrations
{
public partial class _20250624v1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "S_Device",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
Code = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "AI设备的唯一编码"),
Name = table.Column<string>(type: "nvarchar(200)", nullable: true, comment: "AI设备名称"),
DeviceType = table.Column<int>(type: "int", nullable: false, comment: "设备类型"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学校编号"),
StudentNo = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学生学号")
},
constraints: table =>
{
table.PrimaryKey("PK_S_Device", x => x.Id);
});
migrationBuilder.CreateTable(
name: "S_GatewayAssocSchool",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学校编号"),
Code = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "AI设备的唯一编码"),
Mac = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "设备的Mac地址")
},
constraints: table =>
{
table.PrimaryKey("PK_S_GatewayAssocSchool", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "S_Device");
migrationBuilder.DropTable(
name: "S_GatewayAssocSchool");
}
}
}

View File

@ -3812,6 +3812,66 @@ namespace VOL.Core.Migrations
b.ToTable("S_ClassAssocTeacher");
});
modelBuilder.Entity("VOL.Entity.DomainModels.S_Device", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasComment("Id");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("Code")
.HasColumnType("nvarchar(100)")
.HasComment("AI设备的唯一编码");
b.Property<int>("DeviceType")
.HasColumnType("int")
.HasComment("设备类型");
b.Property<string>("Name")
.HasColumnType("nvarchar(200)")
.HasComment("AI设备名称");
b.Property<string>("SchoolCode")
.HasColumnType("nvarchar(100)")
.HasComment("学校编号");
b.Property<string>("StudentNo")
.HasColumnType("nvarchar(100)")
.HasComment("学生学号");
b.HasKey("Id");
b.ToTable("S_Device");
});
modelBuilder.Entity("VOL.Entity.DomainModels.S_GatewayAssocSchool", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasComment("Id");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("Code")
.HasColumnType("nvarchar(100)")
.HasComment("AI设备的唯一编码");
b.Property<string>("Mac")
.HasColumnType("nvarchar(100)")
.HasComment("设备的Mac地址");
b.Property<string>("SchoolCode")
.HasColumnType("nvarchar(100)")
.HasComment("学校编号");
b.HasKey("Id");
b.ToTable("S_GatewayAssocSchool");
});
modelBuilder.Entity("VOL.Entity.DomainModels.S_Grade", b =>
{
b.Property<int>("Id")

View File

@ -20,12 +20,14 @@ namespace VOL.Core.Utilities
/// <returns></returns>
public static string IssueJwt(UserInfo userInfo)
{
string exp = $"{new DateTimeOffset(DateTime.Now.AddMinutes(ManageUser.UserContext.MenuType == 1? 43200: AppSetting.ExpMinutes)).ToUnixTimeSeconds()}";
string exp = $"{new DateTimeOffset(DateTime.Now.AddMinutes(ManageUser.UserContext.MenuType == 1 ? 43200 : AppSetting.ExpMinutes)).ToUnixTimeSeconds()}";
var claims = new List<Claim>
{
//new Claim(ClaimTypes.Name,userInfo.UserName ),
//new Claim(ClaimTypes.Role,userInfo.Role_Id ),
new Claim(JwtRegisteredClaimNames.Jti,userInfo.User_Id.ToString()),
new Claim(JwtRegisteredClaimNames.Sid,userInfo.TenantId.ToString()??""),
new Claim(JwtRegisteredClaimNames.Name,userInfo.UserName.ToString()??""),
new Claim(JwtRegisteredClaimNames.Iat, $"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}"),
new Claim(JwtRegisteredClaimNames.Nbf,$"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}") ,
//JWT过期时间

View File

@ -0,0 +1,64 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VOL.Entity.Enum;
using VOL.Entity.SystemModels;
namespace VOL.Entity.DomainModels
{
[Table("S_Device")]
[Entity(TableCnName = "设备表", TableName = "S_Device")]
public class S_Device : BaseEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Display(Description = "主键Id")]
[Comment("Id")]
public int Id { get; set; }
/// <summary>
/// AI设备的唯一编码
/// </summary>
[Display(Name = "AI设备的唯一编码")]
[Comment("AI设备的唯一编码")]
[Column(TypeName = "nvarchar(100)")]
public string Code { get; set; }
/// <summary>
/// AI设备名称
/// </summary>
[Display(Name = "AI设备名称")]
[Comment("AI设备名称")]
[Column(TypeName = "nvarchar(200)")]
public string Name { get; set; }
/// <summary>
///设备类型
/// </summary>
[Display(Name = "设备类型")]
[Comment("设备类型")]
[Column(TypeName = "int")]
public int DeviceType { get; set; }
/// <summary>
///学校编号
/// </summary>
[Display(Name = "学校编号")]
[Comment("学校编号")]
[Column(TypeName = "nvarchar(100)")]
public string SchoolCode { get; set; }
/// <summary>
///学生学号
/// </summary>
[Display(Name = "学生学号")]
[Comment("学生学号")]
[Column(TypeName = "nvarchar(100)")]
public string StudentNo { get; set; }
}
}

View File

@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VOL.Entity.Enum;
using VOL.Entity.SystemModels;
namespace VOL.Entity.DomainModels
{
[Table("S_GatewayAssocSchool")]
[Entity(TableCnName = "学校表", TableName = "S_School")]
public class S_GatewayAssocSchool : BaseEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Display(Description = "主键Id")]
[Comment("Id")]
public int Id { get; set; }
/// <summary>
///学校编号
/// </summary>
[Display(Name = "学校编号")]
[Comment("学校编号")]
[Column(TypeName = "nvarchar(100)")]
public string SchoolCode { get; set; }
/// <summary>
/// 设备的唯一编码
/// </summary>
[Display(Name = "AI设备的唯一编码")]
[Comment("AI设备的唯一编码")]
[Column(TypeName = "nvarchar(100)")]
public string Code { get; set; }
/// <summary>
/// 设备的Mac地址
/// </summary>
[Display(Name = "设备的Mac地址")]
[Comment("设备的Mac地址")]
[Column(TypeName = "nvarchar(100)")]
public string Mac { get; set; }
}
}

View File

@ -72,7 +72,8 @@ namespace VOL.System.Services
{
User_Id = user.User_Id,
UserName = user.UserName,
Role_Id = user.Role_Id
Role_Id = user.Role_Id,
TenantId = user.SchoolCode,
});
user.Token = token;
webResponse.Data = new
@ -569,7 +570,7 @@ namespace VOL.System.Services
Address = (s != null ? s.Province + "/" + s.City + "/" + s.Area : u.Address),
//Height = u.Height,
//Weight = u.Weight,
Role = "用户" + (t != null ? "/教师": ""),
Role = "用户" + (t != null ? "/教师" : ""),
CreateDate = u.CreateDate
};

View File

@ -318,18 +318,18 @@ namespace VOL.WebApi
//配置HttpContext
app.UseStaticHttpContext();
app.UseSwagger();
app.UseSwaggerUI(c =>
{
//2个下拉框选项 选择对应的文档
c.SwaggerEndpoint("/swagger/v1/swagger.json", "VOL.Core后台Api");
c.SwaggerEndpoint("/swagger/v2/swagger.json", "测试第三方Api");
c.SwaggerEndpoint("/swagger/v3/swagger.json", "SmartSportsServer-Api");
c.SwaggerEndpoint("/swagger/v4/swagger.json", "物联网-Api");
c.SwaggerEndpoint("/swagger/v5/swagger.json", "Ai-Api");
c.SwaggerEndpoint("/swagger/v6/swagger.json", "AiApp-Api");
c.RoutePrefix = "";
});
//app.UseSwagger();
//app.UseSwaggerUI(c =>
//{
// //2个下拉框选项 选择对应的文档
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "VOL.Core后台Api");
// c.SwaggerEndpoint("/swagger/v2/swagger.json", "测试第三方Api");
// c.SwaggerEndpoint("/swagger/v3/swagger.json", "SmartSportsServer-Api");
// c.SwaggerEndpoint("/swagger/v4/swagger.json", "物联网-Api");
// c.SwaggerEndpoint("/swagger/v5/swagger.json", "Ai-Api");
// c.SwaggerEndpoint("/swagger/v6/swagger.json", "AiApp-Api");
// c.RoutePrefix = "";
//});
app.UseRouting();
app.UseCors();