feat 添加历史搜索记录
This commit is contained in:
parent
d708494842
commit
60c86292bb
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.Custom.HistorySearchs;
|
||||
|
||||
namespace ARW.Model.Dto.Api.Custom.HistorySearchs
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 历史搜索查询对象Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public class HistorySearchQueryDtoApi
|
||||
{
|
||||
public long CustomerGuid { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.Custom.HistorySearchs;
|
||||
|
||||
namespace ARW.Model.Dto.Business.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史搜索输入对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public class HistorySearchDto
|
||||
{
|
||||
|
||||
public int HistorySearchId { get; set; }
|
||||
|
||||
public long HistorySearchGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "搜索内容不能为空")]
|
||||
public string HistorySearchContent { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 历史搜索查询对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public class HistorySearchQueryDto : PagerInfo
|
||||
{
|
||||
|
||||
public string ids { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SqlSugar;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ARW.Model.Models.Business.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史搜索,数据实体对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
[SugarTable("tb_history_search")]
|
||||
public class HistorySearch : BusinessBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "history_search_id")]
|
||||
public int HistorySearchId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "history_search_guid")]
|
||||
public long HistorySearchGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :客户guid
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "customer_guid")]
|
||||
public long CustomerGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :搜索内容
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "history_search_content")]
|
||||
public string HistorySearchContent { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
46
ARW.Model/Vo/Api/Custom/HistorySearchs/HistorySearchApiVo.cs
Normal file
46
ARW.Model/Vo/Api/Custom/HistorySearchs/HistorySearchApiVo.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Api.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史搜索展示对象Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public class HistorySearchVoApi
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
public int HistorySearchId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long HistorySearchGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :客户guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long CustomerGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :搜索内容
|
||||
/// </summary>
|
||||
public string HistorySearchContent { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
20
ARW.Model/Vo/Api/Custom/HistorySearchs/SearchTermCount.cs
Normal file
20
ARW.Model/Vo/Api/Custom/HistorySearchs/SearchTermCount.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Api.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 热门搜索对象Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public class SearchTermCount
|
||||
{
|
||||
public string SearchTerm { get; set; }
|
||||
public int Count { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Business.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史搜索展示对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public class HistorySearchVo
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
public int HistorySearchId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long HistorySearchGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :客户guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long CustomerGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :搜索内容
|
||||
/// </summary>
|
||||
public string HistorySearchContent { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ARW.Repository.System;
|
||||
using ARW.Model.Models.Business.Custom.HistorySearchs;
|
||||
|
||||
namespace ARW.Repository.Business.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史搜索仓储
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class HistorySearchRepository : BaseRepository<HistorySearch>
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Repository;
|
||||
using ARW.Repository.Business.Custom.HistorySearchs;
|
||||
using ARW.Service.Api.IBusinessService.Custom.HistorySearchs;
|
||||
using ARW.Model.Dto.Api.Custom.HistorySearchs;
|
||||
using ARW.Model.Models.Business.Custom.HistorySearchs;
|
||||
using ARW.Model.Vo.Api.Custom.HistorySearchs;
|
||||
|
||||
namespace ARW.Service.Api.BusinessService.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史搜索接口实现类Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IHistorySearchServiceApi), ServiceLifetime = LifeTime.Transient)]
|
||||
public class HistorySearchServiceImplApi : BaseService<HistorySearch>, IHistorySearchServiceApi
|
||||
{
|
||||
private readonly HistorySearchRepository _HistorySearchRepository;
|
||||
|
||||
public HistorySearchServiceImplApi(HistorySearchRepository HistorySearchRepository)
|
||||
{
|
||||
this._HistorySearchRepository = HistorySearchRepository;
|
||||
}
|
||||
|
||||
#region Api接口代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询历史搜索列表(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<HistorySearchVoApi>> GetHistorySearchListApi(HistorySearchQueryDtoApi parm)
|
||||
{
|
||||
//开始拼装查询条件d
|
||||
var predicate = Expressionable.Create<HistorySearch>();
|
||||
predicate = predicate.AndIF(parm.CustomerGuid != 0, s => s.CustomerGuid == parm.CustomerGuid);
|
||||
|
||||
var query = _HistorySearchRepository
|
||||
.Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderBy(s => s.Create_time, OrderByType.Desc)
|
||||
.Select(s => new HistorySearchVoApi
|
||||
{
|
||||
HistorySearchId = s.HistorySearchId,
|
||||
HistorySearchGuid = s.HistorySearchGuid,
|
||||
CustomerGuid = s.CustomerGuid,
|
||||
HistorySearchContent = s.HistorySearchContent,
|
||||
});
|
||||
|
||||
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取热门搜索列表(Api)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SearchTermCount>> GetHotSearchListApi()
|
||||
{
|
||||
// 获取当天开始和结束时间
|
||||
DateTime todayStart = DateTime.Today;
|
||||
DateTime todayEnd = todayStart.AddDays(1).AddSeconds(-1);
|
||||
|
||||
var predicate = Expressionable.Create<HistorySearch>();
|
||||
|
||||
var query = _HistorySearchRepository
|
||||
.Queryable()
|
||||
.Where(s => s.Create_time >= todayStart && s.Create_time <= todayEnd) // 仅选择当天的搜索记录
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderBy(s => s.Create_time, OrderByType.Desc)
|
||||
.Select(s => new HistorySearchVoApi
|
||||
{
|
||||
HistorySearchId = s.HistorySearchId,
|
||||
HistorySearchGuid = s.HistorySearchGuid,
|
||||
CustomerGuid = s.CustomerGuid,
|
||||
HistorySearchContent = s.HistorySearchContent,
|
||||
});
|
||||
|
||||
var searchTerms = await query.ToListAsync();
|
||||
|
||||
var searchTermCounts = searchTerms
|
||||
.GroupBy(s => s.HistorySearchContent)
|
||||
.Select(g => new SearchTermCount
|
||||
{
|
||||
SearchTerm = g.Key,
|
||||
Count = g.Count()
|
||||
})
|
||||
.OrderByDescending(g => g.Count) // 按照搜索次数降序排列
|
||||
.Take(20)
|
||||
.ToList();
|
||||
|
||||
return searchTermCounts;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加历史搜索
|
||||
/// </summary>
|
||||
public async Task<string> AddHistorySearch(HistorySearch model)
|
||||
{
|
||||
var response = await _HistorySearchRepository.InsertReturnSnowflakeIdAsync(model);
|
||||
return "添加成功!";
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Model.Dto.Api.Custom.HistorySearchs;
|
||||
using ARW.Model.Models.Business.Custom.HistorySearchs;
|
||||
using ARW.Model.Vo.Api.Custom.HistorySearchs;
|
||||
|
||||
namespace ARW.Service.Api.IBusinessService.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史搜索接口类Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public interface IHistorySearchServiceApi : IBaseService<HistorySearch>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取历史搜索分页列表(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<HistorySearchVoApi>> GetHistorySearchListApi(HistorySearchQueryDtoApi parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取热门搜索列表(Api)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<SearchTermCount>> GetHotSearchListApi();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加历史搜索
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AddHistorySearch(HistorySearch parm);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Infrastructure;
|
||||
using ARW.Model;
|
||||
using ARW.Repository;
|
||||
using ARW.Repository.Business.Custom.HistorySearchs;
|
||||
using ARW.Service.Business.IBusinessService.Custom.HistorySearchs;
|
||||
using ARW.Model.Dto.Business.Custom.HistorySearchs;
|
||||
using ARW.Model.Models.Business.Custom.HistorySearchs;
|
||||
using ARW.Model.Vo.Business.Custom.HistorySearchs;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史搜索接口实现类
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IHistorySearchService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class HistorySearchServiceImpl : BaseService<HistorySearch>, IHistorySearchService
|
||||
{
|
||||
private readonly HistorySearchRepository _HistorySearchRepository;
|
||||
|
||||
public HistorySearchServiceImpl(HistorySearchRepository HistorySearchRepository)
|
||||
{
|
||||
this._HistorySearchRepository = HistorySearchRepository;
|
||||
}
|
||||
|
||||
#region 业务逻辑代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询历史搜索分页列表
|
||||
/// </summary>
|
||||
public async Task<PagedInfo<HistorySearchVo>> GetHistorySearchList(HistorySearchQueryDto parm)
|
||||
{
|
||||
//开始拼装查询条件d
|
||||
var predicate = Expressionable.Create<HistorySearch>();
|
||||
|
||||
var query = _HistorySearchRepository
|
||||
.Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderBy(s => s.Create_time, OrderByType.Desc)
|
||||
.Select(s => new HistorySearchVo
|
||||
{
|
||||
HistorySearchId = s.HistorySearchId,
|
||||
HistorySearchGuid = s.HistorySearchGuid,
|
||||
CustomerGuid = s.CustomerGuid,
|
||||
HistorySearchContent = s.HistorySearchContent,
|
||||
});
|
||||
|
||||
|
||||
return await query.ToPageAsync(parm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改历史搜索
|
||||
/// </summary>
|
||||
public async Task<string> AddOrUpdateHistorySearch(HistorySearch model)
|
||||
{
|
||||
if (model.HistorySearchId != 0)
|
||||
{
|
||||
var response = await _HistorySearchRepository.UpdateAsync(model);
|
||||
return "修改成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var response = await _HistorySearchRepository.InsertReturnSnowflakeIdAsync(model);
|
||||
return "添加成功!";
|
||||
}
|
||||
}
|
||||
|
||||
#region Excel处理
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Model.Dto.Business.Custom.HistorySearchs;
|
||||
using ARW.Model.Models.Business.Custom.HistorySearchs;
|
||||
using ARW.Model.Vo.Business.Custom.HistorySearchs;
|
||||
|
||||
namespace ARW.Service.Business.IBusinessService.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史搜索接口类
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public interface IHistorySearchService : IBaseService<HistorySearch>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取历史搜索分页列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<PagedInfo<HistorySearchVo>> GetHistorySearchList(HistorySearchQueryDto parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改历史搜索
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AddOrUpdateHistorySearch(HistorySearch parm);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Common;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Dto.Api.Custom.HistorySearchs;
|
||||
using ARW.Service.Api.IBusinessService.Custom.HistorySearchs;
|
||||
using ARW.Model.Models.Business.Custom.HistorySearchs;
|
||||
using ARW.Model.Vo.Api.Custom.HistorySearchs;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Geocoding;
|
||||
using ARW.Model.Dto.Business.Custom.HistorySearchs;
|
||||
using ARW.Service.Business.IBusinessService.Custom.HistorySearchs;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.Custom.HistorySearchs
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史搜索控制器Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("api/[controller]")]
|
||||
public class HistorySearchApiController : BaseController
|
||||
{
|
||||
private readonly IHistorySearchServiceApi _HistorySearchServiceApi;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="HistorySearchServiceApi">历史搜索历史搜索Api服务</param>
|
||||
public HistorySearchApiController(IHistorySearchServiceApi HistorySearchServiceApi)
|
||||
{
|
||||
_HistorySearchServiceApi = HistorySearchServiceApi;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取历史搜索列表(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getHistorySearchList")]
|
||||
public async Task<IActionResult> GetHistorySearchListApi([FromQuery] HistorySearchQueryDtoApi parm)
|
||||
{
|
||||
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
||||
parm.CustomerGuid = user.UserId;
|
||||
var res = await _HistorySearchServiceApi.GetHistorySearchListApi(parm);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取热门搜索列表(Api)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getHotSearchList")]
|
||||
public async Task<IActionResult> GetHotSearchListApi()
|
||||
{
|
||||
var res = await _HistorySearchServiceApi.GetHotSearchListApi();
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加历史搜索
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addHistorySearch")]
|
||||
[Log(Title = "添加历史搜索", BusinessType = BusinessType.ADDORUPDATE)]
|
||||
public async Task<IActionResult> AddHistorySearch([FromBody] HistorySearchDto parm)
|
||||
{
|
||||
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||
|
||||
var modal = parm.Adapt<HistorySearch>().ToCreate(HttpContext);
|
||||
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
||||
modal.CustomerGuid = user.UserId;
|
||||
|
||||
var res = await _HistorySearchServiceApi.AddHistorySearch(modal);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除历史搜索
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[Log(Title = "历史搜索删除", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult Delete(string ids)
|
||||
{
|
||||
long[] idsArr = Tools.SpitLongArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
var response = _HistorySearchServiceApi.Delete(idsArr);
|
||||
return SUCCESS("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user