Beispiel #1
0
        /// <summary>
        /// 保存快递100回调的物流信息
        /// </summary>
        /// <param name="model"></param>
        public void SaveExpressData(OrderExpressInfo model)
        {
            var m = Context.OrderExpressInfo.Where(a => a.CompanyCode == model.CompanyCode && a.ExpressNumber == model.ExpressNumber).FirstOrDefault();

            if (m != null)
            {
                m.DataContent = model.DataContent;
            }
            else
            {
                Context.OrderExpressInfo.Add(model);
            }
            Context.SaveChanges();
        }
 public JsonResult SaveExpressData(string param)
 {
     if (string.IsNullOrEmpty(param))
     {
         return(Json(new { result = false, returnCode = 500, message = "服务器错误" }));
     }
     try
     {
         var ReturnModel = new
         {
             status     = string.Empty,
             message    = string.Empty,
             lastResult = new
             {
                 message = string.Empty,
                 state   = string.Empty,
                 status  = string.Empty,
                 ischeck = string.Empty,
                 com     = string.Empty,
                 nu      = string.Empty
             }
         };
         var obj = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(param, ReturnModel);
         OrderExpressInfo model = new OrderExpressInfo();
         model.DataContent   = param;
         model.CompanyCode   = obj.lastResult.com;
         model.ExpressNumber = obj.lastResult.nu;
         _iExpressService.SaveExpressData(model);
         return(Json(new { result = true, returnCode = 200, message = "成功" }));
     }
     catch (Exception ex)
     {
         Core.Log.Error("保存快递信息错误:" + ex.Message + param);
         return(Json(new { result = false, returnCode = 500, message = "服务器错误" + ex.Message }));
     }
 }