/// <summary> /// 支付宝创建订单 /// 窦海超 /// 2015年5月12日 14:36:42 /// </summary> /// <param name="model"></param> /// <returns></returns> public dynamic ReturnAlipay() { var error = new { is_success = "F", error_code = "PARAM_ILLEGAL" }; try { var request = System.Web.HttpContext.Current.Request; string goods_id = request["goods_id"]; if (string.IsNullOrEmpty(goods_id) || !goods_id.Contains("_")) { LogHelper.LogWriter("订单编号为null"); return(error); } int productId = ParseHelper.ToInt(goods_id.Split('_')[0], 0); //产品ID int orderId = ParseHelper.ToInt(goods_id.Split('_')[1], 0); //主订单号 int orderChildId = ParseHelper.ToInt(goods_id.Split('_')[2], 0); //子订单号 if (orderId <= 0 || orderChildId <= 0) { LogHelper.LogWriter("订单号或子订单号为零"); return(error); } PayStatusModel payStatusModel = orderChildDao.GetPayStatus(orderId, orderChildId); if (payStatusModel == null || payStatusModel.PayStatus == PayStatusEnum.HadPay.GetHashCode())//判断当前订单号是否存在,是否为已完成 { return(error); } //变更为支付中 if (orderChildDao.ZhuFuZhongPayStatus(orderId, orderChildId)) { return(new { is_success = "T", out_trade_no = goods_id }); } } catch (Exception ex) { LogHelper.LogWriter(ex, "alipay自动回调异常"); } return(error); }