Exemplo n.º 1
0
 public HttpResponseMessage GetOrderReward([FromBody] CC_OrderReward OrderReward)
 {
     try
     {
         var db     = new RedisOperation(_RedisDB);
         var key    = RedisKeys.CCOrderReward(OrderReward.CustomerID);
         var result = db.SelectListQueue <CC_OrderReward>(key);  //队列按照先进先出的原则,左边进右边出
         if (result.CustomerID.IsNullStr() || result.LogSession == null || result.OrderInfo == null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel
             {
                 Code = ResponseCode.DataNotFound,
                 Message = "success"
             }));
         }
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel <CC_OrderReward>
         {
             Code = ResponseCode.Success,
             Message = "success",
             Result = result
         }));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel
         {
             Code = ResponseCode.Fail,
             Message = "fail:" + ex.Message
         }));
     }
 }
Exemplo n.º 2
0
 public HttpResponseMessage SetOrderReward([FromBody] CC_OrderReward OrderReward)  //调用的地方传过来的是json字符串,默认就转化过来了
 {
     try
     {
         var db  = new RedisOperation(_RedisDB);
         var key = RedisKeys.CCOrderReward(OrderReward.CustomerID); //获取相关的键
         db.InsertListQueue(key, OrderReward);                      //插入数据
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel
         {
             Code = ResponseCode.Success,
             Message = "success"
         }));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel
         {
             Code = ResponseCode.Fail,
             Message = "fail:" + ex.Message
         }));
     }
 }
Exemplo n.º 3
0
 public HttpResponseMessage GetOrderRewardLength([FromBody] CC_OrderReward OrderReward)
 {
     try
     {
         var db     = new RedisOperation(_RedisDB);
         var key    = RedisKeys.CCOrderReward(OrderReward.CustomerID);
         var result = db.GetListLength(key);
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel <long>
         {
             Code = ResponseCode.Success,
             Message = "success",
             Result = result
         }));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel
         {
             Code = ResponseCode.Fail,
             Message = "fail:" + ex.Message
         }));
     }
 }