Exemplo n.º 1
0
        public async Task <ResponseMessage <List <GiftInfo> > > GetConsumableGift(Models.UserInfo user, [FromRoute] string periodId)
        {
            Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})抽奖/兑奖-奖品列表,请求参数为:periodId{periodId}");
            var response = new ResponseMessage <List <GiftInfo> >();

            if (string.IsNullOrWhiteSpace(periodId))
            {
                response.Code    = ResponseCodeDefines.ArgumentNullError;
                response.Message = "periodId不能为空";
                return(response);
            }
            try
            {
                response = await _giftManager.GetConsumableGiftAsync(user, periodId, 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);
        }