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] =?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);
}
}