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

View File

@ -124,8 +124,8 @@ namespace YD_WeChatApplet.Api.Services.Impl
/// <returns></returns>
public async Task<List<SpecialDto>> 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();

View File

@ -9,7 +9,9 @@
/// Ai一体机扫描登录
/// </summary>
/// <param name="code"></param>
/// <param name="schoolCode"></param>
/// <param name="teacherNo"></param>
/// <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.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using YD_WeChatApplet.Commons.Enum;
namespace YD_WeChatApplet.Api.SmartSportsEntitys
{
[Table("JS_SpecialAction")]