Exemple #1
0
        /// <summary>
        /// 异步获取信息,并发送给客户端
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public async Task getMessageAsy(string userId)
        {
            try
            {
                string messageList = await _messageSer.MessageShorById(userId);

                //查看是否有数据
                if (string.IsNullOrEmpty(messageList))
                {
                    return;
                }
                //这里是用集合的方式发送给前端,所以造成以后单条的也要集合方式发送给前端。。。
                await sendByClient(userId, messageList);
            }
            catch (Exception ex)
            {
                _logger.LogError("发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException);
            }
        }
 public async Task <BaseResponse> TestPost()
 {
     return(BaseResponse.GetBaseResponse(BusinessStatusType.OK, await _messageSer.MessageShorById("105")));
     //return await Task.Run(() => { return BaseResponse.GetBaseResponse(BusinessStatusType.OK); });
 }