public void WxPayResult(string result) { MyLog.InfoWithFrame(name, string.Format("wxpay result: {0}", result)); WxPayResultTime = Time.time; if (string.IsNullOrEmpty(result)) { return; } WxPayResultData = JsonUtility.FromJson <WxPayResult>(result); }
private void ProcessWxPayResult(WxPayResult res) { if (res == null) { // 支付失败了,支付宝结果数据解析失败。 EnableComponent(false, false, true); SetStateTxt(string.Format("<color=red>支付失败!</color>\n如有疑问请联系下方客服QQ{0}", !string.IsNullOrEmpty(OutTradeNo) ? "\n订单号:" + OutTradeNo : "")); StopPay(); AnalyticPayFail("wxpay_res_parse_error"); return; } if (res.Result == WxPayResult.Ok) { // 支付成功。 EnableComponent(false, true, true); SetStateTxt("恭喜您,充值成功^_^\n马上请求发货"); AnalyticPayOk(); } else { // 支付失败。 if (res.Result == WxPayResult.Cancel) { // 玩家取消支付。 EnableComponent(false, false, true); SetStateTxt("<color=red>玩家取消订单</color>"); AnalyticPayFail("wxpay_cancel"); } else { EnableComponent(false, false, true); SetStateTxt(string.Format("<color=red>支付失败!</color>\n请联系下方客服QQ{0}", !string.IsNullOrEmpty(OutTradeNo) ? "\n订单号:" + OutTradeNo : "")); AnalyticPayFail("wxpay_fail"); } StopPay(); } }
public void WxPay(string order) { WxPayResultTime = 0; WxPayResultData = null; if (string.IsNullOrEmpty(order)) { WxPayResultTime = Time.time; WxPayResultData = new WxPayResult(Dmm.Pay.WxPayResult.Error, "订单数据发生错误,无法支付"); return; } #if UNITY_ANDROID _android.WxPayAndroid(order); #endif #if UNITY_IOS _ios.WxPay(order); #endif }