/// <summary> /// 多门店退款 /// </summary> /// <param name="orderInfo"></param> /// <returns></returns> public bool MultiStoreReFundQueue(List <EntGoodsCart> goodsCar, FootBath storeMaterial, EntGoodsOrder orderInfo) { bool result = false; orderInfo.outOrderDate = DateTime.Now; orderInfo.State = (int)MiniAppEntOrderState.退款中; if (orderInfo.BuyMode == (int)miniAppBuyMode.微信支付) { try { if (orderInfo.BuyPrice == 0) { orderInfo.State = (int)MiniAppEntOrderState.退款成功; EntGoodsOrderBLL.SingleModel.Update(orderInfo, "State,outOrderDate"); } else { CityMorders order = _cityMordersBLL.GetModel(orderInfo.OrderId); orderInfo.State = (int)MiniAppEntOrderState.退款中; if (order == null) { orderInfo.State = (int)MiniAppEntOrderState.退款失败; EntGoodsOrderBLL.SingleModel.Update(orderInfo, "State,outOrderDate"); return(result); } //微信支付 ReFundQueue reModel = new ReFundQueue { minisnsId = -5, money = orderInfo.BuyPrice, orderid = order.Id, traid = order.trade_no, addtime = DateTime.Now, note = "小程序多门店退款", retype = 1 }; base.Add(reModel); } TransactionModel tranModel = new TransactionModel(); tranModel.Add(EntGoodsOrderBLL.SingleModel.BuildUpdateSql(orderInfo, "State,outOrderDate")); if (!EntGoodsOrderBLL.SingleModel.HandleStockSql_MultiStore(goodsCar, storeMaterial, tranModel, -1)) { log4net.LogHelper.WriteInfo(GetType(), "生成库存处理sql失败 HandleStockSql_MultiStore_error"); return(false); } result = ExecuteTransactionDataCorect(tranModel.sqlArray, tranModel.ParameterArray); return(result); } catch (Exception ex) { log4net.LogHelper.WriteInfo(GetType(), $"{ex.Message} xxxxxxxxxxxxxxxx小程序多门店退款订单插入队列失败 ID={orderInfo.Id}"); log4net.LogHelper.WriteError(GetType(), ex); } } return(result); }
/// <summary> /// 微信支付 /// </summary> /// <param name="orderObj"></param> /// <param name="cityMorder"></param> /// <returns></returns> public object PayOrder(object orderObj, CityMorders cityMorder, TransactionModel tran, ref int orderId) { CityMordersBLL cityMordersBLL = new CityMordersBLL(); QiyeGoodsOrder order = (QiyeGoodsOrder)orderObj; cityMorder.payment_free = order.BuyPrice; if (tran == null || tran.sqlArray.Count() <= 0) { log4net.LogHelper.WriteInfo(this.GetType(), "独立模板生成订单失败,sql为空"); return(""); } TransactionModel tranModel = new TransactionModel(); tranModel.Add(cityMordersBLL.BuildAddSql(cityMorder)); foreach (string sqlitem in tran.sqlArray) { tranModel.Add(sqlitem); } if (!ExecuteTransactionDataCorect(tranModel.sqlArray, tranModel.ParameterArray)) { log4net.LogHelper.WriteInfo(this.GetType(), "独立模板生成订单失败" + JsonConvert.SerializeObject(tran)); return(""); } QiyeStore store = QiyeStoreBLL.SingleModel.GetModel(order.StoreId); if (store != null) { //清除商品缓存 QiyeGoodsBLL.SingleModel.RemoveEntGoodListCache(store.Aid); } order = GetModelByOrderNum(order.OrderNum); if (order == null) { log4net.LogHelper.WriteInfo(this.GetType(), $"独立模板生成订单失败,获取不到生成的订单【{order.OrderNum}】"); return(""); } if (order.OrderId <= 0) { log4net.LogHelper.WriteInfo(this.GetType(), "独立模板生成订单OrderId失败" + JsonConvert.SerializeObject(tranModel)); return(""); } cityMorder.Id = order.OrderId; orderId = order.OrderId; //为0不需进入生成微信预支付订单的流程(免费订单) if (order.BuyPrice == 0) { PayResult payresult = new PayResult(); new CityMordersBLL(payresult, cityMorder).QiyePayOrder(0, order); return(new { orderid = order.Id, dbOrder = order.Id }); } else //生成微信预支付订单 { return(new { orderid = order.OrderId, dbOrder = order.Id }); } }
/// <summary> /// 订单退款 /// </summary> /// <param name="orderId"></param> /// <returns></returns> public bool FoodReFundQueue(FoodGoodsOrder item, int oldState) { item.State = (int)miniAppFoodOrderState.退款中; item.outOrderDate = DateTime.Now; //重新加回库存 if (FoodGoodsOrderBLL.SingleModel.updateStock(item, oldState)) { try { //微信退款只在金额大于0的时候去插入申请队列,小于0时直接将状态改为退款成功,并将状态回滚 if (item.BuyPrice > 0) { CityMorders order = _cityMordersBLL.GetModel(item.OrderId); if (order == null) //找不到微信订单直接返回退款失败 { item.State = (int)miniAppFoodOrderState.退款失败; FoodGoodsOrderBLL.SingleModel.Update(item, "State,outOrderDate,Remark"); return(false); } ReFundQueue reModel = new ReFundQueue { minisnsId = -5, money = item.BuyPrice, orderid = order.Id, traid = order.trade_no, addtime = DateTime.Now, note = "小程序餐饮订单退款", retype = 1 }; base.Add(reModel); } else { item.State = (int)miniAppFoodOrderState.已退款; } FoodGoodsOrderBLL.SingleModel.Update(item, "State,outOrderDate,Remark"); } catch (Exception ex) { log4net.LogHelper.WriteInfo(GetType(), $"{ex.Message} xxxxxxxxxxxxxxxx小程序餐饮退款订单插入队列失败 ID={item.Id}"); } } else { return(false); } return(true); }
public int CreateWxOrder(PinGoodsOrder order, string userName) { int cityMorderId = 0; //citymorder表ID XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModel(order.aid); if (xcx == null) { return(cityMorderId); } string no = WxPayApi.GenerateOutTradeNo(); CityMorders citymorderModel = new CityMorders { OrderType = (int)ArticleTypeEnum.PinOrderPay, ActionType = (int)ArticleTypeEnum.PinOrderPay, Addtime = DateTime.Now, payment_free = order.money, trade_no = no, Percent = 99,//不收取服务费 userip = WebHelper.GetIP(), FuserId = order.userId, Fusername = userName, orderno = no, payment_status = 0, Status = 0, Articleid = 0, CommentId = order.id, //订单Id MinisnsId = order.aid, // 订单aId TuserId = order.storeId, ShowNote = $" {xcx.Title}购买商品支付{order.moneyStr}元", CitySubId = 0, //无分销,默认为0 PayRate = 1, buy_num = 0, //无 appid = xcx.AppId, }; cityMorderId = Convert.ToInt32(new CityMordersBLL().Add(citymorderModel)); return(cityMorderId); }
public int CreateOrder(DishCardAccountLog accountLog) { int cityMorderId = 0; if (accountLog == null) { return(cityMorderId); } XcxAppAccountRelation xcxAppAccount = XcxAppAccountRelationBLL.SingleModel.GetModel(accountLog.aId); if (xcxAppAccount == null) { return(cityMorderId); } string no = WxPayApi.GenerateOutTradeNo(); CityMorders cityMorder = new CityMorders() { OrderType = (int)ArticleTypeEnum.DishCardAccount, ActionType = (int)ArticleTypeEnum.DishCardAccount, Addtime = DateTime.Now, payment_free = (int)(accountLog.account_money * 100), trade_no = no, userip = WebHelper.GetIP(), FuserId = accountLog.user_id, orderno = no, payment_status = 0, Status = 0, Articleid = accountLog.id, MinisnsId = accountLog.aId, ShowNote = $"会员充值支付{accountLog.account_money}元", CitySubId = 0, PayRate = 1, buy_num = 0, appid = xcxAppAccount.AppId }; cityMorderId = Convert.ToInt32(new CityMordersBLL().Add(cityMorder)); return(cityMorderId); }
///// <summary> ///// 跟进 退款状态 (退款是否成功) ///// </summary> ///// <returns></returns> public bool FoodUpdateReFundQueueState() { TransactionModel tranModel = new TransactionModel(); List <FoodGoodsOrder> itemList = FoodGoodsOrderBLL.SingleModel.GetList($" State = {(int)miniAppFoodOrderState.退款中} and outOrderDate <= (NOW()-interval 17 second) ", 1000, 1) ?? new List <FoodGoodsOrder>(); List <CityMorders> orderList = new List <CityMorders>(); List <ReFundResult> outOrderList = new List <ReFundResult>(); if (itemList.Any()) { orderList = _cityMordersBLL.GetList($" Id in ({string.Join(",", itemList.Select(x => x.OrderId))}) ", 1000, 1) ?? new List <CityMorders>(); if (orderList.Any()) { outOrderList = RefundResultBLL.SingleModel.GetList($" transaction_id in ('{string.Join("','", orderList.Select(x => x.trade_no))}') and retype = 1") ?? new List <ReFundResult>(); itemList.ForEach(x => { CityMorders curOrder = orderList.Where(y => y.Id == x.OrderId).FirstOrDefault(); if (curOrder != null) { //退款是排程处理,故无法确定何时执行退款,而现阶段退款操作成败与否都会记录在系统内 ReFundResult curOutOrder = outOrderList.Where(y => y.transaction_id == curOrder.trade_no).FirstOrDefault(); if (curOutOrder != null && curOutOrder.result_code.Equals("SUCCESS")) { x.State = (int)miniAppFoodOrderState.已退款; tranModel.Add(FoodGoodsOrderBLL.SingleModel.BuildUpdateSql(x, "State")); } else if (curOutOrder != null && !curOutOrder.result_code.Equals("SUCCESS")) { x.State = (int)miniAppFoodOrderState.退款失败; tranModel.Add(FoodGoodsOrderBLL.SingleModel.BuildUpdateSql(x, "State")); } } }); } } return(ExecuteTransactionDataCorect(tranModel.sqlArray, tranModel.ParameterArray)); }
/// <summary> /// 修改下单金额,返回新的citymorders id /// </summary> public Int32 updateWxOrderMoney(int citymorderId, int price, ref string errorMsg) { int newOrderId = 0; CityMordersBLL citymordersBLL = new CityMordersBLL(); CityMorders buyMorder = citymordersBLL.GetModel(citymorderId); if (buyMorder == null) { errorMsg = "该订单的支付资料丢失,无法修改金额"; return(newOrderId); } //关闭原微信订单 bool isColseOrderSuccess = CloseCityMorder(buyMorder.Id, ref errorMsg); if (!isColseOrderSuccess) { return(newOrderId); } buyMorder.Status = -1; citymordersBLL.Update(buyMorder, "Status"); //开新单 buyMorder.trade_no = buyMorder.orderno = WxPayApi.GenerateOutTradeNo(); //生成新的订单号 buyMorder.payment_free = price; buyMorder.Status = 0; newOrderId = buyMorder.Id = Convert.ToInt32(citymordersBLL.Add(buyMorder)); if (buyMorder.Id <= 0) { errorMsg = "生成新的微信订单失败"; return(newOrderId); } return(newOrderId); }
public string saveMsg(string jsondata, int ordertype, int paytype, int aid, ref CityMorders order, int userId) { if (string.IsNullOrEmpty(jsondata)) { return("json参数错误"); } SaveCityMsgModel saveCityMsgModelJson = JsonConvert.DeserializeObject <SaveCityMsgModel>(jsondata); if (saveCityMsgModelJson == null) { return("null参数错误"); } double lng = 0.00; double lat = 0.00; //校验手机号码 //if (!Regex.IsMatch(saveCityMsgModelJson.phone, @"\d")|| saveCityMsgModelJson.phone.Length>11) // return "联系号码不符合"; if (string.IsNullOrEmpty(saveCityMsgModelJson.location)) { return("请填写地址"); } if (string.IsNullOrEmpty(saveCityMsgModelJson.msgDetail)) { return("发布信息不能为空"); } if (!double.TryParse(saveCityMsgModelJson.lng, out lng) || !double.TryParse(saveCityMsgModelJson.lat, out lat)) { return("地址坐标错误"); } if (saveCityMsgModelJson.msgType <= 0) { return("请选择信息类别"); } CityStoreBanner storebanner = CityStoreBannerBLL.SingleModel.getModelByaid(aid); if (storebanner == null) { return("商家配置异常"); } CityStoreUser cityStoreUser = CityStoreUserBLL.SingleModel.getCity_StoreUser(aid, userId); if (cityStoreUser != null && cityStoreUser.state != 0) { if (string.IsNullOrEmpty(storebanner.KeFuPhone)) { return("账户异常"); } else { return($"账户异常,请拨打电话({storebanner.KeFuPhone})联系客服"); } } CityMsg city_Msg = new CityMsg(); city_Msg.addTime = DateTime.Now; city_Msg.aid = aid; city_Msg.lat = saveCityMsgModelJson.lat; city_Msg.lng = saveCityMsgModelJson.lng; city_Msg.location = saveCityMsgModelJson.location; city_Msg.msgDetail = HttpUtility.HtmlEncode(saveCityMsgModelJson.msgDetail); city_Msg.msgTypeId = saveCityMsgModelJson.msgType; city_Msg.phone = saveCityMsgModelJson.phone; city_Msg.userId = userId; city_Msg.imgs = saveCityMsgModelJson.imgs; switch (storebanner.ReviewSetting) { case 0: //不需要审核 if (saveCityMsgModelJson.isTop == 0) { //不置顶消息 city_Msg.state = 1; city_Msg.Review = 0; } else { city_Msg.state = 0; //支付回成功调后再变更1 city_Msg.Review = 0; } break; case 1: //先审核后发布 city_Msg.state = 0; //审核通过后变为1 city_Msg.Review = 1; //审核通过后变为2 审核不通过变为-1 break; case 2: //先发布后审核 if (saveCityMsgModelJson.isTop == 0) { //不置顶消息 city_Msg.state = 1; city_Msg.Review = 1; //审核通过后变为2 审核不通过变为-1 } else { city_Msg.state = 0; //支付回成功调后再变更为1 city_Msg.Review = 1; //审核通过后变为2 审核不通过变为-1 } break; } if (saveCityMsgModelJson.isTop == 0) { //表示不置顶的消息 city_Msg.topDay = 0; city_Msg.topCostPrice = 0; int msgId = Convert.ToInt32(base.Add(city_Msg)); if (msgId <= 0) { return("发布信息异常"); } else { return(string.Empty); } } else { //表示置顶消息 需要 生成微信订单,然后微信支付,支付成功后回调将状态变为1可用 if (saveCityMsgModelJson.ruleId <= 0) { return("请选择置顶时间"); } CityStoreMsgRules _city_StoreMsgRules = CityStoreMsgRulesBLL.SingleModel.getCity_StoreMsgRules(aid, saveCityMsgModelJson.ruleId); if (_city_StoreMsgRules == null) { return("非法操作(置顶时间有误)"); } city_Msg.topDay = _city_StoreMsgRules.exptimeday; city_Msg.topCostPrice = _city_StoreMsgRules.price; int msgId = Convert.ToInt32(base.Add(city_Msg)); if (msgId <= 0) { return("发布信息异常"); } else { order.Articleid = _city_StoreMsgRules.Id; order.CommentId = msgId; order.MinisnsId = aid; order.payment_free = city_Msg.topCostPrice; order.ShowNote = $"小程序同城发布消息付款{order.payment_free * 0.01}元"; return(string.Empty); } } }
/// <summary> /// 抛弃使用(用GetUnifiedOrderResult) /// </summary> /// <param name="setting"></param> /// <param name="morder"></param> /// <param name="notify_url"></param> /// <returns></returns> public WxPayData GetUnifiedOrderResultByCity(PayCenterSetting setting, CityMorders morder, string notify_url) { //统一下单 string out_trade_no = morder.orderno;//商户订单号 if (string.IsNullOrEmpty(morder.orderno)) { throw new WxPayException("UnifiedOrder response error!"); } string body = string.Empty; if (!string.IsNullOrEmpty(morder.ShowNote)) { body = morder.ShowNote; } else { string paytype = string.Empty; switch (morder.OrderType) { case (int)ArticleTypeEnum.MiniappGoods: paytype = "小程序电商模板订单"; break; case (int)ArticleTypeEnum.MiniappFoodGoods: paytype = "小程序餐饮模板订单"; break; case (int)ArticleTypeEnum.MiniappSaveMoneySet: paytype = "小程序餐饮储值"; break; case (int)ArticleTypeEnum.MiniappBargain: paytype = "小程序砍价"; break; case (int)ArticleTypeEnum.MiniappEnt: paytype = "小程序专业版"; break; case (int)ArticleTypeEnum.MiniappWXDirectPay: paytype = "小程序直接微信转账"; break; case (int)ArticleTypeEnum.PlatChildOrderPay: paytype = "平台子模版支付"; break; case (int)ArticleTypeEnum.PlatChildOrderInPlatPay: paytype = "子模版订单平台支付"; break; } body = string.Format("支付中心,{0}支付{1}元", paytype, (morder.payment_free * 0.01)); //商品描述; } string attach = string.Format("paytype={0}&orderid={1}&orderno={2}&from=city", morder.OrderType, morder.Id, morder.orderno); //自带的信息 //统一下单 WxPayData data = new WxPayData(); data.SetValue("body", body); data.SetValue("attach", attach); data.SetValue("out_trade_no", out_trade_no); data.SetValue("total_fee", total_fee); data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); data.SetValue("goods_tag", "test"); data.SetValue("trade_type", "JSAPI"); data.SetValue("openid", openid); data.SetValue("notify_url", notify_url); WxPayData result = WxPayApi.UnifiedOrder(data, setting); if (result != null && (!result.IsSet("appid") || !result.IsSet("prepay_id") || !result.IsSet("prepay_id"))) { throw new WxPayException(result.ToJson()); } unifiedOrderResult = result; return(result); }
public ActionResult AddStoreTime() { returnObj = new Return_Msg_APP(); returnObj.code = "200"; string appId = Context.GetRequest("appId", string.Empty); int storeId = Context.GetRequestInt("storeId", 0); int ruleId = Context.GetRequestInt("ruleId", 0); if (string.IsNullOrEmpty(appId) || storeId <= 0 || ruleId <= 0) { returnObj.Msg = "参数错误"; return(Json(returnObj)); } XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId); if (r == null) { returnObj.Msg = "小程序未授权"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } PlatStore platStore = PlatStoreBLL.SingleModel.GetModel(storeId); if (platStore == null) { returnObj.Msg = "店铺不存在"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } if (platStore.State == -1) { returnObj.Msg = "店铺不可用"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } PlatStoreAddRules rule = PlatStoreAddRulesBLL.SingleModel.getRule(r.Id, ruleId); if (rule == null) { returnObj.Msg = "续费套餐不存在"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } CityMorders order = new CityMorders() { FuserId = platStore.Id, Fusername = platStore.Name, TuserId = 0, OrderType = (int)ArticleTypeEnum.PlatStoreAddTimePay, ActionType = (int)miniAppBuyMode.微信支付, Addtime = DateTime.Now, Percent = 99,//不收取服务费 userip = WebHelper.GetIP(), payment_status = 0, Status = 0, CitySubId = 0,//无分销,默认为0 PayRate = 1, appid = appId, Articleid = rule.Id, CommentId = rule.YearCount, MinisnsId = r.Id, payment_free = rule.CostPrice, ShowNote = $"平台版店铺续期{rule.YearCount}月收费付款{rule.CostPrice * 0.01}元" }; string no = WxPayApi.GenerateOutTradeNo(); order.orderno = no; order.trade_no = no; int orderid = Convert.ToInt32(_cityMordersBLL.Add(order)); if (orderid <= 0) { returnObj.Msg = "续费失败(生成订单失败)"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } returnObj.dataObj = orderid; returnObj.isok = true; returnObj.Msg = "续费成功"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 创建预约付费订单 /// </summary> /// <param name="aid">小程序aid</param> /// <param name="uid">userId</param> /// <param name="remark">预约商品信息Json字符串 EntFormRemark</param> /// <returns></returns> public EntGoodsOrder CreateOrder(int aid, int userId, Store store, string remark, int buyMode, out string msg) { EntGoodsOrder order = null; try { EntFormRemark formRemark = JsonConvert.DeserializeObject <EntFormRemark>(remark); EntGoods goods = EntGoodsBLL.SingleModel.GetModel(formRemark.goods.id); if (goods == null) { msg = "订单生成失败:商品信息不存在"; return(order); } //商品标价 int originalPrice = originalPrice = Convert.ToInt32(!string.IsNullOrWhiteSpace(formRemark.attrSpacStr) ? goods.GASDetailList.First(x => x.id.Equals(formRemark.attrSpacStr)).originalPrice * 100 : goods.originalPrice * 100); //商品未打折价格 int price = Convert.ToInt32(!string.IsNullOrWhiteSpace(formRemark.attrSpacStr) ? goods.GASDetailList.First(x => x.id.Equals(formRemark.attrSpacStr)).price * 100 : goods.price * 100); //清单 EntGoodsCart goodsCar = new EntGoodsCart { NotDiscountPrice = price, originalPrice = originalPrice, GoodName = goods.name, FoodGoodsId = goods.id, SpecIds = formRemark.attrSpacStr, Count = formRemark.count, Price = price, SpecInfo = formRemark.SpecInfo, SpecImg = formRemark.SpecImg,//规格图片 UserId = userId, CreateDate = DateTime.Now, State = 0, GoToBuy = 1, aId = aid, type = (int)EntGoodCartType.预约表单 }; goodsCar.Id = Convert.ToInt32(EntGoodsCartBLL.SingleModel.Add(goodsCar)); if (goodsCar.Id <= 0) { msg = "订单生成失败:购物车添加失败"; return(order); } C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(userId); if (userInfo == null) { msg = "订单生成失败:用户信息不存在"; return(order); } XcxAppAccountRelation xcxAppAccount = XcxAppAccountRelationBLL.SingleModel.GetModel(aid); if (xcxAppAccount == null) { msg = "订单生成失败:小程序信息不存在"; return(order); } int buyPrice = 0; if (store.funJoinModel.YuyuePayType == 0)//固定金额付费 { buyPrice = store.funJoinModel.YuyuePayCount * 100 * goodsCar.Count; } else { double priceData = goodsCar.Price * goodsCar.Count * store.funJoinModel.YuyuePayCount * 0.01; buyPrice = Convert.ToInt32(Math.Ceiling(priceData)); } order = new EntGoodsOrder() { BuyPrice = buyPrice, GoodsGuid = goodsCar.FoodGoodsId.ToString(), UserId = userInfo.Id, CreateDate = DateTime.Now, OrderType = (int)EntOrderType.预约付费订单, QtyCount = goodsCar.Count, aId = aid, BuyMode = buyMode, }; order.Id = Convert.ToInt32(EntGoodsOrderBLL.SingleModel.Add(order)); if (order.Id <= 0) { msg = "订单生成失败:生成失败"; return(null); } //将订单id添加到清单 goodsCar.GoodsOrderId = order.Id; goodsCar.State = 1; EntGoodsCartBLL.SingleModel.Update(goodsCar, "state,goodsorderid"); //生成对外订单号 string outTradeNo = order.Id.ToString(); if (outTradeNo.Length >= 3) { outTradeNo = outTradeNo.Substring(outTradeNo.Length - 3, 3); } else { outTradeNo.PadLeft(3, '0'); } outTradeNo = $"{DateTime.Now.ToString("yyyyMMddHHmm")}{outTradeNo}"; order.OrderNum = outTradeNo; if (order.BuyMode == (int)miniAppBuyMode.微信支付) { CityMordersBLL cityMordersBLL = new CityMordersBLL(); //创建微信订单 CityMorders cityMorders = cityMordersBLL.CreateCityMorder((int)ArticleTypeEnum.EntSubscribeFormPay, (int)ArticleTypeEnum.EntSubscribeFormPay, order.BuyPrice, 99, aid, userInfo.Id, userInfo.NickName, order.Id, xcxAppAccount.AppId, xcxAppAccount.Title); if (cityMorders == null) { msg = "订单生成失败:生成微信订单失败"; return(null); } order.OrderId = cityMorders.Id; if (!EntGoodsOrderBLL.SingleModel.Update(order, "orderid,OrderNum")) { msg = "订单生成失败:微信支付错误"; return(null); } msg = string.Empty; return(order); } else if (order.BuyMode == (int)miniAppBuyMode.储值支付) { SaveMoneySetUser saveMoneyUser = SaveMoneySetUserBLL.SingleModel.getModelByUserId(xcxAppAccount.AppId, userInfo.Id); if (saveMoneyUser == null || saveMoneyUser.AccountMoney < order.BuyPrice) { msg = "订单生成失败:预存款余额不足"; return(null); } if (!SaveMoneySetUserBLL.SingleModel.paySubscribeFromOrderBySaveMoneyUser(order, saveMoneyUser)) { msg = "订单生成失败:储值支付失败"; return(null); } msg = string.Empty; return(order); } else { msg = "订单生成失败:支付方式错误"; return(null); } } catch { msg = "订单生成失败:remark error"; return(order); } }
/** * * 网页授权获取用户基本信息的全部过程 * 详情请参看网页授权获取用户基本信息:http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html * 第一步:利用url跳转获取code * 第二步:利用code去获取openid和access_token * */ //public void GetOpenidAndAccessToken() //{ // if (!string.IsNullOrEmpty(context.Request.QueryString["code"])) // { // //获取code码,以获取openid和access_token // string code = context.Request.QueryString["code"]; // log4net.LogHelper.WriteInfo(this.GetType(), "Get code : " + code); // GetOpenidAndAccessTokenFromCode(code); // } // else // { // //构造网页授权获取code的URL // string host = context.Request.Url.Host; // string path = context.Request.Path; // string redirect_uri = HttpUtility.UrlEncode("http://" + host + path); // WxPayData data = new WxPayData(); // data.SetValue("appid", WxPayConfig.APPID); // data.SetValue("redirect_uri", redirect_uri); // data.SetValue("response_type", "code"); // data.SetValue("scope", "snsapi_base"); // data.SetValue("state", "STATE" + "#wechat_redirect"); // string url = "https://open.weixin.qq.com/connect/oauth2/authorize?" + data.ToUrl(); // log4net.LogHelper.WriteInfo(this.GetType(), "Will Redirect to URL : " + url); // try // { // //触发微信返回code码 // context.Response.Redirect(url);//Redirect函数会抛出ThreadAbortException异常,不用处理这个异常 // } // catch (System.Threading.ThreadAbortException ) // { // } // } //} /** * * 通过code换取网页授权access_token和openid的返回数据,正确时返回的JSON数据包如下: * { * "access_token":"ACCESS_TOKEN", * "expires_in":7200, * "refresh_token":"REFRESH_TOKEN", * "openid":"OPENID", * "scope":"SCOPE", * "unionid": "o6_bmasdasdsad6_2sgVt7hMZOPfL" * } * 其中access_token可用于获取共享收货地址 * openid是微信支付jsapi支付接口统一下单时必须的参数 * 更详细的说明请参考网页授权获取用户基本信息:http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html * @失败时抛异常WxPayException */ //public void GetOpenidAndAccessTokenFromCode(string code) //{ // try // { // //构造获取openid及access_token的url // WxPayData data = new WxPayData(); // data.SetValue("appid", WxPayConfig.APPID); // data.SetValue("secret", WxPayConfig.APPSECRET); // data.SetValue("code", code); // data.SetValue("grant_type", "authorization_code"); // string url = "https://api.weixin.qq.com/sns/oauth2/access_token?" + data.ToUrl(); // //请求url以获取数据 // string result = WxHelper.HttpGet(url); // //保存access_token,用于收货地址获取 // WxAuthorize jd = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<WxAuthorize>(result); // access_token = jd.access_token; // //获取用户openid // openid = jd.openid; // } // catch (Exception ex) // { // log4net.LogHelper.WriteError(this.GetType(), ex); // throw ex; // } //} ///// <summary> ///// 文章打赏 ///// </summary> ///// <param name="article">文章实体</param> ///// <returns></returns> //public WxPayData GetUnifiedOrderResult(PayCenterSetting setting,Article article, int luserid, out int orderid, int artcommentid = 0) //{ // OAuthUserBll bll = new OAuthUserBll(article.MinisnsId.ToString()); // OAuthUser looker = bll.GetUserByCache(luserid); // OAuthUser maker = bll.GetUserByCache(article.UserId); // //统一下单 // string out_trade_no = WxPayApi.GenerateOutTradeNo();//商户订单号 // string body = "赞赏" + (maker == null ? "匿名用户" : Utility.ReplaceSpecialChar(maker.Nickname, '?'));//商品描述 // if (article.IsGuerdon == (int)ArticleTypeEnum.Donation) // { // body = "支持" + (maker == null ? "匿名用户" : Utility.ReplaceSpecialChar(maker.Nickname, '?'));//商品描述 // } // string attach = "paytype=1&minisnsid=" + article.MinisnsId + "&articleid=" + article.Id + "&userid=" + article.UserId + "&luserId=" + looker.Id;//自带的信息 // if (article.IsGuerdon == (int)ArticleTypeEnum.Donation && artcommentid != 0) // { // attach += "&articlecommentid=" + artcommentid; // } // //统一下单 // WxPayData data = new WxPayData(); // data.SetValue("body", body); // data.SetValue("attach", attach); // data.SetValue("out_trade_no", out_trade_no); // data.SetValue("total_fee", total_fee); // data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); // data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); // data.SetValue("goods_tag", "test"); // data.SetValue("trade_type", "JSAPI"); // data.SetValue("openid", openid); // WxPayData result = WxPayApi.UnifiedOrder(data, setting); // if (!result.IsSet("appid") || !result.IsSet("prepay_id") || result.GetValue("prepay_id").ToString() == "") // { // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("data:" + data.ToJson())); // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("result:" + result.ToJson())); // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("统一下单请求失败!prepay_id:" + result.GetValue("prepay_id").ToString())); // throw new WxPayException("UnifiedOrder response error!"); // } // //插入打赏记录 // if (maker == null) // { // //作者为空,不能打赏 // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("文章作者为空!")); // throw new WxPayException("文章作者为空!"); // } // if (looker == null) // { // //打赏者为空,新增用户信息(在前面获取用户信息已经跳转注册过) // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("获取用户信息失败!")); // throw new WxPayException("获取用户信息失败!"); // } // RewardOrder order = new RewardOrder(); // order.userip = Utility.Web.WebHelper.GetIP(); // order.addTime = DateTime.Now; // order.articleId = article.Id; // order.minisnsId = article.MinisnsId; // order.rewardFromUserId = looker.Id; // order.rewardMoney = total_fee; // order.rewardToUserId = maker.Id; // order.out_trade_no = out_trade_no; // order.status = 0; // order.percent = ((100 - WebConfigBLL.VzanRewardPercent) - new MinisnsBll().GetModel(article.MinisnsId).RewardPercent); // //众筹 // if (article.IsGuerdon == (int)ArticleTypeEnum.Donation) // { // order.percent = 100 - WebConfigBLL.DonationPercent; // order.rewardtype = 3; // } // //新增区分文章和回复类型 // order.rewardtype = 0; // RewardOrderBLL bllorder = new RewardOrderBLL(); // try // { // orderid = Convert.ToInt32(bllorder.Add(order)); // if (orderid <= 0) // { // throw new WxPayException("打赏新增订单失败!"); // } // } // catch (Exception ex) // { // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("插入RewardOrder失败!" + ex.Message)); // throw; // } // unifiedOrderResult = result; // return result; //} ///// <summary> ///// 文章悬赏 ///// </summary> ///// <param name="article">文章实体</param> ///// <returns></returns> //public WxPayData GetUnifiedOrderResult(PayCenterSetting setting,Article article) //{ // OAuthUserBll bll = new OAuthUserBll(article.MinisnsId.ToString()); // OAuthUser maker = bll.GetUserByCache(article.UserId); // //ArticleType articleType = new ArticleTypeBll().GetModel(article.ArticleTypeId); // //统一下单 // string out_trade_no = WxPayApi.GenerateOutTradeNo();//商户订单号 // string body = string.Empty; // int paytype = 0; // if (article.GuerdonMoney > 0) // { // body += string.Format("悬赏贴:{0}元", article.GuerdonMoney * 0.01);//商品描述 // paytype = 2; // } // if (article.payment_free > 0) // { // if (article.IsGuerdon == (int)ArticleTypeEnum.Pay) // { // body += string.Format("付费贴:{0}元", article.payment_free * 0.01);//商品描述 // paytype = 3; // } // if (article.IsGuerdon == (int)ArticleTypeEnum.Stick) // { // body += string.Format("置顶贴:{0}元", article.payment_free * 0.01);//商品描述 // paytype = 4; // } // } // string attach = string.Empty; // attach = "paytype=" + paytype + "&minisnsid=" + article.MinisnsId + "&articleid=" + article.Id + "&userid=" + article.UserId;//自带的信息 // //统一下单 // WxPayData data = new WxPayData(); // data.SetValue("body", body); // data.SetValue("attach", attach); // data.SetValue("out_trade_no", out_trade_no); // data.SetValue("total_fee", total_fee); // data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); // data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); // data.SetValue("goods_tag", "test"); // data.SetValue("trade_type", "JSAPI"); // data.SetValue("openid", openid); // WxPayData result = WxPayApi.UnifiedOrder(data, setting); // if (!result.IsSet("appid") || !result.IsSet("prepay_id") || result.GetValue("prepay_id").ToString() == "") // { // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("文章付款ID:" + article.Id + ",data:" + data.ToJson())); // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("result:" + result.ToJson())); // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("统一下单请求失败!prepay_id:" + result.GetValue("prepay_id").ToString())); // throw new WxPayException("UnifiedOrder response error!"); // } // //插入打赏记录 // if (maker == null) // { // //作者为空,不能打赏 // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("文章作者为空!")); // throw new WxPayException("文章作者为空!"); // } // if (article.IsGuerdon == 1) // { // GuerdonOrder order = new GuerdonOrder(); // order.Addtime = DateTime.Now; // order.Articleid = article.Id; // order.MinisnsId = article.MinisnsId; // order.GuerdonFromUserId = maker.Id; // order.GuerdonMoney = article.GuerdonMoney; // order.OutTradeNo = out_trade_no; // order.Status = 0; // order.Percent = ((100 - WebConfigBLL.VzanRewardPercent) - new MinisnsBll().GetModel(article.MinisnsId).RewardPercent); // //新增区分文章和回复类型 // order.OperStatus = 0; // GuerdonOrderBLL bllorder = new GuerdonOrderBLL(); // bllorder.Add(order); // } // unifiedOrderResult = result; // return result; //} ///// <summary> ///// 回复打赏 ///// </summary> ///// <param name="article">回复实体</param> ///// <returns></returns> //public WxPayData GetUnifiedOrderResult(PayCenterSetting setting, ArticleComment comment, OAuthUser looker, out int orderid) //{ // OAuthUserBll bll = new OAuthUserBll(comment.MinisnsId.ToString()); // OAuthUser maker = bll.GetUserByCache(comment.UserId); // //统一下单 // string out_trade_no = WxPayApi.GenerateOutTradeNo();//商户订单号 // string body = "打赏" + (maker == null ? "匿名用户" : Utility.ReplaceSpecialChar(maker.Nickname, '?'));//商品描述 // string attach = "paytype=1&minisnsid=" + comment.MinisnsId + "&commentid=" + comment.Id + "&userid=" + comment.UserId + "&luserId=" + looker.Id;//自带的信息 // //统一下单 // WxPayData data = new WxPayData(); // data.SetValue("body", body); // data.SetValue("attach", attach); // data.SetValue("out_trade_no", out_trade_no); // data.SetValue("total_fee", total_fee); // data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); // data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); // data.SetValue("goods_tag", "test"); // data.SetValue("trade_type", "JSAPI"); // data.SetValue("openid", openid); // WxPayData result = WxPayApi.UnifiedOrder(data, setting); // if (!result.IsSet("appid") || !result.IsSet("prepay_id") || result.GetValue("prepay_id").ToString() == "") // { // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("文章回复实体ID" + comment.Id + ",data:" + data.ToJson())); // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("result:" + result.ToJson())); // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("统一下单请求失败!prepay_id:" + result.GetValue("prepay_id").ToString())); // throw new WxPayException("UnifiedOrder response error!"); // } // //插入打赏记录 // if (maker == null) // { // //作者为空,不能打赏 // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("文章作者为空!")); // throw new WxPayException("文章作者为空!"); // } // if (looker == null) // { // //打赏者为空,新增用户信息(在前面获取用户信息已经跳转注册过) // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("获取用户信息失败!")); // throw new WxPayException("获取用户信息失败!"); // } // RewardOrder order = new RewardOrder(); // order.userip = Utility.Web.WebHelper.GetIP(); // order.addTime = DateTime.Now; // order.articleId = comment.ArticleId; // order.minisnsId = comment.MinisnsId; // order.rewardFromUserId = looker.Id; // order.rewardMoney = total_fee; // order.rewardToUserId = maker.Id; // order.out_trade_no = out_trade_no; // order.status = 0; // order.percent = ((100 - WebConfigBLL.VzanRewardPercent) - new MinisnsBll().GetModel(comment.MinisnsId).RewardPercent); // //新增区分文章和回复类型 // order.rewardtype = 1; // order.commentId = comment.Id;//如果是回复打赏,commentId为空 // RewardOrderBLL bllorder = new RewardOrderBLL(); // try // { // orderid = Convert.ToInt32(bllorder.Add(order)); // } // catch (Exception ex) // { // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("插入RewardOrder失败!" + ex.Message)); // throw; // } // //orderid = bllorder.GetModel(string.Format("out_trade_no='{0}'", order.out_trade_no)).Id; // unifiedOrderResult = result; // return result; //} ///// <summary> ///// 支付中心 ///// </summary> ///// <param name="article">Morders订单实体</param> ///// <returns></returns> //public WxPayData GetUnifiedOrderResult(PayCenterSetting setting, Morders morder, bool livePay = false) //{ // //统一下单 // string out_trade_no = morder.orderno;//商户订单号 // if (string.IsNullOrEmpty(morder.orderno)) // { // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("统一下单失败,订单的内部订单号为空!:OrderID:" + morder.Id)); // throw new WxPayException("UnifiedOrder response error!"); // } // string body = string.Empty; // if (!string.IsNullOrEmpty(morder.ShowNote)) // { // body = morder.ShowNote; // } // else // { // string paytype = string.Empty; // switch (morder.OrderType) // { // case (int)ArticleTypeEnum.Offer: // paytype = "悬赏贴"; // break; // case (int)ArticleTypeEnum.Pay: // paytype = "付费贴"; // break; // case (int)ArticleTypeEnum.Stick: // paytype = "置顶帖"; // break; // case (int)ArticleTypeEnum.VoiceRedPacket: // paytype = "语音红包"; // break; // case (int)ArticleTypeEnum.Advert: // paytype = "广告"; // break; // case (int)ArticleTypeEnum.VoiceRedPacketRecharge: // paytype = "红包充值"; // break; // case (int)ArticleTypeEnum.LiveReward: // paytype = "直播间打赏"; // break; // case (int)ArticleTypeEnum.CashWishes: // paytype = "送彩礼"; // break; // case (int)ArticleTypeEnum.CityArticleTop: // case (int)ArticleTypeEnum.CityBannerShow: // case (int)ArticleTypeEnum.CityStoreTop: // paytype = "同城推广"; // break; // } // body = string.Format("支付中心,{0}支付{1}元", paytype, (morder.payment_free * 0.01));//商品描述; // } // string attach = string.Format("paytype={0}&orderid={1}&orderno={2}&from=center", morder.OrderType, morder.Id, morder.orderno);//自带的信息 // //统一下单 // WxPayData data = new WxPayData(); // data.SetValue("body", body); // data.SetValue("attach", attach); // data.SetValue("out_trade_no", out_trade_no); // data.SetValue("total_fee", total_fee); // data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); // data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); // data.SetValue("goods_tag", "test"); // data.SetValue("trade_type", "JSAPI"); // data.SetValue("openid", openid); // WxPayData result = WxPayApi.UnifiedOrder(data, setting,60,livePay); // if (!result.IsSet("appid") || !result.IsSet("prepay_id") || result.GetValue("prepay_id").ToString() == "") // { // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("data:" + data.ToJson())); // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("result:" + result.ToJson())); // log4net.LogHelper.WriteError(this.GetType(), new WxPayException("统一下单请求失败!prepay_id:" + result.GetValue("prepay_id").ToString())); // throw new WxPayException("UnifiedOrder response error!"); // } // unifiedOrderResult = result; // return result; //} public WxPayData GetUnifiedOrderResultByCity(PayCenterSetting setting, CityMorders morder, string notify_url) { //统一下单 string out_trade_no = morder.orderno;//商户订单号 if (string.IsNullOrEmpty(morder.orderno)) { //log4net.LogHelper.WriteError(this.GetType(), new WxPayException("统一下单失败,订单的内部订单号为空!:OrderID:" + morder.Id)); throw new WxPayException("UnifiedOrder response error!"); } string body = string.Empty; if (!string.IsNullOrEmpty(morder.ShowNote)) { body = morder.ShowNote; } else { string paytype = string.Empty; switch (morder.OrderType) { case (int)ArticleTypeEnum.MiniappGoods: paytype = "小程序电商模板订单"; break; case (int)ArticleTypeEnum.MiniappFoodGoods: paytype = "小程序餐饮模板订单"; break; case (int)ArticleTypeEnum.MiniappSaveMoneySet: paytype = "小程序餐饮储值"; break; case (int)ArticleTypeEnum.MiniappBargain: paytype = "小程序砍价"; break; case (int)ArticleTypeEnum.MiniappEnt: paytype = "小程序专业版"; break; } body = string.Format("支付中心,{0}支付{1}元", paytype, (morder.payment_free * 0.01)); //商品描述; } string attach = string.Format("paytype={0}&orderid={1}&orderno={2}&from=city", morder.OrderType, morder.Id, morder.orderno); //自带的信息 //统一下单 WxPayData data = new WxPayData(); data.SetValue("body", body); data.SetValue("attach", attach); data.SetValue("out_trade_no", out_trade_no); data.SetValue("total_fee", total_fee); data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); data.SetValue("goods_tag", "test"); data.SetValue("trade_type", "JSAPI"); data.SetValue("openid", openid); //同城回调到同城站点 //data.SetValue("notify_url", WebConfigBLL.citynotify_url); //data.SetValue("notify_url", WebConfigBLL.citynotify_url); data.SetValue("notify_url", notify_url); //log4net.LogHelper.WriteInfo(GetType(),"支付回调链接:"+ WebConfigBLL.citynotify_url); WxPayData result = WxPayApi.UnifiedOrder(data, setting); if (result != null && (!result.IsSet("appid") || !result.IsSet("prepay_id") || !result.IsSet("prepay_id"))) { //log4net.LogHelper.WriteError(this.GetType(), new WxPayException("data:" + data.ToJson())); //log4net.LogHelper.WriteError(this.GetType(), new WxPayException("result:" + result.ToJson())); //log4net.LogHelper.WriteError(this.GetType(), new WxPayException("统一下单请求失败!prepay_id:" + result.GetValue("prepay_id").ToString())); throw new WxPayException("UnifiedOrder response error!" + "result:" + result.ToJson()); } unifiedOrderResult = result; return(result); }
//回调根据PayResult处理回调 public bool NotifyOper(PayResult result) { if (WxUtils.getAttachValue(result.attach, "from") == "city") { CityMordersBLL citybll = new CityMordersBLL(result); string orderidstr = WxUtils.getAttachValue(result.attach, "orderid"); if (string.IsNullOrEmpty(orderidstr)) { log4net.LogHelper.WriteError(GetType(), new Exception(JsonConvert.SerializeObject(result))); return(false); } int orderid = Convert.ToInt32(orderidstr); CityMorders order = citybll.GetModel(orderid); //修改订单支付状态 if (order == null) { Exception ex = new Exception("警报:根据支付单号找不到相关订单!" + " out_trade_no='" + result.out_trade_no + "'"); log4net.LogHelper.WriteError(GetType(), ex); log4net.LogHelper.WriteError(GetType(), new Exception(JsonConvert.SerializeObject(result))); return(false); } if (order.payment_status != 0) { return(false); } if (order.Percent < 0 || order.Percent > 100) { Exception ex = new Exception("警报:出现异常订单!订单提成百分比为:" + order.Percent + " out_trade_no='" + result.out_trade_no + "'"); log4net.LogHelper.WriteError(GetType(), ex); log4net.LogHelper.WriteError(GetType(), new Exception(JsonConvert.SerializeObject(result))); return(false); } citybll.Order = order; //修改order支付商户 order.mch_id = result.mch_id; order.appid = result.appid; citybll.Update(order); switch (result.paytype) { //小程序商城 case (int)ArticleTypeEnum.MiniappGoods: return(citybll.MiniappStoreGoods()); //小程序餐饮 case (int)ArticleTypeEnum.MiniappFoodGoods: return(citybll.MiniappFoodGoods()); //小程序储值 case (int)ArticleTypeEnum.MiniappSaveMoneySet: return(citybll.MiniappSaveMoney()); //小程序砍价 case (int)ArticleTypeEnum.MiniappBargain: return(citybll.MiniappBargainMoney()); //小程序拼团 case (int)ArticleTypeEnum.MiniappGroups: return(citybll.MiniappStoreGroup()); //小程序专业版 case (int)ArticleTypeEnum.MiniappEnt: return(citybll.MiniappEntGoods()); //小程序足浴版 case (int)ArticleTypeEnum.MiniappFootbath: return(citybll.MiniappFootbath()); case (int)ArticleTypeEnum.MiniappMultiStore: return(citybll.MiniappMultiStore()); //小程序专业版积分兑换(微信+积分方式兑换) case (int)ArticleTypeEnum.MiniappExchangeActivity: return(citybll.PayMiniappExchangeActivity()); //小程序同城模板 case (int)ArticleTypeEnum.City_StoreBuyMsg: return(citybll.cityBuyMsg()); //小程序直接微信转账 case (int)ArticleTypeEnum.MiniappWXDirectPay: return(citybll.PayByStoredvalue()); //智慧餐厅 case (int)ArticleTypeEnum.DishOrderPay: return(citybll.PayDishOrder()); case (int)ArticleTypeEnum.DishStorePayTheBill: return(citybll.PayDishStorePayTheBill()); case (int)ArticleTypeEnum.DishCardAccount: return(citybll.PayDishCardAccount()); //平台版小程序分类信息发帖 case (int)ArticleTypeEnum.PlatMsgPay: return(citybll.PlatMsgPay()); //付费内容支付购买 case (int)ArticleTypeEnum.PayContent: return(citybll.PayContentCallBack()); //子模版订单平台支付 case (int)ArticleTypeEnum.PlatChildOrderInPlatPay: //平台子模版支付 case (int)ArticleTypeEnum.PlatChildOrderPay: return(citybll.MiniappPlatChildGoods()); //拼享惠支付 case (int)ArticleTypeEnum.PinOrderPay: return(citybll.PayPinOrder()); //平台子模版支付 case (int)ArticleTypeEnum.QiyeOrderPay: return(citybll.QiyePayOrder()); //平台店铺入驻支付 case (int)ArticleTypeEnum.PlatAddStorePay: return(citybll.PlatAddStorePay()); //平台店铺续期支付 case (int)ArticleTypeEnum.PlatStoreAddTimePay: return(citybll.PlatStoreAddTimePay()); //专业版预约表单付费 case (int)ArticleTypeEnum.EntSubscribeFormPay: return(citybll.EntSubscribeFormPay()); } } return(false); }
/// <summary> /// 拼团支付逻辑处理 /// </summary> /// <param name="jsondata"></param> /// <param name="ordertype"></param> /// <param name="paytype"></param> /// <param name="appid"></param> /// <param name="order"></param> /// <returns></returns> public string CommandGroupPay(string jsondata, int ordertype, int paytype, string appid, ref CityMorders order) { if (string.IsNullOrEmpty(jsondata)) { return("json参数错误"); } AddGroupModel groupjson = JsonConvert.DeserializeObject <AddGroupModel>(jsondata); if (groupjson == null) { return("null参数错误"); } Groups group = base.GetModel(groupjson.groupId); if (group == null) { return("拼团商品不存在"); } if (groupjson.groupId <= 0) { return("拼团参数错误"); } Store store = StoreBLL.SingleModel.GetModel(group.StoreId); if (store == null) { return("店铺不存在"); } if (groupjson.guid <= 0) { return("用户拼团记录ID不能小于0"); } order.payment_free = groupjson.payprice; order.Articleid = groupjson.groupId; order.CommentId = groupjson.guid; order.MinisnsId = store.Id; order.is_group = groupjson.isGroup; order.is_group_head = groupjson.isGHead; order.groupsponsor_id = groupjson.gsid; order.ShowNote = $"小程序拼团付款{order.payment_free * 0.01}元"; order.buy_num = groupjson.num; order.remark = groupjson.addres; order.OperStatus = store.Id; order.Tusername = groupjson.username; order.AttachPar = groupjson.phone; order.Note = groupjson.note; return(""); }
public ActionResult addSaveMoneySet(string appid, string openid, int saveMoneySetId) { if (string.IsNullOrEmpty(appid)) { return(Json(new { isok = false, msg = "获取失败(appid不能为空)" }, JsonRequestBehavior.AllowGet)); } XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModel($"AppId='{appid}'"); if (r == null) { return(Json(new { isok = false, msg = "获取失败(还未进行授权)" }, JsonRequestBehavior.AllowGet)); } var minisnsId = 0; //获取当前小程序模板类型 var typeSql = $" select type from xcxtemplate where id = {r.TId} "; var temp = Convert.ToInt32(SqlMySql.ExecuteScalar(_xcxAppAccountRelationBLL.connName, CommandType.Text, typeSql, null)); if (temp == (int)TmpType.小程序电商模板 || temp == (int)TmpType.小程序电商模板测试) { var store = StoreBLL.SingleModel.GetModelByRid(r.Id) ?? new Store(); minisnsId = store.Id; try { store.funJoinModel = JsonConvert.DeserializeObject <StoreConfigModel>(store.configJson); } catch (Exception) { store.funJoinModel = new StoreConfigModel(); } if (!store.funJoinModel.canSaveMoneyFunction) { return(Json(new { isok = false, msg = "商家未开启储值优惠功能" }, JsonRequestBehavior.AllowGet)); } } else if (temp == (int)TmpType.小程序餐饮模板) { var food = FoodBLL.SingleModel.GetModel($" appId = {r.Id} ") ?? new Food(); minisnsId = food.Id; if (!food.funJoinModel.canSaveMoneyFunction) { return(Json(new { isok = false, msg = "商家未开启储值优惠功能" }, JsonRequestBehavior.AllowGet)); } } var model = SaveMoneySetBLL.SingleModel.GetModel(saveMoneySetId, r.AppId); if (model == null || model.State != 1)//要是上架状态的储值项目 { return(Json(new { isok = false, msg = "找不到储值项目" }, JsonRequestBehavior.AllowGet)); } var userInfo = C_UserInfoBLL.SingleModel.GetModelByAppId_OpenId(appid, openid); if (userInfo == null) { return(Json(new { isok = -1, msg = "用户不存在" }, JsonRequestBehavior.AllowGet)); } if (model == null || model.State != 1)//要是上架状态的储值项目 { return(Json(new { isok = false, msg = "找不到储值项目" }, JsonRequestBehavior.AllowGet)); } var user = SaveMoneySetUserBLL.SingleModel.getModelByUserId(r.AppId, userInfo.Id); if (user == null) { //用户储值账户,若无则开通一个 user = new SaveMoneySetUser() { AppId = r.AppId, UserId = userInfo.Id, AccountMoney = 0, CreateDate = DateTime.Now }; user.Id = Convert.ToInt32(SaveMoneySetUserBLL.SingleModel.Add(user)); if (user.Id <= 0) { return(Json(new { isok = -1, msg = "开通储值账户失败,请重试" }, JsonRequestBehavior.AllowGet)); } } //充值记录 var newLog = new SaveMoneySetUserLog() { AppId = r.AppId, UserId = userInfo.Id, MoneySetUserId = user.Id, Type = 0, BeforeMoney = user.AccountMoney, AfterMoney = user.AccountMoney + model.AmountMoney, ChangeMoney = model.AmountMoney, ChangeNote = model.SetName, CreateDate = DateTime.Now, State = 0, GiveMoney = model.GiveMoney }; //付款后才去累计预充值金额 //user.AccountMoney += model.AmountMoney; //_miniappsavemoneysetuserBll.Update(user, "AccountMoney"); newLog.Id = Convert.ToInt32(SaveMoneySetUserLogBLL.SingleModel.Add(newLog)); //小程序信息 var xcxconfig = OpenAuthorizerConfigBLL.SingleModel.GetModel($" appid = '{r.AppId}' "); #region cityMorder string no = WxPayApi.GenerateOutTradeNo(); CityMorders citymorderModel = new CityMorders { OrderType = (int)ArticleTypeEnum.MiniappSaveMoneySet, ActionType = (int)ArticleTypeEnum.MiniappSaveMoneySet, Addtime = DateTime.Now, payment_free = model.JoinMoney, trade_no = no, Percent = 99,//不收取服务费 userip = WebHelper.GetIP(), FuserId = userInfo.Id, Fusername = userInfo.NickName, orderno = no, payment_status = 0, Status = 0, Articleid = 0, CommentId = 0, MinisnsId = minisnsId, //r.Id,//模板权限表Id TuserId = newLog.Id, //充值记录的ID ShowNote = $" {xcxconfig?.nick_name} 储值项目[{model.SetName}]购买商品支付{(model.JoinMoney * 0.01).ToString("0.00")}元", CitySubId = 0, //无分销,默认为0 PayRate = 1, buy_num = 0, //无 appid = appid, }; var orderid = Convert.ToInt32(_cityMordersBLL.Add(citymorderModel)); if (orderid <= 0) { return(Json(new { isok = false, msg = "生成订单失败!" }, JsonRequestBehavior.AllowGet)); } newLog.OrderId = orderid; SaveMoneySetUserLogBLL.SingleModel.Update(newLog, "OrderId"); #endregion return(Json(new { isok = true, msg = "获取成功!", orderid = newLog.OrderId }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 发帖 /// </summary> /// <param name="jsondata"></param> /// <param name="ordertype"></param> /// <param name="paytype"></param> /// <param name="aid"></param> /// <param name="order"></param> /// <param name="MyCardId"></param> /// <returns></returns> public string saveMsg(string jsondata, int ordertype, int paytype, int aid, ref CityMorders order, int userId) { if (string.IsNullOrEmpty(jsondata)) { return("json参数错误"); } SavePlatMsgModel savePlatMsgModelJson = JsonConvert.DeserializeObject <SavePlatMsgModel>(jsondata); if (savePlatMsgModelJson == null) { return("null参数错误"); } double lng = 0.00; double lat = 0.00; //校验手机号码 if (!Regex.IsMatch(savePlatMsgModelJson.Phone, @"\d") || savePlatMsgModelJson.Phone.Length > 11) { return("联系号码不符合"); } if (string.IsNullOrEmpty(savePlatMsgModelJson.Location)) { return("请填写地址"); } if (string.IsNullOrEmpty(savePlatMsgModelJson.MsgDetail)) { return("发布信息不能为空"); } if (!double.TryParse(savePlatMsgModelJson.Lng, out lng) || !double.TryParse(savePlatMsgModelJson.Lat, out lat)) { return("地址坐标错误"); } if (savePlatMsgModelJson.MsgType <= 0) { return("请选择信息类别"); } PlatMyCard platMyCard = PlatMyCardBLL.SingleModel.GetModelByUserId(userId, aid); if (platMyCard == null) { return("请先注册"); } PlatMsg platMsg = new PlatMsg(); platMsg.AddTime = DateTime.Now; platMsg.Aid = aid; platMsg.Lat = savePlatMsgModelJson.Lat; platMsg.Lng = savePlatMsgModelJson.Lng; platMsg.Location = savePlatMsgModelJson.Location; platMsg.MsgDetail = HttpUtility.HtmlEncode(savePlatMsgModelJson.MsgDetail); platMsg.MsgTypeId = savePlatMsgModelJson.MsgType; platMsg.Phone = savePlatMsgModelJson.Phone; platMsg.MyCardId = platMyCard.Id; platMsg.Imgs = savePlatMsgModelJson.Imgs; PlatMsgConf platMsgConf = PlatMsgConfBLL.SingleModel.GetMsgConf(aid); if (platMsgConf == null) { return("商家配置异常"); } switch (platMsgConf.ReviewSetting) { case 0: //不需要审核 if (savePlatMsgModelJson.IsTop == 0) { //不置顶消息 platMsg.State = 1; platMsg.Review = 0; platMsg.PayState = 1; platMsg.ReviewTime = DateTime.Now; } else { platMsg.State = 0; //支付回成功调后再变更1 platMsg.PayState = 0; //支付回成功调后再变更1 platMsg.ReviewTime = DateTime.Now; platMsg.Review = 0; } break; case 1: //先审核后发布 platMsg.State = 0; //审核通过后变为1 platMsg.Review = 1; //审核通过后变为2 审核不通过变为-1 if (savePlatMsgModelJson.IsTop == 0) { //不置顶消息 platMsg.PayState = 1; } else { platMsg.PayState = 0; //支付回成功调后再变更为1 } break; case 2: //先发布后审核 platMsg.ReviewTime = DateTime.Now; if (savePlatMsgModelJson.IsTop == 0) { //不置顶消息 platMsg.State = 1; platMsg.PayState = 1; platMsg.Review = 1; //审核通过后变为2 审核不通过变为-1 } else { platMsg.State = 0; //支付回成功调后再变更为1 platMsg.PayState = 0; //支付回成功调后再变更为1 platMsg.Review = 1; //审核通过后变为2 审核不通过变为-1 } break; } if (savePlatMsgModelJson.IsTop == 0) { //表示不置顶的消息 platMsg.TopDay = 0; platMsg.IsTop = 0; platMsg.TopCostPrice = 0; int msgId = Convert.ToInt32(base.Add(platMsg)); if (msgId <= 0) { return("发布信息异常"); } else { return(string.Empty); } } else { //表示置顶消息 需要 生成微信订单,然后微信支付,支付成功后回调将状态变为1可用 if (savePlatMsgModelJson.RuleId <= 0) { return("请选择置顶时间"); } PlatMsgRule platMsgRule = PlatMsgRuleBLL.SingleModel.GetMsgRules(aid, savePlatMsgModelJson.RuleId); if (platMsgRule == null) { return("非法操作(置顶时间有误)"); } platMsg.TopDay = platMsgRule.ExptimeDay; platMsg.TopCostPrice = platMsgRule.Price; platMsg.IsTop = 1; int msgId = Convert.ToInt32(base.Add(platMsg)); if (msgId <= 0) { return("发布信息异常"); } else { order.Articleid = platMsgRule.Id; order.CommentId = msgId; order.MinisnsId = aid; order.payment_free = platMsg.TopCostPrice; order.ShowNote = $"平台版小程序分类信息发置顶帖付款{order.payment_free * 0.01}元"; return(string.Empty); } } }
//回调根据PayResult处理回调 public bool NotifyOper(PayResult result) { //log4net.LogHelper.WriteInfo(this.GetType(), "回调到这里"); //log4net.LogHelper.WriteInfo(this.GetType(), JsonConvert.SerializeObject(result)); if (WxUtils.getAttachValue(result.attach, "from") == "city") { CityMordersBLL citybll = new CityMordersBLL(result); string orderidstr = WxUtils.getAttachValue(result.attach, "orderid"); if (string.IsNullOrEmpty(orderidstr)) { log4net.LogHelper.WriteError(GetType(), new Exception(JsonConvert.SerializeObject(result))); return(false); } int orderid = Convert.ToInt32(orderidstr); CityMorders order = citybll.GetModel(orderid);//citybll.GetModel(" Id=" + orderid + ""); //修改订单支付状态 if (order == null) { Exception ex = new Exception("警报:根据支付单号找不到相关订单!" + " out_trade_no='" + result.out_trade_no + "'"); log4net.LogHelper.WriteError(GetType(), ex); log4net.LogHelper.WriteError(GetType(), new Exception(JsonConvert.SerializeObject(result))); return(false); } if (order.payment_status != 0) { return(false); } if (order.Percent < 0 || order.Percent > 100) { Exception ex = new Exception("警报:出现异常订单!订单提成百分比为:" + order.Percent + " out_trade_no='" + result.out_trade_no + "'"); log4net.LogHelper.WriteError(GetType(), ex); log4net.LogHelper.WriteError(GetType(), new Exception(JsonConvert.SerializeObject(result))); return(false); } citybll.Order = order; //修改order支付商户 order.mch_id = result.mch_id; order.appid = result.appid; citybll.Update(order); switch (result.paytype) { //小程序商城 case (int)ArticleTypeEnum.MiniappGoods: return(citybll.MiniappStoreGoods()); //小程序餐饮 case (int)ArticleTypeEnum.MiniappFoodGoods: return(citybll.MiniappFoodGoods()); //小程序储值 case (int)ArticleTypeEnum.MiniappSaveMoneySet: return(citybll.MiniappSaveMoney()); //小程序砍价 case (int)ArticleTypeEnum.MiniappBargain: return(citybll.MiniappBargainMoney()); //小程序拼团 case (int)ArticleTypeEnum.MiniappGroups: return(citybll.MiniappStoreGroup()); //小程序行业版 case (int)ArticleTypeEnum.MiniappEnt: return(citybll.MiniappEntGoods()); //小程序足浴版 case (int)ArticleTypeEnum.MiniappFootbath: return(citybll.MiniappFootbath()); case (int)ArticleTypeEnum.MiniappMultiStore: return(citybll.MiniappMultiStore()); //小程序专业版积分兑换(微信+积分方式兑换) case (int)ArticleTypeEnum.MiniappExchangeActivity: return(citybll.PayMiniappExchangeActivity()); //小程序同城模拟板 case (int)ArticleTypeEnum.City_StoreBuyMsg: return(citybll.cityBuyMsg()); } } return(false); }
/// <summary> /// 订单退款 /// </summary> /// <param name="item"></param> /// <param name="oldState"></param> /// <param name="BuyMode">默认微信支付</param> /// <param name="isPartOut">是否部分退款</param> /// <returns></returns> public bool EntReFundQueue(EntGoodsOrder item, int oldState, int BuyMode = (int)miniAppBuyMode.微信支付, int?newState = null, bool isPartOut = false) { //重新加回库存 if (EntGoodsOrderBLL.SingleModel.updateStock(item, oldState)) { int money = isPartOut ? item.refundFee : item.BuyPrice;//兼容多版本,目前只有专业版订单有部分退款 item.refundFee = money; if (BuyMode == (int)miniAppBuyMode.微信支付) { try { item.outOrderDate = DateTime.Now; if (item.BuyPrice == 0) //金额为0时,回滚库存后,默认退款成功 { item.State = (int)MiniAppEntOrderState.退款成功; } else { CityMorders order = _cityMordersBLL.GetModel(item.OrderId); item.State = (int)MiniAppEntOrderState.退款中; if (newState.HasValue) { item.State = newState.Value; } if (order == null) { item.State = (int)MiniAppEntOrderState.退款失败; EntGoodsOrderBLL.SingleModel.Update(item, "State,outOrderDate,Remark,refundFee"); return(false); } //微信支付 ReFundQueue reModel = new ReFundQueue { minisnsId = -5, money = item.refundFee, orderid = order.Id, traid = order.trade_no, addtime = DateTime.Now, note = "小程序行业版退款", retype = 1 }; base.Add(reModel); } bool isSuccess = EntGoodsOrderBLL.SingleModel.Update(item, "State,outOrderDate,Remark,refundFee"); if (isSuccess) { //发给用户退款通知 object orderData = TemplateMsg_Miniapp.EnterpriseGetTemplateMessageData(item, SendTemplateMessageTypeEnum.专业版订单退款通知, "商家操作退款"); TemplateMsg_Miniapp.SendTemplateMessage(item.UserId, SendTemplateMessageTypeEnum.专业版订单退款通知, TmpType.小程序专业模板, orderData); } } catch (Exception ex) { log4net.LogHelper.WriteInfo(GetType(), $"{ex.Message} xxxxxxxxxxxxxxxx小程序餐饮退款订单插入队列失败 ID={item.Id}"); } } else { XcxAppAccountRelation r = XcxAppAccountRelationBLL.SingleModel.GetModel(item.aId); if (r == null) { return(false); } SaveMoneySetUser saveMoneyUser = SaveMoneySetUserBLL.SingleModel.getModelByUserId(r.AppId, item.UserId); TransactionModel tran = new TransactionModel(); tran.Add(SaveMoneySetUserLogBLL.SingleModel.BuildAddSql(new SaveMoneySetUserLog() { AppId = r.AppId, UserId = item.UserId, MoneySetUserId = saveMoneyUser.Id, Type = 1, BeforeMoney = saveMoneyUser.AccountMoney, AfterMoney = saveMoneyUser.AccountMoney + item.refundFee, ChangeMoney = item.refundFee, ChangeNote = $"专业版购买商品退款,订单号:{item.OrderNum} ", CreateDate = DateTime.Now, State = 1 })); item.State = (int)MiniAppEntOrderState.退款成功; if (newState.HasValue) { item.State = newState.Value; } tran.Add($" update SaveMoneySetUser set AccountMoney = AccountMoney + {item.refundFee} where id = {saveMoneyUser.Id} ; "); tran.Add($" update EntGoodsOrder set State = {item.State },outOrderDate = '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',Remark = @Remark where Id = {item.Id} and state <> {item.State} ; ", new MySqlParameter[] { new MySqlParameter("@Remark", item.Remark) });//防止重复退款 //记录订单储值支付退款日志 tran.Add(EntGoodsOrderLogBLL.SingleModel.BuildAddSql(new EntGoodsOrderLog() { GoodsOrderId = item.Id, UserId = item.UserId, LogInfo = $" 储值支付订单退款成功:{item.refundFee * 0.01} 元 ", CreateDate = DateTime.Now })); bool isSuccess = ExecuteTransaction(tran.sqlArray, tran.ParameterArray); if (isSuccess) { //发给用户退款通知 object orderData = TemplateMsg_Miniapp.EnterpriseGetTemplateMessageData(item, SendTemplateMessageTypeEnum.专业版订单退款通知, "商家操作退款"); TemplateMsg_Miniapp.SendTemplateMessage(item.UserId, SendTemplateMessageTypeEnum.专业版订单退款通知, TmpType.小程序专业模板, orderData); } return(isSuccess); } } else { return(false); } return(true); }
public ActionResult AddStore() { returnObj = new Return_Msg_APP(); returnObj.code = "200"; string appId = Context.GetRequest("appId", string.Empty); int userId = Context.GetRequestInt("myCardId", 0); int agentInfoId = Context.GetRequestInt("agentInfoId", 0); if (string.IsNullOrEmpty(appId) || userId <= 0) { returnObj.Msg = "参数错误"; return(Json(returnObj)); } XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId); if (r == null) { returnObj.Msg = "小程序未授权"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } Agentinfo agentinfo = AgentinfoBLL.SingleModel.GetModelByAccoundId(r.AccountId.ToString()); //if (agentinfo == null)//本平台代理信息 //{ // returnObj.Msg = "入驻异常"; // return Json(returnObj, JsonRequestBehavior.AllowGet); //} string banners = Context.GetRequest("banners", string.Empty); if (string.IsNullOrEmpty(banners) || banners.Split(',').Length <= 0) { returnObj.Msg = "轮播图至少一张"; return(Json(returnObj)); } string storeName = Context.GetRequest("storeName", string.Empty); if (string.IsNullOrEmpty(storeName) || storeName.Length >= 20) { returnObj.Msg = "店铺名称不能为空并且不能超过20字符"; return(Json(returnObj)); } string lngStr = Context.GetRequest("lng", string.Empty); string latStr = Context.GetRequest("lat", string.Empty); double lng = 0.00; double lat = 0.00; if (!double.TryParse(lngStr, out lng) || !double.TryParse(latStr, out lat)) { returnObj.Msg = "地址坐标错误"; return(Json(returnObj)); } string location = Context.GetRequest("location", string.Empty); if (string.IsNullOrEmpty(location)) { returnObj.Msg = "地址不能为空"; return(Json(returnObj)); } string storeService = Context.GetRequest("storeService", string.Empty); //if (string.IsNullOrEmpty(storeService) || storeService.Split(',').Length <= 0) //{ // returnObj.Msg = "提供服务不能为空"; // return Json(returnObj); //} string openTime = Context.GetRequest("openTime", string.Empty); //if (string.IsNullOrEmpty(openTime)) //{ // returnObj.Msg = "营业时间不能为空"; // return Json(returnObj); //} //TODO 需要验证手机+电话 string phone = Context.GetRequest("phone", string.Empty); if (string.IsNullOrEmpty(phone)) { returnObj.Msg = "请填写正确的号码"; return(Json(returnObj)); } string businessDescription = Context.GetRequest("businessDescription", string.Empty); if (string.IsNullOrEmpty(businessDescription)) { returnObj.Msg = "业务简述不能为空"; return(Json(returnObj)); } string storeDescription = Context.GetRequest("storeDescription", string.Empty); string storeImgs = Context.GetRequest("storeImgs", string.Empty); int category = Context.GetRequestInt("category", 0);//店铺类别 if (PlatStoreCategoryBLL.SingleModel.GetModel(category) == null) { returnObj.Msg = "类别选择错误!"; return(Json(returnObj)); } PlatStore platStore = PlatStoreBLL.SingleModel.GetPlatStore(userId, 1); if (platStore == null) { platStore = new PlatStore(); } AddressApi addressinfo = AddressHelper.GetAddressByApi(lngStr, latStr); if (addressinfo == null || addressinfo.result == null || addressinfo.result.address_component == null) { returnObj.Msg = "地址出错!"; return(Json(returnObj)); } if (!storeService.Contains("ServiceState")) { //表示旧版本的数据,设施服务给初始化新值 List <StoreServiceModel> list = new List <StoreServiceModel>(); list.Add(new StoreServiceModel() { ServiceState = true, ServiceName = "WIFI" }); list.Add(new StoreServiceModel() { ServiceState = true, ServiceName = "停车位" }); list.Add(new StoreServiceModel() { ServiceState = true, ServiceName = "支付宝支付" }); list.Add(new StoreServiceModel() { ServiceState = true, ServiceName = "微信支付" }); list.Add(new StoreServiceModel() { ServiceState = true, ServiceName = "刷卡支付" }); list.Add(new StoreServiceModel() { ServiceState = true, ServiceName = "空调雅座" }); list.Add(new StoreServiceModel() { ServiceState = true, ServiceName = "付费停车" }); list.Add(new StoreServiceModel() { ServiceState = true, ServiceName = "接送服务" }); storeService = Newtonsoft.Json.JsonConvert.SerializeObject(list); } string storeRemark = Context.GetRequest("storeRemark", string.Empty); platStore.StoreRemark = storeRemark; string provinceName = addressinfo.result.address_component.province; string cityName = addressinfo.result.address_component.city; string countryName = addressinfo.result.address_component.district; platStore.ProvinceCode = C_AreaBLL.SingleModel.GetCodeByName(provinceName); platStore.CityCode = C_AreaBLL.SingleModel.GetCodeByName(cityName); platStore.CountryCode = C_AreaBLL.SingleModel.GetCodeByName(countryName); platStore.AddTime = DateTime.Now; platStore.Banners = banners; platStore.BindPlatAid = r.Id; platStore.BusinessDescription = businessDescription; platStore.Category = category; platStore.Lat = lat; platStore.Lng = lng; platStore.Location = location; platStore.MyCardId = userId; platStore.Name = storeName; platStore.OpenTime = openTime; platStore.Phone = phone; platStore.StoreDescription = storeDescription; platStore.StoreImgs = storeImgs; platStore.StoreService = storeService; platStore.UpdateTime = DateTime.Now; TransactionModel TranModel = new TransactionModel(); if (platStore.Id > 0) { //表示更新 TranModel.Add(PlatStoreBLL.SingleModel.BuildUpdateSql(platStore)); PlatStoreRelation platStoreRelation = PlatStoreRelationBLL.SingleModel.GetPlatStoreRelationOwner(r.Id, platStore.Id); if (platStoreRelation == null) { returnObj.Msg = "更新异常(店铺关系找不到数据)"; return(Json(returnObj)); } platStoreRelation.Category = platStore.Category; platStoreRelation.UpdateTime = DateTime.Now; TranModel.Add(PlatStoreRelationBLL.SingleModel.BuildUpdateSql(platStoreRelation, "Category,UpdateTime")); //2.查找上级代理 #region 步代理商店铺 暂时先屏蔽 //AgentDistributionRelation agentDistributionRelationFirst = new AgentDistributionRelationBLL().GetModel(agentinfo.id); //if (agentDistributionRelationFirst != null) //{ // Agentinfo agentinfoFirst = _agentinfoBll.GetModel(agentDistributionRelationFirst.ParentAgentId); // if (agentinfoFirst != null) // { // XcxAppAccountRelation xcxAppAccountRelationFirst = _xcxappaccountrelationBll.GetModelByaccountidAndTid(agentinfoFirst.useraccountid, (int)TmpType.小未平台); // if (xcxAppAccountRelationFirst != null) // { // PlatStoreRelation platStoreRelationFist = _platStoreRelationBLL.GetPlatStoreRelationOwner(xcxAppAccountRelationFirst.Id, platStore.Id, agentinfo.id); // if (platStoreRelationFist != null) // { // platStoreRelationFist.Category = platStore.Category; // platStoreRelationFist.UpdateTime = DateTime.Now; // TranModel.Add(_platStoreRelationBLL.BuildUpdateSql(platStoreRelationFist, "Category,UpdateTime")); // } // //3.查找上级的上级代理 // AgentDistributionRelation agentDistributionRelationSecond = new AgentDistributionRelationBLL().GetModel(agentinfoFirst.id); // if (agentDistributionRelationSecond != null) // { // Agentinfo agentinfoSecond = _agentinfoBll.GetModel(agentDistributionRelationSecond.ParentAgentId); // if (agentinfoSecond != null) // { // XcxAppAccountRelation xcxAppAccountRelationSecond = _xcxappaccountrelationBll.GetModelByaccountidAndTid(agentinfoSecond.useraccountid, (int)TmpType.小未平台); // if (xcxAppAccountRelationSecond != null) // { // PlatStoreRelation platStoreRelationSecond = _platStoreRelationBLL.GetPlatStoreRelationOwner(xcxAppAccountRelationSecond.Id, platStore.Id, agentinfo.id); // platStoreRelationSecond.Category = platStore.Category; // platStoreRelationSecond.UpdateTime = DateTime.Now; // TranModel.Add(_platStoreRelationBLL.BuildUpdateSql(platStoreRelationSecond, "Category,UpdateTime")); // } // } // } // } // } //} #endregion if (TranModel.sqlArray != null && TranModel.sqlArray.Length > 0 && PlatStoreRelationBLL.SingleModel.ExecuteTransactionDataCorect(TranModel.sqlArray)) { returnObj.isok = true; returnObj.Msg = "操作成功"; return(Json(returnObj)); } else { returnObj.Msg = "更新失败"; return(Json(returnObj)); } } else { //平台入驻模式 PlatStoreAddSetting platStoreAddSetting = PlatStoreAddSettingBLL.SingleModel.GetPlatStoreAddSetting(r.Id); int addWay = platStoreAddSetting != null ? platStoreAddSetting.AddWay : 0; PlatStoreAddRules rule = new PlatStoreAddRules(); if (addWay == 1) { platStore.State = -1; int ruleId = Context.GetRequestInt("ruleId", 0); rule = PlatStoreAddRulesBLL.SingleModel.getRule(r.Id, ruleId); if (rule == null) { returnObj.Msg = "入驻套餐不存在!"; return(Json(returnObj)); } platStore.YearCount = rule.YearCount; platStore.CostPrice = rule.CostPrice; } //表示入驻平台 需要将该入驻店铺同步到平台的1 2级代理商 int storeId = Convert.ToInt32(PlatStoreBLL.SingleModel.Add(platStore)); if (storeId > 0) { #region 数据同步 //插入关系表 才算成功 店铺数据都是从关系表获取才算有效的 //1.先将入驻到平台的插入 PlatStoreRelation platStoreRelation = new PlatStoreRelation(); platStoreRelation.StoreId = storeId; platStoreRelation.State = 1; platStoreRelation.FromType = 0; platStoreRelation.Aid = r.Id; platStoreRelation.Category = platStore.Category; platStoreRelation.AgentId = agentinfo != null ? agentinfo.id : agentInfoId; platStoreRelation.AddTime = DateTime.Now; platStoreRelation.UpdateTime = DateTime.Now; TranModel.Add(PlatStoreRelationBLL.SingleModel.BuildAddSql(platStoreRelation)); //2.查找上级代理 #region 暂时先屏蔽 //AgentDistributionRelation agentDistributionRelationFirst = new AgentDistributionRelationBLL().GetModel(agentinfo.id); //if (agentDistributionRelationFirst != null) //{ // Agentinfo agentinfoFirst = _agentinfoBll.GetModel(agentDistributionRelationFirst.ParentAgentId); // if (agentinfoFirst != null) // { // XcxAppAccountRelation xcxAppAccountRelationFirst = _xcxappaccountrelationBll.GetModelByaccountidAndTid(agentinfoFirst.useraccountid, (int)TmpType.小未平台); // if (xcxAppAccountRelationFirst != null) // { // PlatStoreRelation platStoreRelationFist = new PlatStoreRelation(); // platStoreRelationFist.StoreId = storeId; // platStoreRelationFist.State = 0; // platStoreRelationFist.FromType = 1; // platStoreRelationFist.Aid = xcxAppAccountRelationFirst.Id; // platStoreRelationFist.Category = platStore.Category; // platStoreRelationFist.AgentId = agentinfo.id; // platStoreRelationFist.AddTime = DateTime.Now; // platStoreRelationFist.UpdateTime = DateTime.Now; // TranModel.Add(_platStoreRelationBLL.BuildAddSql(platStoreRelationFist)); // //3.查找上级的上级代理 // AgentDistributionRelation agentDistributionRelationSecond = new AgentDistributionRelationBLL().GetModel(agentinfoFirst.id); // if (agentDistributionRelationSecond != null) // { // Agentinfo agentinfoSecond = _agentinfoBll.GetModel(agentDistributionRelationSecond.ParentAgentId); // if (agentinfoSecond != null) // { // XcxAppAccountRelation xcxAppAccountRelationSecond = _xcxappaccountrelationBll.GetModelByaccountidAndTid(agentinfoSecond.useraccountid, (int)TmpType.小未平台); // if (xcxAppAccountRelationSecond != null) // { // PlatStoreRelation platStoreRelationSecond = new PlatStoreRelation(); // platStoreRelationSecond.StoreId = storeId; // platStoreRelationSecond.State = 0; // platStoreRelationSecond.FromType = 1; // platStoreRelationSecond.Aid = xcxAppAccountRelationSecond.Id; // platStoreRelationSecond.Category = platStore.Category; // platStoreRelationSecond.AgentId = agentinfo.id; // platStoreRelationSecond.AddTime = DateTime.Now; // platStoreRelationSecond.UpdateTime = DateTime.Now; // TranModel.Add(_platStoreRelationBLL.BuildAddSql(platStoreRelationSecond)); // } // } // } // } // } //} #endregion #endregion int orderid = 0; if (addWay == 1) { CityMorders order = new CityMorders() { FuserId = storeId, Fusername = storeName, TuserId = 0, OrderType = (int)ArticleTypeEnum.PlatAddStorePay, ActionType = (int)miniAppBuyMode.微信支付, Addtime = DateTime.Now, Percent = 99,//不收取服务费 userip = WebHelper.GetIP(), payment_status = 0, Status = 0, CitySubId = 0,//无分销,默认为0 PayRate = 1, appid = appId, Articleid = rule.Id, CommentId = platStore.YearCount, MinisnsId = r.Id, payment_free = platStore.CostPrice, ShowNote = $"平台版店铺入驻收费付款{platStore.CostPrice * 0.01}元" }; string no = WxPayApi.GenerateOutTradeNo(); order.orderno = no; order.trade_no = no; orderid = Convert.ToInt32(_cityMordersBLL.Add(order)); } if (TranModel.sqlArray != null && TranModel.sqlArray.Length > 0) { if (PlatStoreRelationBLL.SingleModel.ExecuteTransactionDataCorect(TranModel.sqlArray)) { if (orderid <= 0 && addWay == 1) { returnObj.Msg = "入驻失败(订单生成失败)"; return(Json(returnObj)); } returnObj.dataObj = new { storeId = storeId, orderid = orderid }; returnObj.isok = true; returnObj.Msg = "入驻成功"; return(Json(returnObj)); } else { platStore.State = -1; platStore.UpdateTime = DateTime.Now; PlatStoreBLL.SingleModel.Update(platStore, "State,UpdateTime"); returnObj.Msg = "入驻失败"; return(Json(returnObj)); } } else { returnObj.dataObj = storeId; returnObj.isok = true; returnObj.Msg = "入驻成功"; return(Json(returnObj)); } } else { returnObj.Msg = "入驻失败(请联系客服)"; return(Json(returnObj)); } } }
/// <summary> /// 拼团退款 /// </summary> /// <param name="item"></param> /// <param name="type">0:拼团失败退款,1:店主手动退款</param> /// <returns></returns> public bool EntGroupReFundQueue(EntGoodsOrder item, ref string msg) { int paytype = item.BuyMode; TransactionModel tranmodel = new MiniApp.TransactionModel(); EntGroupSponsor csg = EntGroupSponsorBLL.SingleModel.GetModel(item.GroupId); if (csg == null) { msg = "小程序拼团商品不存在啦=" + item.GroupId; item.State = (int)MiniAppEntOrderState.已取消; EntGoodsOrderBLL.SingleModel.Update(item, "State"); return(false); } EntGroupSponsor gsinfo = EntGroupSponsorBLL.SingleModel.GetModel(item.GroupId); if (gsinfo == null) { msg = "小程序拼团团购不存在啦=" + item.GroupId; item.State = (int)MiniAppEntOrderState.已取消; EntGoodsOrderBLL.SingleModel.Update(item, "State"); return(false); } if (item.BuyPrice <= 0) { msg = "xxxxxxxxxxxxx小程序拼团价格为0不需要退款=" + item.Id; return(false); } if (item.State == (int)MiniAppEntOrderState.退款成功) { msg = "xxxxxxxxxxxxx小程序拼团状态有误,不能退款=" + item.Id + ",paystate=" + item.State + "," + (int)MiniAppEntOrderState.退款成功; return(false); } item.State = (int)MiniAppEntOrderState.退款成功; //更新用户订单状态 tranmodel.Add($"update EntGoodsOrder set State={item.State} where id={item.Id}"); //判断是否是微信支付 if (paytype == (int)miniAppBuyMode.微信支付) { CityMorders order = _cityMordersBLL.GetModel(item.OrderId); if (order == null) { msg = "xxxxxxxxxxxxxxxxxx小程序拼团退款查不到支付订单 ID=" + item.Id; item.State = (int)MiniappPayState.已失效; EntGoodsOrderBLL.SingleModel.Update(item, "State"); return(false); } //插入退款队列 ReFundQueue reModel = new ReFundQueue(); reModel.minisnsId = -5; reModel.money = item.BuyPrice; reModel.orderid = item.OrderId; reModel.traid = order.trade_no; reModel.addtime = DateTime.Now; reModel.note = "小程序专业版拼团退款"; reModel.retype = 1; tranmodel.Add(base.BuildAddSql(reModel)); } else if (paytype == (int)miniAppBuyMode.储值支付) { //储值卡退款 tranmodel.Add(SaveMoneySetUserBLL.SingleModel.GetCommandCarPriceSql(item.AppId, item.UserId, item.BuyPrice, 1, item.OrderId, item.OrderNum).ToArray()); if (tranmodel.sqlArray.Length <= 0) { msg = "xxxxxxxxxxxxxxxxxx专业版拼团储值卡退款失败,ID=" + item.Id; return(false); } } if (tranmodel.sqlArray.Length <= 0) { msg = "xxxxxxxxxxxxxxxxxx专业版拼团退款失败,ID=" + item.Id; return(false); } if (!ExecuteTransactionDataCorect(tranmodel.sqlArray, tranmodel.ParameterArray)) { msg = "xxxxxxxxxxxxxxxxxx专业版拼团退款事务执行失败,ID=" + item.Id + "sql:" + string.Join(";", tranmodel.sqlArray); return(false); } if (!EntGoodsOrderBLL.SingleModel.updateStock(item, (int)MiniAppEntOrderState.退款成功)) { msg = "xxxxxxxxxxxxxxxxxx专业版拼团退款更新库存失败,ID=" + item.Id; return(false); } msg = "xxxxxxxxxxxxxxxxxx专业版拼团退款成功,ID=" + item.Id; //根据订单释放库存 return(true); }
/// <summary> /// 砍价退款(照搬后台的) /// </summary> /// <param name="bargainUser"></param> /// <param name="bargain"></param> /// <param name="appId"></param> /// <param name="msg"></param> /// <returns></returns> public bool BargainReFundQueue(BargainUser bargainUser, Bargain bargain, string appId, out string msg) { bargainUser.State = 2; bargainUser.outOrderDate = DateTime.Now; if (bargainUser.PayType == (int)miniAppBuyMode.储值支付) { bargainUser.refundFee = bargainUser.CurrentPrice + bargain.GoodsFreight; bargainUser.State = 3; SaveMoneySetUser saveMoneyUser = SaveMoneySetUserBLL.SingleModel.getModelByUserId(appId, bargainUser.UserId); TransactionModel tran = new TransactionModel(); tran.Add(SaveMoneySetUserLogBLL.SingleModel.BuildAddSql(new SaveMoneySetUserLog() { AppId = appId, UserId = bargainUser.UserId, MoneySetUserId = saveMoneyUser.Id, Type = 1, BeforeMoney = saveMoneyUser.AccountMoney, AfterMoney = saveMoneyUser.AccountMoney + bargainUser.refundFee, ChangeMoney = bargainUser.refundFee, ChangeNote = $"小程序砍价购买商品[{bargainUser.BName}]退款,订单号:{bargainUser.OrderId} ", CreateDate = DateTime.Now, State = 1 })); tran.Add($" update SaveMoneySetUser set AccountMoney = AccountMoney + {bargainUser.refundFee} where id = {saveMoneyUser.Id} ; "); string updateBargainUser = BargainUserBLL.SingleModel.BuildUpdateSql(bargainUser, "State,outOrderDate,refundFee"); tran.Add(updateBargainUser); bool isok = BargainBLL.SingleModel.ExecuteTransactionDataCorect(tran.sqlArray); if (isok) { object orderData = TemplateMsg_Miniapp.BargainGetTemplateMessageData(bargainUser, SendTemplateMessageTypeEnum.价订单退款通知, "商家操作退款"); TemplateMsg_Miniapp.SendTemplateMessage(bargainUser, SendTemplateMessageTypeEnum.价订单退款通知, orderData); msg = "退款成功,请查看账户余额!"; } else { msg = "退款异常!";//返回订单信息 } return(isok); } else { bool isok = false; CityMorders order = _cityMordersBLL.GetModel(bargainUser.CityMordersId); if (order == null) { msg = "订单信息有误!"; return(isok); } bargainUser.refundFee = bargainUser.CurrentPrice + bargain.GoodsFreight; if (BargainUserBLL.SingleModel.Update(bargainUser, "State,outOrderDate,refundFee")) { ReFundQueue reModel = new ReFundQueue { minisnsId = -5, money = bargainUser.refundFee, orderid = order.Id, traid = order.trade_no, addtime = DateTime.Now, note = "小程序砍价订单退款", retype = 1 }; try { int funid = Convert.ToInt32(base.Add(reModel)); if (funid > 0) { object orderData = TemplateMsg_Miniapp.BargainGetTemplateMessageData(bargainUser, SendTemplateMessageTypeEnum.价订单退款通知, "商家操作退款"); TemplateMsg_Miniapp.SendTemplateMessage(bargainUser, SendTemplateMessageTypeEnum.价订单退款通知, orderData); isok = true; msg = "操作成功,已提交退款申请!"; return(isok); } else { isok = false; msg = "退款异常插入队列小于0!"; return(isok); } } catch (Exception ex) { log4net.LogHelper.WriteInfo(GetType(), $"{ex.Message} xxxxxxxxxxxxxxxx小程序砍价退款订单插入队列失败 ID={order.Id}"); isok = false; msg = "退款异常(插入队列失败)!"; return(isok); } } else { isok = false; msg = "退款异常!"; return(isok); } } }
/// <summary> /// 拼团退款 /// </summary> /// <param name="item"></param> /// <param name="type">0:拼团失败退款,1:店主手动退款</param> /// <returns></returns> public bool GroupReFundQueue(GroupUser item, ref string msg, int type = 0) { //0:微信支付,1:储值卡支付 int paytype = item.PayType; TransactionModel tranmodel = new TransactionModel(); Groups csg = GroupsBLL.SingleModel.GetModel(item.GroupId); if (csg == null) { msg = "小程序拼团商品不存在啦=" + item.GroupId; item.State = (int)MiniappPayState.已失效; GroupUserBLL.SingleModel.Update(item, "State"); return(false); } GroupSponsor gsinfo = GroupSponsorBLL.SingleModel.GetModel(item.GroupSponsorId); if (gsinfo == null && item.IsGroup == 1) { msg = "小程序拼团团购不存在啦=" + item.GroupSponsorId; item.State = (int)MiniappPayState.已失效; GroupUserBLL.SingleModel.Update(item, "State"); return(false); } if (item.BuyPrice <= 0) { msg = "xxxxxxxxxxxxx小程序拼团价格为0不需要退款=" + item.Id; return(false); } if (item.PayState == (int)MiniappPayState.已退款) { msg = "xxxxxxxxxxxxx小程序拼团状态有误,不能退款=" + item.Id + ",paystate=" + item.PayState + "," + (int)MiniappPayState.已退款; return(false); } item.State = (int)MiniappPayState.已退款; //更新用户订单状态 tranmodel.Add($"update GroupUser set State={item.State} where id={item.Id}"); //判断是否是微信支付 if (paytype == 0) { CityMorders order = _cityMordersBLL.GetModel(item.OrderId); if (order == null) { msg = "xxxxxxxxxxxxxxxxxx小程序拼团退款查不到支付订单 ID=" + item.Id; item.State = (int)MiniappPayState.已失效; GroupUserBLL.SingleModel.Update(item, "State"); return(false); } //插入退款队列 ReFundQueue reModel = new ReFundQueue(); reModel.minisnsId = -5; reModel.money = item.BuyPrice; reModel.orderid = item.OrderId; reModel.traid = order.trade_no; reModel.addtime = DateTime.Now; reModel.note = "小程序拼团退款"; reModel.retype = 1; tranmodel.Add(base.BuildAddSql(reModel)); } else if (paytype == 1) { //储值卡退款 tranmodel.Add(SaveMoneySetUserBLL.SingleModel.GetCommandCarPriceSql(item.AppId, item.ObtainUserId, item.BuyPrice, 1, item.OrderId, item.OrderNo).ToArray()); if (tranmodel.sqlArray.Length <= 0) { msg = "xxxxxxxxxxxxxxxxxx拼团储值卡退款失败,ID=" + item.Id; return(false); } } //是店主手动退款不加库存 --统一,只要是退款就加库存 //if (type == 0) { if (gsinfo.State == 2 && item.IsGroup == 1) { msg = "小程序团购成功,不能退款=" + item.GroupSponsorId; return(false); } //退款成功,更新剩余数量 tranmodel.Add($"update groups set RemainNum ={(csg.RemainNum + item.BuyNum)} where id={csg.Id}"); //LogHelper.WriteInfo(GetType(), $"修改拼团失败库存:update groups set RemainNum ={(csg.RemainNum + item.BuyNum)} where id={csg.Id}"); } if (tranmodel.sqlArray.Length <= 0) { msg = "xxxxxxxxxxxxxxxxxx拼团退款失败,ID=" + item.Id; return(false); } if (!ExecuteTransactionDataCorect(tranmodel.sqlArray, tranmodel.ParameterArray)) { msg = "xxxxxxxxxxxxxxxxxx拼团退款事务执行失败,ID=" + item.Id + "sql:" + string.Join(";", tranmodel.sqlArray); return(false); } XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByAppid(item.AppId); if (xcx == null) { log4net.LogHelper.WriteError(GetType(), new Exception($"发送模板消息,参数不足,XcxAppAccountRelation_null:appId = {item.AppId}")); return(true); } //发给用户发货通知 object groupData = TemplateMsg_Miniapp.GroupGetTemplateMessageData("商家操作退款", item, SendTemplateMessageTypeEnum.拼团基础版订单退款通知); TemplateMsg_Miniapp.SendTemplateMessage(item.ObtainUserId, SendTemplateMessageTypeEnum.拼团基础版订单退款通知, xcx.Type, groupData); msg = "xxxxxxxxxxxxxxxxxx拼团退款成功,ID=" + item.Id; return(true); }
public ActionResult GetOrderDetail() { string appId = Context.GetRequest("appId", string.Empty); int guid = Context.GetRequestInt("guid", 0); if (string.IsNullOrEmpty(appId)) { return(Json(new { isok = false, msg = "参数错误" }, JsonRequestBehavior.AllowGet)); } if (guid <= 0) { return(Json(new { isok = false, msg = "订单Id不能小于0" }, JsonRequestBehavior.AllowGet)); } XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId); if (r == null) { return(Json(new { isok = false, msg = "小程序未授权" }, JsonRequestBehavior.AllowGet)); } GroupUser groupumodel = GroupUserBLL.SingleModel.GetModel(guid); if (groupumodel == null) { return(Json(new { isok = false, msg = "订单数据不存在" }, JsonRequestBehavior.AllowGet)); } Groups group = GroupsBLL.SingleModel.GetModel(groupumodel.GroupId); if (group == null) { return(Json(new { isok = false, msg = "拼团商品不存在" }, JsonRequestBehavior.AllowGet)); } Store store = StoreBLL.SingleModel.GetModel(group.StoreId); if (store == null) { return(Json(new { isok = false, msg = "店铺不存在" }, JsonRequestBehavior.AllowGet)); } string orderNo = ""; if (groupumodel.PayType == 0) { CityMorders citymorder = _cityMordersBLL.GetModel(groupumodel.OrderId); if (citymorder == null) { return(Json(new { isok = false, msg = "订单不存在" }, JsonRequestBehavior.AllowGet)); } orderNo = citymorder.orderno; } else { orderNo = groupumodel.OrderNo; } GroupSponsor groupspormodel = new GroupSponsor(); //如果是拼团查找拼团信息 if (groupumodel.IsGroup == 1) { groupspormodel = GroupSponsorBLL.SingleModel.GetModel(groupumodel.GroupSponsorId); if (groupspormodel == null) { return(Json(new { isok = false, msg = "拼团不存在" }, JsonRequestBehavior.AllowGet)); } } C_UserInfo userinfo = C_UserInfoBLL.SingleModel.GetModel(groupumodel.ObtainUserId); var postdata = new { groupumodel.Address, groupumodel.BuyPrice, groupumodel.PayType, groupumodel.Note, isheader = groupspormodel.SponsorUserId == groupumodel.ObtainUserId, CreateDate = groupumodel.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), SendGoodTime = groupumodel.SendGoodTime.ToString("yyyy-MM-dd HH:mm:ss"), RecieveGoodTime = groupumodel.RecieveGoodTime.ToString("yyyy-MM-dd HH:mm:ss"), PayTime = groupumodel.PayTime.ToString("yyyy-MM-dd HH:mm:ss"), groupumodel.StorerRemark, groupumodel.State, isGroup = groupumodel.IsGroup, num = groupumodel.BuyNum, username = groupumodel.UserName, phone = groupumodel.Phone, group.HeadDeduct, group.ImgUrl, group.DiscountPrice, group.OriginalPrice, group.GroupName, storemobile = store.TelePhone, orderno = orderNo, }; return(Json(new { isok = true, msg = "数据获取成功", postdata = postdata }, JsonRequestBehavior.AllowGet)); }
public string PayByWechat(FlashDealItem item, CityMorders payOrder) { return(AddUserPayment(item: item, userId: payOrder.FuserId, payPrice: payOrder.payment_free, payWay: miniAppBuyMode.微信支付, payOrderId: payOrder.Id)); }