/// <summary> /// 钻石充值下单 /// </summary> /// <param name="configid"></param> /// <param name="paytype"></param> /// <param name="openid"></param> /// <param name="subtype"></param> /// <returns>AjaxJsonValid</returns> private static AjaxJsonValid CreatePayOrder(int configid, string paytype, string openid, string subtype) { //下单信息 OnLinePayOrder order = new OnLinePayOrder { UserID = _userid, ConfigID = configid, OrderAddress = GameRequest.GetUserIP() }; switch (paytype) { case "wx": order.ShareID = 101; order.OrderID = Fetch.GetOrderIDByPrefix("WXAPP"); break; case "zfb": order.ShareID = 201; order.OrderID = Fetch.GetOrderIDByPrefix("ZFBAPP"); break; case "hwx": order.ShareID = 102; order.OrderID = Fetch.GetOrderIDByPrefix("HWX"); break; case "lq": order.ShareID = 301; order.OrderID = Fetch.GetOrderIDByPrefix("360LQ"); break; default: _ajv.code = (int)ApiCode.VertyParamErrorCode; _ajv.msg = string.Format(EnumHelper.GetDesc(ApiCode.VertyParamErrorCode), " paytype(充值类型) 错误"); return(_ajv); } //下单操作 Message umsg = FacadeManage.aideTreasureFacade.CreatePayOrderInfo(order, _device); if (umsg.Success) { OnLinePayOrder orderReturn = umsg.EntityList[0] as OnLinePayOrder; if (paytype == "wx" || paytype == "hwx") { _ajv.SetDataItem("PayPackage", GetWxPayPackage(orderReturn, paytype, openid, GameRequest.GetCurrentFullHost())); } else if (paytype == "lq") { LQPay.LQPayRequest request = new LQPay.LQPayRequest(orderReturn, subtype == "zfb" ? "alipay" : "weixin"); _ajv.SetDataItem("PayUrl", HttpUtility.UrlDecode(LQPay.GetPayPackage(request.ToUrl("PayUrl")))); } _ajv.SetDataItem("OrderID", orderReturn?.OrderID ?? ""); } _ajv.SetValidDataValue(umsg.Success); _ajv.code = umsg.MessageID; _ajv.msg = umsg.Content; return(_ajv); }
/// <summary> /// 钻石充值下单 /// </summary> /// <param name="configid"></param> /// <param name="paytype"></param> /// <param name="openid"></param> /// <param name="subtype"></param> /// <returns>AjaxJsonValid</returns> private static AjaxJsonValid CreatePayOrder(int configid, string paytype, string openid, string subtype) { //下单信息 OnLinePayOrder order = new OnLinePayOrder { UserID = _userid, ConfigID = configid, OrderAddress = GameRequest.GetUserIP() }; switch (paytype) { case "wx": order.ShareID = 101; order.OrderID = Fetch.GetOrderIDByPrefix("WXAPP"); break; case "zfb": order.ShareID = 201; order.OrderID = Fetch.GetOrderIDByPrefix("ZFBAPP"); break; case "hwx": order.ShareID = 102; order.OrderID = Fetch.GetOrderIDByPrefix("HWX"); break; case "lq": order.ShareID = 301; order.OrderID = Fetch.GetOrderIDByPrefix("360LQ"); break; case "jft": switch (subtype) { case "wx": order.ShareID = 302; order.OrderID = Fetch.GetOrderIDByPrefix("JFTH5WX"); break; case "zfb": order.ShareID = 303; order.OrderID = Fetch.GetOrderIDByPrefix("JFTH5ZFB"); break; default: order.ShareID = 300; order.OrderID = Fetch.GetOrderIDByPrefix("JFT"); break; } break; default: _ajv.code = (int)ApiCode.VertyParamErrorCode; _ajv.msg = string.Format(EnumHelper.GetDesc(ApiCode.VertyParamErrorCode), " paytype(充值类型) 错误"); return(_ajv); } //下单操作 Message umsg = FacadeManage.aideTreasureFacade.CreatePayOrderInfo(order, _device); if (umsg.Success) { OnLinePayOrder orderReturn = umsg.EntityList[0] as OnLinePayOrder; if (paytype == "wx" || paytype == "hwx") { _ajv.SetDataItem("PayPackage", GetWxPayPackage(orderReturn, paytype, openid, GameRequest.GetCurrentFullHost())); } else if (paytype == "lq") { LQPay.LQPayRequest request = new LQPay.LQPayRequest(orderReturn, subtype == "zfb" ? "alipay" : "weixin"); _ajv.SetDataItem("PayUrl", HttpUtility.UrlDecode(LQPay.GetPayPackage(request.ToUrl("PayUrl")))); } else if (paytype == "jft") { JFTPay.JFTH5Request request = new JFTPay.JFTH5Request(orderReturn?.OrderID, orderReturn?.Amount.ToString("F2"), subtype == "zfb" ? "ZFB" : "WX", orderReturn?.GameID.ToString(), Utility.UserIP.Replace(".", "_")) { p25_terminal = string.IsNullOrEmpty(GameRequest.GetString("terminaltype")) ? "3" : GameRequest.GetString("terminaltype") }; //需要手机传 IOS:2 Android:3 if (AppConfig.Mode == AppConfig.CodeMode.Dev) //测试开发用,正式时请注释掉此段代码 { JFTPay.JFTH5Notify notify = new JFTPay.JFTH5Notify(orderReturn); _ajv.SetDataItem("ReturnUrlForTest", notify.TestNotifyUrl()); } _ajv.SetDataItem("PayUrl", JFTPay.Config.JFTH5Url); _ajv.SetDataItem("Params", request.UrlParams()); } _ajv.SetDataItem("OrderID", orderReturn?.OrderID ?? ""); } _ajv.SetValidDataValue(umsg.Success); _ajv.code = umsg.MessageID; _ajv.msg = umsg.Content; return(_ajv); }