diff --git a/Tiobon.Core.Api/Controllers/FileController.cs b/Tiobon.Core.Api/Controllers/FileController.cs index 5d19941f..7a4d790e 100644 --- a/Tiobon.Core.Api/Controllers/FileController.cs +++ b/Tiobon.Core.Api/Controllers/FileController.cs @@ -150,15 +150,15 @@ public class FileController : BaseApiController /// 分片上传 /// /// - /// + /// /// /// /// /// [HttpPost("UploadLarge")] - public async Task UploadLargeAsync(IFormFile file, string videoName, int chunkIndex, int totalChunks, string id) + public async Task UploadLargeAsync(IFormFile file, string fileName, int chunkIndex, int totalChunks, string id) { - dynamic obj = await _ghre_AttachmentServices.UploadVideoAsync(file, videoName, chunkIndex, totalChunks, id); + dynamic obj = await _ghre_AttachmentServices.UploadVideoAsync(file, fileName, chunkIndex, totalChunks, id); return Ok(obj); } #endregion diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamController.cs index 7f3eb938..4f08c9e1 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamController.cs @@ -85,4 +85,19 @@ public class Ghre_ExamController : BaseController + /// 更新考试状态接口 + /// + /// + /// + /// + [HttpPost("UpdateStatus/{status}")] + public async Task UpdateStatus([FromBody] long[] ids, string status) + { + return await _service.UpdateStatus(ids, status); + } + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.IServices/Ghre/IGhre_AttachmentServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_AttachmentServices.cs index 79c08d74..e01da876 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_AttachmentServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_AttachmentServices.cs @@ -9,7 +9,7 @@ namespace Tiobon.Core.IServices /// public interface IGhre_AttachmentServices :IBaseServices { - Task UploadVideoAsync(IFormFile file, string videoName, int chunkIndex, int totalChunks, string id); + Task UploadVideoAsync(IFormFile file, string fileName, int chunkIndex, int totalChunks, string id); } } \ No newline at end of file diff --git a/Tiobon.Core.IServices/Ghre/IGhre_ExamServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_ExamServices.cs index b66a44c8..c732dc05 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_ExamServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_ExamServices.cs @@ -18,5 +18,7 @@ namespace Tiobon.Core.IServices Task>> QueryStaff(List Ids, string type); Task> Insert1(long id, DefaultGhre_ExamPageData pageData); + + Task UpdateStatus(long[] ids, string status); } } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghre/Ghre_AttachmentServices.cs b/Tiobon.Core.Services/Ghre/Ghre_AttachmentServices.cs index f803902a..f8c80af5 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_AttachmentServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_AttachmentServices.cs @@ -21,7 +21,7 @@ namespace Tiobon.Core.Services base.BaseDal = dal; } - public async Task UploadVideoAsync(IFormFile file, string videoName, int chunkIndex, int totalChunks, string id) + public async Task UploadVideoAsync(IFormFile file, string fileName, int chunkIndex, int totalChunks, string id) { dynamic obj = new ExpandoObject(); string status = "error"; diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index bb5fbc83..c9d425a6 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -12,6 +12,8 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SqlSugar; using Tiobon.Core.Common.Helper; +using Microsoft.AspNetCore.Http; +using Tiobon.Core.Common.UserManager; namespace Tiobon.Core.Services; @@ -528,7 +530,7 @@ public class Ghre_ExamServices : BaseServices Ids.Contains(x.StaffID)); - var data = Db.Ado.SqlQuery(sql); + var data = await Db.Ado.SqlQueryAsync(sql); //var data = list.Select(x => new StaffTableData() //{ // StaffID = x.StaffID, @@ -585,4 +587,40 @@ public class Ghre_ExamServices : BaseServices UpdateStatus(long[] ids, string status) + { + if (status != "Released" && status != "Disabled" && status != "Draft") + throw new Exception("无效的状态"); + + HttpRequest request = UserContext.Context.Request; + var api = request.Path.ObjToString().TrimEnd('/').ToLower(); + var ip = GetUserIp(UserContext.Context); + + var entities = new List(); + foreach (var id in ids) + { + if (id == null || !BaseDal.Any(id)) + continue; + + var entity = await BaseDal.QueryById(id); + + BasePoco ent = entity; + ent.UpdateIP = ip; + ent.UpdateProg = api; + if (status == "Released" || status == "Disabled" || status == "Draft") + { + entity.Status = status; + entities.Add(entity); + } + } + + var result = await BaseDal.Update(entities); + if (status == "Released") + return ServiceResult.OprateSuccess("发布成功!"); + else if (status == "Draft") + return ServiceResult.OprateSuccess("取消发布成功!"); + else + return ServiceResult.OprateSuccess("停用成功!"); + + } } \ No newline at end of file