diff --git a/New_College.Api/Controllers/Front/MyHistoryInfoController.cs b/New_College.Api/Controllers/Front/MyHistoryInfoController.cs index 20f30dd..2f828a4 100644 --- a/New_College.Api/Controllers/Front/MyHistoryInfoController.cs +++ b/New_College.Api/Controllers/Front/MyHistoryInfoController.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using New_College.IServices; @@ -16,6 +17,7 @@ namespace New_College.Api.Controllers.Front /// [Route("api/front/[controller]/[action]")] [ApiController] + [Authorize] public class MyHistoryInfoController : ControllerBase { private readonly ID_MyHistoryInfoServices _MyHistory; @@ -27,6 +29,28 @@ namespace New_College.Api.Controllers.Front } + + /// + /// 添加浏览记录 + /// + /// + /// + [HttpPost] + public async Task> Add([FromBody] MyHistoryRequestDto requestDto) + { + var res = new MessageModel(); + /// + var status = await _MyHistory.Add(new Model.Models.D_MyHistoryInfo() + { + CreateTime = DateTime.Now, + CustomerId = requestDto.CustomerId, + Type = 0, + UId = requestDto.UId, + }); + + return res; + } + /// /// 浏览历史记录列表 /// @@ -42,7 +66,7 @@ namespace New_College.Api.Controllers.Front if (query.Any()) { var uids = query.Select(s => s.UId).ToList(); - var universitysinfo = await this._UniversityServices.Query(q =>SqlFunc.ContainsArray(uids,q.Id)); + var universitysinfo = await this._UniversityServices.Query(q => SqlFunc.ContainsArray(uids, q.Id)); response = universitysinfo.Select(s => new MyHistoryResponse() { AreaName = s.Area_Name, @@ -53,7 +77,7 @@ namespace New_College.Api.Controllers.Front Rank = s.Rank, Syl = s.Syl == 1 ? true : false, Nhef = s.Nhef == 1 ? true : false, - Sff = s.Sff == 1 ? true : false + Sff = s.Sff == 1 ? true : false }).ToList(); } return new MessageModel>() diff --git a/New_College.Api/New_College.xml b/New_College.Api/New_College.xml index 3274411..96f5ff9 100644 --- a/New_College.Api/New_College.xml +++ b/New_College.Api/New_College.xml @@ -399,6 +399,13 @@ 历史大学 + + + 添加浏览记录 + + + + 浏览历史记录列表 diff --git a/New_College.Model/ViewModels/Result/MyHistoryResponse.cs b/New_College.Model/ViewModels/Result/MyHistoryResponse.cs index 33d2646..e94c4df 100644 --- a/New_College.Model/ViewModels/Result/MyHistoryResponse.cs +++ b/New_College.Model/ViewModels/Result/MyHistoryResponse.cs @@ -4,6 +4,15 @@ using System.Text; namespace New_College.Model.ViewModels.Result { + + + public class MyHistoryRequestDto + { + public int CustomerId { get; set; } + + public int UId { get; set; } + } + public class MyHistoryResponse { ///