コード例 #1
0
        /// <summary>
        /// 获取问答热门问题分页列表
        /// </summary>
        /// <param name="requestDto"></param>
        /// <returns></returns>
        public async Task <GetHotFAQsResponseDto> GetHotFAQsPageListAsync(GetHotFAQsRequestDto requestDto)
        {
            var wheresql = "";

            if (requestDto.LatestDay != 0)
            {
                wheresql = "and a.creation_date>DATE_SUB(NOW(),INTERVAL @LatestDay DAY) ";
            }
            if (!string.IsNullOrWhiteSpace(requestDto.Keyword))
            {
                wheresql           = "and a.content like @Keyword ";
                requestDto.Keyword = $"%{requestDto.Keyword}%";
            }
            var sql    = $@"SELECT
	                        a.question_guid,
	                        a.content,
	                        a.creation_date,
	                        a.answer_num,
	                        a.`status`,
	                        ifnull( b.visit_count, 0 ) AS visit_count 
                        FROM
	                        t_faqs_question a
	                        LEFT JOIN t_utility_hot b ON a.question_guid = b.owner_guid 
	                    WHERE a.`enable`=1 {wheresql}
                        ORDER BY
	                        b.visit_count DESC"    ;
            var result = await MySqlHelper.QueryByPageAsync <GetHotFAQsRequestDto, GetHotFAQsResponseDto, GetHotFAQsItemDto>(sql, requestDto);

            return(result);
        }
コード例 #2
0
        public async Task <IActionResult> GetHotFAQsPageListAsync([FromQuery] GetHotFAQsRequestDto requestDto)
        {
            var response = await new FaqsQuestionBiz().GetHotFAQsPageListAsync(requestDto);

            return(Success(response));
        }