/// <summary> /// 搜索文章 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <SearchArticleResponseDto> SearchArticleAsync(SearchArticleRequestDto request) { var sqlWhere = $@"AND ENABLE = 1 AND visible = 1"; if (!string.IsNullOrWhiteSpace(request.Keyword)) { sqlWhere = $"{sqlWhere} AND (title like @Keyword OR abstract like @Keyword)"; } var sql = $@" SELECT * FROM( SELECT A.*, CONCAT( B.base_path, B.relative_path ) AS PictureUrl FROM t_utility_article A LEFT JOIN t_utility_accessory B ON B.accessory_guid = A.picture_guid ) T WHERE 1 = 1 {sqlWhere} ORDER BY creation_date Desc "; request.Keyword = $"%{request.Keyword}%"; return(await MySqlHelper.QueryByPageAsync <SearchArticleRequestDto, SearchArticleResponseDto, SearchArticleItemDto>(sql, request)); }
public async Task <IActionResult> SearchArticleAsync([FromBody] SearchArticleRequestDto requestDto) { CommonBiz commonBiz = new CommonBiz(); if (!string.IsNullOrEmpty(UserID)) { commonBiz.SearchHistory(UserID, requestDto.Keyword); } commonBiz.HotWordSearch(requestDto.Keyword); var response = await new ConsumerBiz().SearchArticleAsync(requestDto); return(Success(response)); }
public async Task <IActionResult> SearchArticleAsync([FromBody] SearchArticleRequestDto requestDto) { var response = await new ArticleBiz().SearchArticleAsync(requestDto); return(Success(response)); }