This commit is contained in:
tanglong 2026-01-29 13:27:09 +08:00
commit fa5eada16e
6 changed files with 32 additions and 12 deletions

View File

@ -46,6 +46,10 @@ namespace YD_WeChatApplet.Context
public DbSet<Y_StadiumVisiting> StadiumVisiting { get; set; } public DbSet<Y_StadiumVisiting> StadiumVisiting { get; set; }
public DbSet<Y_SchoolAccountApplication> SchoolAccountApplication { get; set; } public DbSet<Y_SchoolAccountApplication> SchoolAccountApplication { get; set; }
public DbSet<Y_CurricularPurchaseRecord> CurricularPurchaseRecord { get; set; } public DbSet<Y_CurricularPurchaseRecord> CurricularPurchaseRecord { get; set; }
public DbSet<JS_Special> JS_Special { get; set; }
public DbSet<JS_SpecialAction> JS_SpecialAction { get; set; }
public DbSet<JS_SpecialLevel> JS_SpecialLevel { get; set; }
} }
} }

View File

@ -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.Api.Services.Interface;
using YD_WeChatApplet.Commons.Dto.HomeWork; using YD_WeChatApplet.Commons.Dto.HomeWork;
using YD_WeChatApplet.Commons.Dto.Patriarch; using YD_WeChatApplet.Commons.Dto.Patriarch;
@ -12,6 +13,7 @@ namespace YD_WeChatApplet.Api.Controllers
[ApiController] [ApiController]
[ApiExplorerSettings(GroupName = "v1")] [ApiExplorerSettings(GroupName = "v1")]
[Route("[controller]")] [Route("[controller]")]
[AllowAnonymous]
public class FrameworkController : ControllerBase public class FrameworkController : ControllerBase
{ {
private readonly IFrameworkService _frameworkService; private readonly IFrameworkService _frameworkService;
@ -24,11 +26,13 @@ namespace YD_WeChatApplet.Api.Controllers
/// Ai一体机扫描登录 /// Ai一体机扫描登录
/// </summary> /// </summary>
/// <param name="code"></param> /// <param name="code"></param>
/// <param name="schoolCode"></param>
/// <param name="teacherNo"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("ScanCodeLogin")] [HttpPost("ScanCodeLogin")]
public async Task<bool> ScanCodeLogin(string code) public async Task<bool> ScanCodeLogin(string code, string? schoolCode = null, string? teacherNo = null)
{ {
return await _frameworkService.ScanCodeLogin(code); return await _frameworkService.ScanCodeLogin(code, schoolCode, teacherNo);
} }
} }
} }

View File

@ -18,16 +18,26 @@ namespace YD_WeChatApplet.Api.Services.Impl
_sportsContext = sportsContext; _sportsContext = sportsContext;
} }
/// <summary> /// <summary>
/// Ai一体机扫描登录 /// Ai一体机扫描登录
/// </summary> /// </summary>
/// <param name="code"></param> /// <param name="code"></param>
/// <param name="schoolCode"></param>
/// <param name="teacherNo"></param>
/// <returns></returns> /// <returns></returns>
public async Task<bool> ScanCodeLogin(string code) public async Task<bool> ScanCodeLogin(string code, string? schoolCode = null, string? teacherNo = null)
{ {
var schoolCode = UserLoginContext.Current.SchoolCode; // 如果 schoolCode 为空,则取当前登录用户的 SchoolCode
//var teacherId = UserLoginContext.Current.UserId; if (string.IsNullOrWhiteSpace(schoolCode))
{
schoolCode = UserLoginContext.Current.SchoolCode;
}
// 如果 teacherNo 为空,则取当前登录用户的 UserNo
if (string.IsNullOrWhiteSpace(teacherNo))
{
teacherNo = UserLoginContext.Current.UserNo;
}
// 先检查是否已存在相同的记录 // 先检查是否已存在相同的记录
var exist = await _sportsContext.Ai_ScanCodeLogin var exist = await _sportsContext.Ai_ScanCodeLogin
@ -42,13 +52,12 @@ namespace YD_WeChatApplet.Api.Services.Impl
Code = code, Code = code,
SchoolCode = schoolCode, SchoolCode = schoolCode,
TeacherId = 0, TeacherId = 0,
TeacherPhoneNo = UserLoginContext.Current.UserNo, TeacherPhoneNo = teacherNo,
CreateDate = DateTime.Now CreateDate = DateTime.Now
}; };
await _sportsContext.AddAsync(entity); await _sportsContext.AddAsync(entity);
return await _sportsContext.SaveChangesAsync() > 0; return await _sportsContext.SaveChangesAsync() > 0;
} }
} }
} }

View File

@ -124,8 +124,8 @@ namespace YD_WeChatApplet.Api.Services.Impl
/// <returns></returns> /// <returns></returns>
public async Task<List<SpecialDto>> SpecialLevelList() public async Task<List<SpecialDto>> SpecialLevelList()
{ {
var specials = await _sportsContext.Ai_Special.ToListAsync(); var specials = await _sportsContext.JS_Special.ToListAsync();
var levels = await _sportsContext.Ai_SpecialLevel var levels = await _sportsContext.JS_SpecialLevel
.Where(s => specials.Select(x => x.Id).Contains(s.SpecialId)) .Where(s => specials.Select(x => x.Id).Contains(s.SpecialId))
.Include(s => s.SpecialActionList) .Include(s => s.SpecialActionList)
.ToListAsync(); .ToListAsync();

View File

@ -9,7 +9,9 @@
/// Ai一体机扫描登录 /// Ai一体机扫描登录
/// </summary> /// </summary>
/// <param name="code"></param> /// <param name="code"></param>
/// <param name="schoolCode"></param>
/// <param name="teacherNo"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> ScanCodeLogin(string code); Task<bool> ScanCodeLogin(string code, string? schoolCode = null, string? teacherNo = null);
} }
} }

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using YD_WeChatApplet.Commons.Enum;
namespace YD_WeChatApplet.Api.SmartSportsEntitys namespace YD_WeChatApplet.Api.SmartSportsEntitys
{ {
[Table("JS_SpecialAction")] [Table("JS_SpecialAction")]