From 976d0cae181e18e8dba6e986bb84e3d361303559 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com>
Date: Fri, 20 Oct 2023 17:20:58 +0800
Subject: [PATCH] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E5=A4=A7=E5=AD=A6?=
=?UTF-8?q?=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Front/MyHistoryInfoController.cs | 28 +++++++++++++++++--
New_College.Api/New_College.xml | 7 +++++
.../ViewModels/Result/MyHistoryResponse.cs | 9 ++++++
3 files changed, 42 insertions(+), 2 deletions(-)
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
{
///