Exemple #1
0
        /// <summary>
        /// 取消抢票
        /// </summary>
        /// <param name="cancelTraGrabTicketModel"></param>
        /// <returns></returns>
        public CancelTraGrabTicketResultModel CancelTraGrabTicket(CancelTraGrabTicketModel cancelTraGrabTicketModel)
        {
            TraGrabTicketEntity traGrabTicketEntity =
                _traGrabTicketDal.Find <TraGrabTicketEntity>(cancelTraGrabTicketModel.GrabId);

            if (traGrabTicketEntity == null)
            {
                throw new Exception("未找到抢票信息");
            }
            //请求取消接口
            GrabTicketCancelResponseModel grabTicketCancelResponseModel =
                _requestGrabTicketCancelBll.CancelGrabTicket(new GrabTicketCancelRequestModel()
            {
                qorderid = traGrabTicketEntity.OrderId.ToString()
            });

            CancelTraGrabTicketResultModel cancelTraGrabTicketResultModel = new CancelTraGrabTicketResultModel();

            if (!grabTicketCancelResponseModel.isSuccess)
            {
                cancelTraGrabTicketResultModel.IsSuccess = false;
                cancelTraGrabTicketResultModel.Message   = grabTicketCancelResponseModel.msg;
            }
            else
            {
                cancelTraGrabTicketResultModel.IsSuccess = true;
                traGrabTicketEntity.GrabStatus           = "C";
                _traGrabTicketDal.Update(traGrabTicketEntity);
            }

            return(cancelTraGrabTicketResultModel);
        }
Exemple #2
0
        public GrabTicketCancelResponseModel CancelGrabTicket(GrabTicketCancelRequestModel request)
        {
            try
            {
                string postData = JsonConvert.SerializeObject(request);
                postData = "jsonStr=" + postData;
                LogHelper.WriteLog("请求取消抢票接口:" + postData, "TraGrabTicketCallBack");
                string responseData = PostHelper.PostUrl(Url, postData, Encoding.UTF8);
                LogHelper.WriteLog("取消抢票接口同步响应:" + responseData, "TraGrabTicketCallBack");
                if (string.IsNullOrEmpty(responseData))
                {
                    return new GrabTicketCancelResponseModel()
                           {
                               msg       = "请求接口失败",
                               isSuccess = false,
                               code      = "-1"
                           }
                }
                ;

                GrabTicketCancelResponseModel responseModel = JsonConvert.DeserializeObject <GrabTicketCancelResponseModel>(responseData);
                return(responseModel);
            }
            catch (Exception ex)
            {
                return(new GrabTicketCancelResponseModel()
                {
                    msg = ex.Message,
                    isSuccess = false,
                    code = "-1"
                });
            }
        }