From b009faf7d5ebb8cecf629e19725a335d067e3144 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Thu, 29 Jan 2026 11:51:47 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeChatApplet/Controllers/FrameworkController.cs | 9 ++++++--- WeChatApplet/Services/Impl/FrameworkService.cs | 11 +++++++---- WeChatApplet/Services/Interface/IFrameworkService.cs | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/WeChatApplet/Controllers/FrameworkController.cs b/WeChatApplet/Controllers/FrameworkController.cs index 46a9d41..77dced0 100644 --- a/WeChatApplet/Controllers/FrameworkController.cs +++ b/WeChatApplet/Controllers/FrameworkController.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; using YD_WeChatApplet.Api.Services.Interface; using YD_WeChatApplet.Commons.Dto.HomeWork; using YD_WeChatApplet.Commons.Dto.Patriarch; @@ -12,6 +13,7 @@ namespace YD_WeChatApplet.Api.Controllers [ApiController] [ApiExplorerSettings(GroupName = "v1")] [Route("[controller]")] + [AllowAnonymous] public class FrameworkController : ControllerBase { private readonly IFrameworkService _frameworkService; @@ -24,11 +26,12 @@ namespace YD_WeChatApplet.Api.Controllers /// Ai一体机扫描登录 /// /// + /// /// [HttpPost("ScanCodeLogin")] - public async Task ScanCodeLogin(string code) + public async Task ScanCodeLogin(string code, string? schoolCode = null) { - return await _frameworkService.ScanCodeLogin(code); + return await _frameworkService.ScanCodeLogin(code, schoolCode); } } } \ No newline at end of file diff --git a/WeChatApplet/Services/Impl/FrameworkService.cs b/WeChatApplet/Services/Impl/FrameworkService.cs index 8a839e5..c91998b 100644 --- a/WeChatApplet/Services/Impl/FrameworkService.cs +++ b/WeChatApplet/Services/Impl/FrameworkService.cs @@ -23,11 +23,15 @@ namespace YD_WeChatApplet.Api.Services.Impl /// Ai一体机扫描登录 /// /// + /// /// - public async Task ScanCodeLogin(string code) + public async Task ScanCodeLogin(string code, string? schoolCode) { - var schoolCode = UserLoginContext.Current.SchoolCode; - //var teacherId = UserLoginContext.Current.UserId; + // 如果 schoolCode 为空,则取当前登录用户的 SchoolCode + if (string.IsNullOrWhiteSpace(schoolCode)) + { + schoolCode = UserLoginContext.Current.SchoolCode; + } // 先检查是否已存在相同的记录 var exist = await _sportsContext.Ai_ScanCodeLogin @@ -49,6 +53,5 @@ namespace YD_WeChatApplet.Api.Services.Impl await _sportsContext.AddAsync(entity); return await _sportsContext.SaveChangesAsync() > 0; } - } } diff --git a/WeChatApplet/Services/Interface/IFrameworkService.cs b/WeChatApplet/Services/Interface/IFrameworkService.cs index 42a772b..ce052ef 100644 --- a/WeChatApplet/Services/Interface/IFrameworkService.cs +++ b/WeChatApplet/Services/Interface/IFrameworkService.cs @@ -9,7 +9,8 @@ /// Ai一体机扫描登录 /// /// + /// /// - Task ScanCodeLogin(string code); + Task ScanCodeLogin(string code, string schoolCode); } } From 9126f352b46510463fe992abb0f38387c7d9f1bd Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Thu, 29 Jan 2026 12:00:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeChatApplet/Controllers/FrameworkController.cs | 5 +++-- WeChatApplet/Services/Impl/FrameworkService.cs | 12 +++++++++--- WeChatApplet/Services/Interface/IFrameworkService.cs | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/WeChatApplet/Controllers/FrameworkController.cs b/WeChatApplet/Controllers/FrameworkController.cs index 77dced0..571292d 100644 --- a/WeChatApplet/Controllers/FrameworkController.cs +++ b/WeChatApplet/Controllers/FrameworkController.cs @@ -27,11 +27,12 @@ namespace YD_WeChatApplet.Api.Controllers /// /// /// + /// /// [HttpPost("ScanCodeLogin")] - public async Task ScanCodeLogin(string code, string? schoolCode = null) + public async Task ScanCodeLogin(string code, string? schoolCode = null, string? teacherNo = null) { - return await _frameworkService.ScanCodeLogin(code, schoolCode); + return await _frameworkService.ScanCodeLogin(code, schoolCode, teacherNo); } } } \ No newline at end of file diff --git a/WeChatApplet/Services/Impl/FrameworkService.cs b/WeChatApplet/Services/Impl/FrameworkService.cs index c91998b..e5eeeda 100644 --- a/WeChatApplet/Services/Impl/FrameworkService.cs +++ b/WeChatApplet/Services/Impl/FrameworkService.cs @@ -18,14 +18,14 @@ namespace YD_WeChatApplet.Api.Services.Impl _sportsContext = sportsContext; } - /// /// Ai一体机扫描登录 /// /// /// + /// /// - public async Task ScanCodeLogin(string code, string? schoolCode) + public async Task ScanCodeLogin(string code, string? schoolCode = null, string? teacherNo = null) { // 如果 schoolCode 为空,则取当前登录用户的 SchoolCode if (string.IsNullOrWhiteSpace(schoolCode)) @@ -33,6 +33,12 @@ namespace YD_WeChatApplet.Api.Services.Impl schoolCode = UserLoginContext.Current.SchoolCode; } + // 如果 teacherNo 为空,则取当前登录用户的 UserNo + if (string.IsNullOrWhiteSpace(teacherNo)) + { + teacherNo = UserLoginContext.Current.UserNo; + } + // 先检查是否已存在相同的记录 var exist = await _sportsContext.Ai_ScanCodeLogin .AnyAsync(x => x.Code == code && x.SchoolCode == schoolCode); @@ -46,7 +52,7 @@ namespace YD_WeChatApplet.Api.Services.Impl Code = code, SchoolCode = schoolCode, TeacherId = 0, - TeacherPhoneNo = UserLoginContext.Current.UserNo, + TeacherPhoneNo = teacherNo, CreateDate = DateTime.Now }; diff --git a/WeChatApplet/Services/Interface/IFrameworkService.cs b/WeChatApplet/Services/Interface/IFrameworkService.cs index ce052ef..c323ad5 100644 --- a/WeChatApplet/Services/Interface/IFrameworkService.cs +++ b/WeChatApplet/Services/Interface/IFrameworkService.cs @@ -10,7 +10,8 @@ /// /// /// + /// /// - Task ScanCodeLogin(string code, string schoolCode); + Task ScanCodeLogin(string code, string? schoolCode = null, string? teacherNo = null); } } From 195c1d6d727bb97d49376bd0fefbd35b722803d1 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Thu, 29 Jan 2026 13:18:37 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeChatApplet/Context/SmartSportsContext.cs | 4 + WeChatApplet/Services/Impl/ResourceService.cs | 4 +- WeChatApplet/SmartSportsEntitys/JS_Special.cs | 73 +++++++++++ .../SmartSportsEntitys/JS_SpecialAction.cs | 113 ++++++++++++++++++ .../SmartSportsEntitys/JS_SpecialLevel.cs | 95 +++++++++++++++ 5 files changed, 287 insertions(+), 2 deletions(-) create mode 100644 WeChatApplet/SmartSportsEntitys/JS_Special.cs create mode 100644 WeChatApplet/SmartSportsEntitys/JS_SpecialAction.cs create mode 100644 WeChatApplet/SmartSportsEntitys/JS_SpecialLevel.cs diff --git a/WeChatApplet/Context/SmartSportsContext.cs b/WeChatApplet/Context/SmartSportsContext.cs index b5d6460..6a4acb5 100644 --- a/WeChatApplet/Context/SmartSportsContext.cs +++ b/WeChatApplet/Context/SmartSportsContext.cs @@ -46,6 +46,10 @@ namespace YD_WeChatApplet.Context public DbSet StadiumVisiting { get; set; } public DbSet SchoolAccountApplication { get; set; } public DbSet CurricularPurchaseRecord { get; set; } + + public DbSet JS_Special { get; set; } + public DbSet JS_SpecialAction { get; set; } + public DbSet JS_SpecialLevel { get; set; } } } diff --git a/WeChatApplet/Services/Impl/ResourceService.cs b/WeChatApplet/Services/Impl/ResourceService.cs index 8dbcb6d..8fb2aa9 100644 --- a/WeChatApplet/Services/Impl/ResourceService.cs +++ b/WeChatApplet/Services/Impl/ResourceService.cs @@ -124,8 +124,8 @@ namespace YD_WeChatApplet.Api.Services.Impl /// public async Task> SpecialLevelList() { - var specials = await _sportsContext.Ai_Special.ToListAsync(); - var levels = await _sportsContext.Ai_SpecialLevel + var specials = await _sportsContext.JS_Special.ToListAsync(); + var levels = await _sportsContext.JS_SpecialLevel .Where(s => specials.Select(x => x.Id).Contains(s.SpecialId)) .Include(s => s.SpecialActionList) .ToListAsync(); diff --git a/WeChatApplet/SmartSportsEntitys/JS_Special.cs b/WeChatApplet/SmartSportsEntitys/JS_Special.cs new file mode 100644 index 0000000..5d4ecd7 --- /dev/null +++ b/WeChatApplet/SmartSportsEntitys/JS_Special.cs @@ -0,0 +1,73 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace YD_WeChatApplet.Api.SmartSportsEntitys +{ + [Table("JS_Special")] + public class JS_Special + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Display(Description = "主键Id")] + [Comment("Id")] + public int Id { get; set; } + + /// + /// 专项名称 + /// + [Display(Name = "专项名称")] + [Comment("专项名称")] + [Column(TypeName = "nvarchar(100)")] + public string SpecialName { get; set; } + + /// + /// 图片地址 + /// + [Display(Name = "图片地址")] + [Comment("图片地址")] + [Column(TypeName = "nvarchar(2000)")] + public string ImageUrl { get; set; } + + /// + /// 创建人 + /// + [Display(Name = "创建人")] + [Comment("创建人")] + [Column(TypeName = "int")] + public int? Creator { get; set; } + + /// + /// 创建时间 + /// + [Display(Name = "创建时间")] + [Comment("创建时间")] + [Column(TypeName = "datetime")] + [Editable(true)] + public DateTime? CreateDate { get; set; } + + /// + /// 修改人 + /// + [Display(Name = "修改人")] + [Comment("修改人")] + [Column(TypeName = "int")] + public int? Modifier { get; set; } + + /// + /// 修改时间 + /// + [Display(Name = "修改时间")] + [Comment("修改时间")] + [Column(TypeName = "datetime")] + public DateTime? ModifyDate { get; set; } + + /// + /// 专项水平列表 + /// + [Display(Name = "专项水平列表")] + [Comment("专项水平列表")] + public List SpecialLevelList { get; set; } + } +} diff --git a/WeChatApplet/SmartSportsEntitys/JS_SpecialAction.cs b/WeChatApplet/SmartSportsEntitys/JS_SpecialAction.cs new file mode 100644 index 0000000..c4cf94b --- /dev/null +++ b/WeChatApplet/SmartSportsEntitys/JS_SpecialAction.cs @@ -0,0 +1,113 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using YD_WeChatApplet.Commons.Enum; +namespace YD_WeChatApplet.Api.SmartSportsEntitys +{ + [Table("JS_SpecialAction")] + public class JS_SpecialAction + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Display(Description = "主键Id")] + [Comment("Id")] + public int Id { get; set; } + + /// + /// 专项水平Id + /// + [Display(Name = "专项水平Id")] + [Comment("专项水平Id")] + [Column(TypeName = "int")] + public int SpecialLevelId { get; set; } + + /// + /// 动作名称 + /// + [Display(Name = "动作名称")] + [Comment("动作名称")] + [Column(TypeName = "nvarchar(100)")] + public string ActionName { get; set; } + + /// + /// 动作类型 + /// + [Display(Name = "动作类型")] + [Comment("动作类型")] + [Column(TypeName = "nvarchar(100)")] + public SpecialActionType ActionType { get; set; } + + /// + /// 动作示范-视频路径 + /// + [Display(Name = "动作示范-视频路径")] + [Comment("动作示范-视频路径")] + [Column(TypeName = "nvarchar(2000)")] + public string ActionVideoPath { get; set; } + + /// + /// 要领讲解-视频路径 + /// + [Display(Name = "要领讲解-视频路径")] + [Comment("要领讲解-视频路径")] + [Column(TypeName = "nvarchar(2000)")] + public string ExplainVideoPath { get; set; } + + /// + /// 练习方法-视频路径 + /// + [Display(Name = "练习方法-视频路径")] + [Comment("练习方法-视频路径")] + [Column(TypeName = "nvarchar(2000)")] + public string ExerciseVideoPath { get; set; } + + /// + /// 达标标准-视频路径 + /// + [Display(Name = "达标标准-视频路径")] + [Comment("达标标准-视频路径")] + [Column(TypeName = "nvarchar(2000)")] + public string StandardVideoPath { get; set; } + + /// + /// 创建人 + /// + [Display(Name = "创建人")] + [Comment("创建人")] + [Column(TypeName = "int")] + public int? Creator { get; set; } + + /// + /// 创建时间 + /// + [Display(Name = "创建时间")] + [Comment("创建时间")] + [Column(TypeName = "datetime")] + [Editable(true)] + public DateTime? CreateDate { get; set; } + + /// + /// 修改人 + /// + [Display(Name = "修改人")] + [Comment("修改人")] + [Column(TypeName = "int")] + public int? Modifier { get; set; } + + /// + /// 修改时间 + /// + [Display(Name = "修改时间")] + [Comment("修改时间")] + [Column(TypeName = "datetime")] + public DateTime? ModifyDate { get; set; } + + /// + /// 专项水平表-导航属性 + /// + [ForeignKey("SpecialLevelId")] + public JS_SpecialLevel SpecialLevel { get; set; } + } +} diff --git a/WeChatApplet/SmartSportsEntitys/JS_SpecialLevel.cs b/WeChatApplet/SmartSportsEntitys/JS_SpecialLevel.cs new file mode 100644 index 0000000..137571f --- /dev/null +++ b/WeChatApplet/SmartSportsEntitys/JS_SpecialLevel.cs @@ -0,0 +1,95 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace YD_WeChatApplet.Api.SmartSportsEntitys +{ + [Table("JS_SpecialLevel")] + public class JS_SpecialLevel + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Display(Description = "主键Id")] + [Comment("Id")] + public int Id { get; set; } + + /// + /// 专项Id + /// + [Display(Name = "专项Id")] + [Comment("专项Id")] + [Column(TypeName = "int")] + public int SpecialId { get; set; } + + /// + /// 水平名称 + /// + [Display(Name = "水平名称")] + [Comment("水平名称")] + [Column(TypeName = "nvarchar(100)")] + public string LevelName { get; set; } + + /// + /// 开始年级 + /// + [Display(Name = "开始年级")] + [Comment("开始年级")] + [Column(TypeName = "int")] + public int StartGrade { get; set; } + + /// + /// 结束年级 + /// + [Display(Name = "结束年级")] + [Comment("结束年级")] + [Column(TypeName = "int")] + public int EndGrade { get; set; } + + /// + /// 创建人 + /// + [Display(Name = "创建人")] + [Comment("创建人")] + [Column(TypeName = "int")] + public int? Creator { get; set; } + + /// + /// 创建时间 + /// + [Display(Name = "创建时间")] + [Comment("创建时间")] + [Column(TypeName = "datetime")] + [Editable(true)] + public DateTime? CreateDate { get; set; } + + /// + /// 修改人 + /// + [Display(Name = "修改人")] + [Comment("修改人")] + [Column(TypeName = "int")] + public int? Modifier { get; set; } + + /// + /// 修改时间 + /// + [Display(Name = "修改时间")] + [Comment("修改时间")] + [Column(TypeName = "datetime")] + public DateTime? ModifyDate { get; set; } + + /// + /// 专项-导航属性 + /// + [ForeignKey("SpecialId")] + public JS_Special Special { get; set; } + + /// + /// 专项动作列表 + /// + [Display(Name = "专项动作列表")] + [Comment("专项动作列表")] + public List SpecialActionList { get; set; } + } +}