feat:添加大学记录

develop
old易 2023-10-20 17:20:58 +08:00
parent cf45659d05
commit 976d0cae18
3 changed files with 42 additions and 2 deletions

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using New_College.IServices; using New_College.IServices;
@ -16,6 +17,7 @@ namespace New_College.Api.Controllers.Front
/// </summary> /// </summary>
[Route("api/front/[controller]/[action]")] [Route("api/front/[controller]/[action]")]
[ApiController] [ApiController]
[Authorize]
public class MyHistoryInfoController : ControllerBase public class MyHistoryInfoController : ControllerBase
{ {
private readonly ID_MyHistoryInfoServices _MyHistory; private readonly ID_MyHistoryInfoServices _MyHistory;
@ -27,6 +29,28 @@ namespace New_College.Api.Controllers.Front
} }
/// <summary>
/// 添加浏览记录
/// </summary>
/// <param name="requestDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<MessageModel<bool>> Add([FromBody] MyHistoryRequestDto requestDto)
{
var res = new MessageModel<bool>();
///
var status = await _MyHistory.Add(new Model.Models.D_MyHistoryInfo()
{
CreateTime = DateTime.Now,
CustomerId = requestDto.CustomerId,
Type = 0,
UId = requestDto.UId,
});
return res;
}
/// <summary> /// <summary>
/// 浏览历史记录列表 /// 浏览历史记录列表
/// </summary> /// </summary>
@ -42,7 +66,7 @@ namespace New_College.Api.Controllers.Front
if (query.Any()) if (query.Any())
{ {
var uids = query.Select(s => s.UId).ToList(); 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() response = universitysinfo.Select(s => new MyHistoryResponse()
{ {
AreaName = s.Area_Name, AreaName = s.Area_Name,

View File

@ -399,6 +399,13 @@
历史大学 历史大学
</summary> </summary>
</member> </member>
<member name="M:New_College.Api.Controllers.Front.MyHistoryInfoController.Add(New_College.Model.ViewModels.Result.MyHistoryRequestDto)">
<summary>
添加浏览记录
</summary>
<param name="requestDto"></param>
<returns></returns>
</member>
<member name="M:New_College.Api.Controllers.Front.MyHistoryInfoController.GetMyHistory(System.Int32)"> <member name="M:New_College.Api.Controllers.Front.MyHistoryInfoController.GetMyHistory(System.Int32)">
<summary> <summary>
浏览历史记录列表 浏览历史记录列表

View File

@ -4,6 +4,15 @@ using System.Text;
namespace New_College.Model.ViewModels.Result namespace New_College.Model.ViewModels.Result
{ {
public class MyHistoryRequestDto
{
public int CustomerId { get; set; }
public int UId { get; set; }
}
public class MyHistoryResponse public class MyHistoryResponse
{ {
/// <summary> /// <summary>