Exemplo n.º 1
0
        public async Task <PagingResponseMessage <LotteryMyBetResponse> > LotteryMyBet(Models.UserInfo user, [FromBody] LotteryMyBetRequest request)
        {
            Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})查询我的投注列表,请求参数为:\r\n" + (request != null ? JsonHelper.ToJson(request) : ""));
            var response = new PagingResponseMessage <LotteryMyBetResponse>();

            if (!ModelState.IsValid)
            {
                response.Code    = ResponseCodeDefines.ArgumentNullError;
                response.Message = "模型验证失败" + ModelState.GetAllErrors();
                Logger.Warn("查询我的投注列表,模型验证失败:\r\n{0}", response.Message ?? "");
                return(response);
            }
            try
            {
                response = await _giftManager.LotteryMyBetAsync(user, request, HttpContext.RequestAborted);
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = e.Message;
                Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})查询我的投注列表,报错:{e.Message}\r\n{e.StackTrace}");
            }
            return(response);
        }