diff --git a/VOL.Ai/IServices/IAiAppService.cs b/VOL.Ai/IServices/IAiAppService.cs
index 3e22cb8..b70d08d 100644
--- a/VOL.Ai/IServices/IAiAppService.cs
+++ b/VOL.Ai/IServices/IAiAppService.cs
@@ -191,6 +191,21 @@ namespace VOL.Ai.IServices
///
Task IsActivityInList(IsActivityInListRequest paramDto);
+
+ ///
+ /// Ai一体机扫描那登录轮询
+ ///
+ ///
+ ///
+ Task ScanCodeLogin(Ai_Request paramDto);
+
+ ///
+ /// 退出登录
+ ///
+ ///
+ ///
+ Task LogOut(LoginOutDto paramDto);
+
#endregion
}
}
diff --git a/VOL.Ai/Services/AiAppService.cs b/VOL.Ai/Services/AiAppService.cs
index f89a39a..317b3b6 100644
--- a/VOL.Ai/Services/AiAppService.cs
+++ b/VOL.Ai/Services/AiAppService.cs
@@ -1199,5 +1199,67 @@ namespace VOL.Ai.Services
return res;
}
+
+ ///
+ /// Ai一体机扫描那登录轮询
+ ///
+ ///
+ ///
+ public async Task ScanCodeLogin(Ai_Request paramDto)
+ {
+ var loginInfo = await _teacherRepository.DbContext.Set().Where(x => x.Code == paramDto.Code && x.SchoolCode == paramDto.SchoolCode).FirstOrDefaultAsync();
+
+ if (loginInfo == null)
+ return new Ai_TeacherFaceInfo();
+
+
+ var res = await _teacherRepository.FindAsIQueryable(x => x.SchoolCode == paramDto.SchoolCode && x.TeacherStatus != TeacherStatus.Depart && x.TeacherPhoneNo == loginInfo.TeacherPhoneNo && x.Id == loginInfo.TeacherId)
+ .Select(x =>
+ new Ai_TeacherFaceInfo()
+ {
+ Id = x.Id,
+ Age = x.Age,
+ //SchoolCode = x.SchoolCode,
+ Sex = x.Sex,
+ Phone = x.TeacherPhoneNo,
+ TeacherName = x.TeacherName,
+ Photo = x.TeacherPhoto,
+ }).FirstOrDefaultAsync();
+
+ if (res == null)
+ throw new Exception("未查询到登陆信息");
+
+
+ var grades = await (
+ from t in _studentRepository.DbContext.Set()
+ join c in _studentRepository.DbContext.Set() on t.ClassId equals c.Id into classGroup
+ from c in classGroup.DefaultIfEmpty()
+ where t.TeacherId == res.Id && c != null
+ select new Classes()
+ {
+ Id = c.Id,
+ Name = $"{c.GradeName}-{c.ClassName}",
+ }).ToListAsync();
+
+ res.GradeAndClassList = grades;
+
+ return res;
+ }
+
+ ///
+ /// 退出登录
+ ///
+ ///
+ ///
+
+ public async Task LogOut(LoginOutDto paramDto)
+ {
+ var teacher = await _teacherRepository.DbContext.Set().Where(x => x.Code == paramDto.Code && x.SchoolCode == paramDto.SchoolCode).FirstOrDefaultAsync();
+
+ if (teacher == null) return true;
+
+ _teacherRepository.DbContext.Set().Remove(teacher);
+ return await _teacherRepository.SaveChangesAsync() > 0;
+ }
}
}
diff --git a/VOL.Model/Ai/Request/Ai_Request.cs b/VOL.Model/Ai/Request/Ai_Request.cs
index 276f9c8..a617da4 100644
--- a/VOL.Model/Ai/Request/Ai_Request.cs
+++ b/VOL.Model/Ai/Request/Ai_Request.cs
@@ -77,4 +77,17 @@ namespace VOL.Model.Ai
///
//public string StudentNo { get; set; }
}
+
+ ///
+ /// 退出登录
+ ///
+ public class LoginOutDto : Ai_Request
+ {
+ ///
+ /// 教师Id
+ ///
+ public int TeacherId { get; set; }
+
+ }
+
}
diff --git a/VOL.WebApi/Controllers/AI/AiAppController.cs b/VOL.WebApi/Controllers/AI/AiAppController.cs
index cd5cf7c..bb681fa 100644
--- a/VOL.WebApi/Controllers/AI/AiAppController.cs
+++ b/VOL.WebApi/Controllers/AI/AiAppController.cs
@@ -436,5 +436,31 @@ namespace VOL.WebApi.Controllers
var result = await _aiAppService.FastJumpRopeRanking(paramDto);
return result;
}
+
+ ///
+ /// Ai一体机扫描那登录轮询
+ ///
+ ///
+ ///
+ [HttpPost(nameof(ScanCodeLogin))]
+ public async Task ScanCodeLogin([FromBody] Ai_Request paramDto)
+ {
+ var result = await _aiAppService.ScanCodeLogin(paramDto);
+
+ return result;
+ }
+
+ ///
+ /// 退出登录
+ ///
+ ///
+ ///
+ [HttpPost(nameof(LogOut))]
+ public async Task LogOut([FromBody] LoginOutDto paramDto)
+ {
+ var result = await _aiAppService.LogOut(paramDto);
+
+ return result;
+ }
}
}