Beispiel #1
0
        public async Task <IActionResult> GetMyReplyPageAsync([FromQuery] GetMyReplyPageRequestDto request)
        {
            var response = await new FaqsQuestionBiz().GetMyReplyPageAsync(request, UserID);
            var users    = await new UserExBiz().GetListAsync(response.CurrentPage.Select(a => a.UserGuid));

            foreach (var item in response.CurrentPage)
            {
                item.UserName = users.FirstOrDefault(a => a.UserGuid == item.UserGuid)?.UserName;
            }
            return(Success(response));
        }
Beispiel #2
0
        public async Task <GetFaqsQuestionPageResponseDto> GetMyReplyPageAsync(GetMyReplyPageRequestDto request, string userid)
        {
            var sqlWhere = $@"AND a.enable=1";

            if (request.BeginDate != null)
            {
                request.BeginDate = request.BeginDate?.Date;
                sqlWhere          = $"{sqlWhere} AND a.creation_date > @BeginDate";
            }
            if (request.EndDate != null)
            {
                request.EndDate = request.EndDate?.AddDays(1).Date;
                sqlWhere        = $"{sqlWhere} AND a.creation_date < @EndDate";
            }
            var sql = $@"
SELECT DISTINCT
	a.question_guid,
	a.user_guid,
	a.reward_intergral,
	a.`status`,
	a.answer_num,
	a.content,
	a.attachment_guid_list,
	a.creation_date,
	a.ENABLE,
    c.visit_count,
    c.like_count
FROM
	t_faqs_question a
	LEFT JOIN t_faqs_answer b ON a.question_guid = b.question_guid 
	LEFT JOIN t_utility_hot c ON a.question_guid = c.owner_guid 
WHERE
	1 = 1 {sqlWhere} and b.user_guid = '{userid}'
ORDER BY
	a.creation_date desc"    ;

            return(await MySqlHelper.QueryByPageAsync <GetMyReplyPageRequestDto, GetFaqsQuestionPageResponseDto, GetFaqsQuestionPageItemDto>(sql, request));
        }