/// <summary> /// 发起退款 /// </summary> /// <returns></returns> public ActionResult OutOrder() { int appId = Context.GetRequestInt("appId", 0); if (appId <= 0) { return(Json(new { isok = false, msg = "系统繁忙appid_null" }, JsonRequestBehavior.AllowGet)); } if (dzaccount == null) { return(Json(new { isok = false, msg = "系统繁忙auth_null" })); } var appAcountRelation = XcxAppAccountRelationBLL.SingleModel.GetModel($"id ={appId}"); if (appAcountRelation == null) { return(Json(new { isok = false, msg = "系统繁忙relation_null" })); } int storeId = Context.GetRequestInt("storeid", -1); if (storeId < 0) { return(Json(new { isok = false, msg = "系统繁忙storeId_null" })); } string storeSqlwhere = $"appid={appId}"; if (storeId > 0) { storeSqlwhere = $"id={storeId}"; } FootBath storeModel = FootBathBLL.SingleModel.GetModel(storeSqlwhere); if (storeModel == null) { return(Json(new { isok = false, msg = "系统繁忙model_null" })); } int orderId = Context.GetRequestInt("orderId", 0); if (orderId <= 0) { return(Json(new { isok = false, msg = "系统繁忙orderId_null" })); } EntGoodsOrder orderInfo = EntGoodsOrderBLL.SingleModel.GetModel($"aId={storeModel.appId} and id={orderId}"); if (orderInfo == null) { return(Json(new { isok = false, msg = "系统繁忙order_null" })); } List <EntGoodsCart> goodscarts = EntGoodsCartBLL.SingleModel.GetList($"GoodsOrderId={orderInfo.Id}"); bool isok = EntGoodsOrderBLL.SingleModel.outOrder(goodscarts, storeModel, orderInfo); string msg = "操作失败"; if (isok) { msg = "操作成功"; var data = TemplateMsg_Miniapp.MutilStoreGetTemplateMessageData(orderInfo, SendTemplateMessageTypeEnum.多门店退款通知); TemplateMsg_Miniapp.SendTemplateMessage(orderInfo.UserId, SendTemplateMessageTypeEnum.多门店退款通知, TmpType.小程序多门店模板, data); } return(Json(new { isok = isok, msg = msg })); }
/// <summary> /// 修改订单状态 /// </summary> /// <returns></returns> public ActionResult updateState() { int appId = Context.GetRequestInt("appId", 0); if (appId <= 0) { return(Json(new { isok = false, msg = "系统繁忙appid_null" }, JsonRequestBehavior.AllowGet)); } if (dzaccount == null) { return(Json(new { isok = false, msg = "系统繁忙auth_null" })); } var appAcountRelation = XcxAppAccountRelationBLL.SingleModel.GetModel($"id ={appId}"); if (appAcountRelation == null) { return(Json(new { isok = false, msg = "系统繁忙relation_null" })); } int storeId = Context.GetRequestInt("storeid", -1); if (storeId < 0) { return(Json(new { isok = false, msg = "系统繁忙storeId_null" })); } string storeSqlwhere = $"appid={appId}"; if (storeId > 0) { storeSqlwhere = $"id={storeId}"; } FootBath storeModel = FootBathBLL.SingleModel.GetModel(storeSqlwhere); if (storeModel == null) { return(Json(new { isok = false, msg = "系统繁忙model_null" })); } string msg = "操作失败"; bool isok = false; int state = Context.GetRequestInt("state", -999); int orderId = Context.GetRequestInt("id", 0); if (orderId <= 0) { return(Json(new { isok = false, msg = "系统繁忙orderId_null" })); } EntGoodsOrder orderInfo = EntGoodsOrderBLL.SingleModel.GetModel($"aId={appId} and id={orderId}"); if (orderInfo == null) { return(Json(new { isok = false, msg = "系统繁忙order_null" })); } SendTemplateMessageTypeEnum templateType = new SendTemplateMessageTypeEnum(); switch (state) { case (int)MiniAppEntOrderState.已取消: templateType = SendTemplateMessageTypeEnum.多门店订单取消通知; orderInfo.State = (int)MiniAppEntOrderState.已取消; break; case (int)MiniAppEntOrderState.待接单: templateType = SendTemplateMessageTypeEnum.多门店反馈处理结果通知; orderInfo.State = (int)MiniAppEntOrderState.待接单; break; case (int)MiniAppEntOrderState.待配送: templateType = SendTemplateMessageTypeEnum.多门店订单确认通知; orderInfo.State = (int)MiniAppEntOrderState.待配送; break; case (int)MiniAppEntOrderState.待确认送达: templateType = SendTemplateMessageTypeEnum.多门店订单配送通知; orderInfo.State = (int)MiniAppEntOrderState.待确认送达; break; case (int)MiniAppEntOrderState.交易成功: if (orderInfo.GetWay == (int)multiStoreOrderType.城配送) { templateType = SendTemplateMessageTypeEnum.多门店订单配送通知; } orderInfo.AcceptDate = DateTime.Now; orderInfo.State = (int)MiniAppEntOrderState.交易成功; break; case (int)MiniAppEntOrderState.待收货: templateType = SendTemplateMessageTypeEnum.多门店订单发货提醒; orderInfo.State = (int)MiniAppEntOrderState.待收货; break; } isok = EntGoodsOrderBLL.SingleModel.Update(orderInfo, "state,AcceptDate"); if (isok) { if (state == (int)MiniAppEntOrderState.交易成功) { VipRelationBLL.SingleModel.updatelevel(orderInfo.UserId, "multistore"); } msg = "操作成功"; var data = TemplateMsg_Miniapp.MutilStoreGetTemplateMessageData(orderInfo, templateType); TemplateMsg_Miniapp.SendTemplateMessage(orderInfo.UserId, templateType, TmpType.小程序多门店模板, data); } return(Json(new { isok = isok, msg = msg })); }