Exemplo n.º 1
0
        public JsonResult dadaOrderNotify(long order_id, int order_status, string client_id, string cancel_reason
                                          , int?cancel_from, int?update_time, string signature, int?dm_id, string dm_name, string dm_mobile)
        {
            Core.Log.Error("快递信息回调:" + order_id + "_" + order_status + "_" + client_id);
            var order = OrderApplication.GetOrder(order_id);

            if (order != null || order_status != 0)
            {
                if (order_status == (int)DadaStatus.Cancel)
                {
                    ExpressDaDaApplication.SetOrderCancel(order_id, cancel_reason);
                }
                else if (order_status == (int)DadaStatus.WaitTake)
                {
                    ExpressDaDaApplication.SetOrderWaitTake(order_id, client_id);
                    OrderApplication.SendMessageOnOrderShipping(order_id);  //发送发货消息
                }
                else if (order_status == (int)DadaStatus.Finished)
                {
                    ExpressDaDaApplication.SetOrderFinished(order_id);
                }
                //Core.Log.Error("快递信息回调已进入调用处理:" + order_id + "_" + order_status + "_" + client_id);
                ExpressDaDaApplication.SetOrderDadaStatus(order_id, order_status, client_id);
            }
            return(Json(new { }));
        }
        public object GetCancelDadaExpress(long orderId, int reasonId, string cancelReason)
        {
            CheckUserLogin();
            long shopid = CurrentShopBranch.ShopId;
            long sbid   = CurrentUser.ShopBranchId;
            var  order  = OrderApplication.GetOrder(orderId);

            if (order == null || order.ShopBranchId != sbid || order.OrderStatus != Entities.OrderInfo.OrderOperateStatus.WaitReceiving || order.DeliveryType != DeliveryType.CityExpress)
            {
                throw new HimallApiException("错误的订单编号");
            }
            if (order.DadaStatus > DadaStatus.WaitTake.GetHashCode())
            {
                throw new HimallApiException("订单配送不可取消!");
            }
            var    sbdata    = ShopBranchApplication.GetShopBranchById(sbid);
            string json      = ExpressDaDaHelper.orderFormalCancel(shopid, orderId.ToString(), reasonId, cancelReason);
            var    resultObj = JsonConvert.DeserializeObject(json) as JObject;
            string status    = resultObj["status"].ToString();

            if (status != "success")
            {
                throw new HimallApiException(resultObj["msg"].ToString());
            }
            ExpressDaDaApplication.SetOrderCancel(orderId, "商家主动取消");
            var result = JsonConvert.DeserializeObject(resultObj["result"].ToString()) as JObject;

            return(new
            {
                success = true,
                deduct_fee = result["deduct_fee"].ToString()
            });
        }