public ActionResult notis(OrderReponseModel orderform) { log4net.LogHelper.WriteInfo(this.GetType(), "达达配送回调json:" + JsonConvert.SerializeObject(orderform)); object ten3 = new { client_id = orderform.client_id, order_id = orderform.order_id, update_time = orderform.update_time }; string signature = _dadaApi.GetSignatureR(ten3); if (orderform.signature != signature) { log4net.LogHelper.WriteInfo(this.GetType(), "达达配送回调签名错误json:" + JsonConvert.SerializeObject(orderform)); } else { log4net.LogHelper.WriteInfo(this.GetType(), "达达配送回调签名正确json:" + JsonConvert.SerializeObject(orderform)); } return(Content("success")); }
/// <summary> /// 达达订单状态改变回调接口 /// </summary> /// <param name="orderform"></param> /// <returns></returns> public ActionResult Dadanotis(OrderReponseModel orderform) { if (orderform == null) { LogHelper.WriteInfo(this.GetType(), "达达订单回调请求参数为空"); return(Content("fail")); } DadaOrder order = _dadaOrderBLL.GetModelByOrderNo(orderform.order_id); if (order == null) { LogHelper.WriteInfo(this.GetType(), $"达达订单回调:找不到订单【{orderform.order_id}】"); } //如果状态一样,说明已发送过一次 if (order.state == orderform.order_status) { return(Content("success")); } order.state = orderform.order_status; order.update_time = _dadaApi.GetDateTimeByStamp(orderform.update_time); order.cancel_from = orderform.cancel_from; order.cancel_reason = orderform.cancel_reason; order.dm_id = orderform.dm_id; order.dm_mobile = orderform.dm_mobile; order.dm_name = orderform.dm_name; DadaOrderRelation oRelationModel = DadaOrderRelationBLL.SingleModel.GetModelUOrderNo(order.origin_id); if (oRelationModel == null) { LogHelper.WriteInfo(this.GetType(), "达达配送回调查询达达订单管理数据出错:" + order.origin_id); return(Content("fail")); } XcxAppAccountRelation xcxrelation = _xcxAppAccountRelationBLL.GetModel(oRelationModel.dataid); if (xcxrelation == null) { LogHelper.WriteInfo(this.GetType(), "达达配送回调查询权限表:没有找到ID【" + oRelationModel.dataid + "】数据"); return(Content("fail")); } bool isSuccess = false; try { lock (_dadaLock) { switch (oRelationModel.ordertype) { case (int)TmpType.小程序餐饮模板: isSuccess = _dadaOrderBLL.DadaToFoodReturn(oRelationModel.orderid, order, xcxrelation.AppId); break; case (int)TmpType.智慧餐厅: isSuccess = _dadaOrderBLL.DadaToMutilFoodReturn(oRelationModel.orderid, order, xcxrelation.AppId); break; } } } catch (Exception ex) { LogHelper.WriteInfo(this.GetType(), "达达配送回调异常:" + JsonConvert.SerializeObject(orderform) + ex.Message); } return(Content("success")); }