Exemple #1
0
        //调起支付
        private bool UpPayClick(int id, object obj)
        {
            NativeHandle handle = new NativeHandle();

            if (type == payType.alipay)
            {
                object payData = PayOrderInterfaceMgr.Instance.GetDatas(LoginModel.Instance.Uid, Urltype.alipay, PayOrderInterfaceMgr.Instance.payfor, GetPayCount());
                if (payData != null)
                {
                    handle.Alipay(payData.ToString());

                    type = payType.none;
                }
            }
            else if (type == payType.wechat)
            {
                object o = PayOrderInterfaceMgr.Instance.GetDatas(LoginModel.Instance.Uid, Urltype.wx, PayOrderInterfaceMgr.Instance.payfor, GetPayCount());
                if (o != null)
                {
                    PayData payData = o as PayData;
                    handle.WechatPay(payData.appid, payData.partnerid, payData.prepayid, payData.noncestr, payData.timestamp, payData.package, payData.sign);
                    type = payType.none;
                }
            }
            else
            {
                SystemMsgView.SystemFunction(Function.Tip, Info.Chooseone);
            }
            return(false);
        }
Exemple #2
0
        private void OnEnsurePayClik()
        {
            //直接登录模式直接调起
            if (PayOrderInterfaceMgr.Instance.payfor == PayFor.Login && !PlayerSave.HasKey("Login"))
            {
                NativeHandle handle = new NativeHandle();
                if (type == payType.alipay)
                {
                    object payData = PayOrderInterfaceMgr.Instance.GetDatas(LoginModel.Instance.Uid, Urltype.alipay, PayOrderInterfaceMgr.Instance.payfor, GetPayCount());
                    if (payData != null)
                    {
                        handle.Alipay(payData.ToString());

                        Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", payData.ToString(), "test1"));
                    }
                }
                else if (type == payType.wechat)
                {
                    object o = PayOrderInterfaceMgr.Instance.GetDatas(LoginModel.Instance.Uid, Urltype.wx, PayOrderInterfaceMgr.Instance.payfor, GetPayCount());
                    if (o != null)
                    {
                        PayData payData = o as PayData;
                        handle.WechatPay(payData.appid, payData.partnerid, payData.prepayid, payData.noncestr, payData.timestamp, payData.package, payData.sign);
                    }
                }
                else
                {
                    SystemMsgView.SystemFunction(Function.Tip, Info.Chooseone);
                }
            }
            else if (PayOrderInterfaceMgr.Instance.payfor == PayFor.Exchange)
            {
                CommitViewModel cvm = CommitViewModel.Instance;
                CommitController.Instance.OidExchangeReq(LoginModel.Instance.Uid, 1, cvm.Name, cvm.Phone, cvm.Province, cvm.City, cvm.Country, cvm.SelectPinpai, cvm.Address, cvm.Beaty, (int)type);
            }
            EnsurePay.onClick.RemoveListener(OnEnsurePayClik);
        }
Exemple #3
0
        public object GetDatas(int uid, Urltype type, PayFor payfor, int count = 0)
        {
            string url = "";

            switch (type)
            {
            case Urltype.wx:
                if (payfor == PayFor.Login)
                {
                    url = @"http://" + LoginConfig.Instance.serverIP + ":8080/api/unifiedorder?uid=" + uid + "&type=init";
                    if (string.IsNullOrEmpty(url))
                    {
                        SystemMsgView.SystemFunction(Function.Tip, Info.ConnectFailed2);
                        return(null);
                    }
                    string _json = GetPage(url);
                    if (string.IsNullOrEmpty(_json))
                    {
                        SystemMsgView.SystemFunction(Function.Tip, Info.ConnectFailed2);

                        return(null);
                    }
                    textData = JsonUtility.FromJson <PayData>(_json);

                    Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", textData.ToString(), "test1"));

                    return(textData);
                }
                else if (payfor == PayFor.Exchange)
                {
                    url = @"http://" + LoginConfig.Instance.serverIP + ":8080/api/unifiedorder?uid=" + uid + "&type=exchange" + "&count=" +
                          count;



                    if (string.IsNullOrEmpty(url))
                    {
                        SystemMsgView.SystemFunction(Function.Tip, Info.ConnectFailed2);
                        return(null);
                    }
                    string _json = GetPage(url);
                    if (string.IsNullOrEmpty(_json))
                    {
                        SystemMsgView.SystemFunction(Function.Tip, Info.ConnectFailed2);

                        return(null);
                    }
                    textData = JsonUtility.FromJson <PayData>(_json);
                    Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", textData.ToString(), "test1"));

                    return(textData);
                }

                break;

            case Urltype.alipay:
                if (payfor == PayFor.Login)
                {
                    url = @"http://" + LoginConfig.Instance.serverIP + ":8080/api/aliPay?uid=" + uid + "&type=init";
                    if (string.IsNullOrEmpty(url))
                    {
                        SystemMsgView.SystemFunction(Function.Tip, Info.ConnectFailed2);
                        return(null);
                    }
                    string payorder = GetPage(url);
                    Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", payorder.ToString(), "test1"));

                    return(payorder);
                }
                else if (payfor == PayFor.Exchange)
                {
                    url = @"http://" + LoginConfig.Instance.serverIP + ":8080/api/aliPay?uid=" + uid + "&type=exchange" + "&count=" +
                          count;
                    if (string.IsNullOrEmpty(url))
                    {
                        SystemMsgView.SystemFunction(Function.Tip, Info.ConnectFailed2);
                        return(null);
                    }
                    string _json = GetPage(url);
                    if (string.IsNullOrEmpty(_json))
                    {
                        SystemMsgView.SystemFunction(Function.Tip, Info.ConnectFailed2);

                        return(null);
                    }
                    Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", _json.ToString(), "test1"));

                    return(_json);
                }
                return(textData);

                break;
            }
            return(textData);
        }