コード例 #1
0
        /// <summary>
        /// 获取消息记录列表
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">单页条数</param>
        /// <param name="userOneId">用户一guid</param>
        /// <param name="userTwoId">用户二guid</param>
        /// <param name="topicAboutType">主题相关类型</param>
        public async Task <GetMessageListByFromAndToResponseDto> GetMessageListByFromAndToAsync(GetMessageListByFromAndToRequestDto requestDto)
        {
            var whereSql = "";

            if (!string.IsNullOrWhiteSpace(requestDto.Keyword))
            {
                requestDto.Keyword = $"%{requestDto.Keyword}%";
                whereSql           = "and a.context like @Keyword";
            }
            var sql = $@"SELECT
	                    a.from_guid,
	                    a.to_guid,
	                    a.context,
	                    a.creation_date 
                    FROM
	                    t_utility_message a
	                    INNER JOIN t_utility_topic topic ON a.topic_guid = topic.topic_guid 
                    WHERE
	                    topic.about_type = @TopicAbountType 
                        AND a.`enable`=1 and topic.`enable`=1
	                    AND (( from_guid = @UserOneId AND to_guid = @UserTwoId ) 
	                    OR ( from_guid = @UserTwoId AND to_guid = @UserOneId ) )
                        {whereSql}
                    ORDER BY
	                    a.creation_date DESC "    ;

            return(await MySqlHelper.QueryByPageAsync <GetMessageListByFromAndToRequestDto, GetMessageListByFromAndToResponseDto, GetMessageListByFromAndToItemDto>(sql, requestDto));
        }
コード例 #2
0
        public async Task <IActionResult> GetMessageListByFromAndToAsync([FromBody] GetMessageListByFromAndToRequestDto requestDto)
        {
            var response = await new ConsumerBiz().GetMessageListByFromAndToAsync(requestDto);

            return(Success(response));
        }