/*--------------------------------------PayFor------------------------------------------*/
        public int AddPayFor(PayFor ld)
        {
            string sqlstr = "INSERT INTO db_p2_payfor (PAF_ID, PAF_DES)VALUES(" +
                            ld.Id + ", '" +
                            ld.Description + "');";
            int result = MySqlHelper.ExecuteNonQuery(sqlstr);

            return(result);
        }
        public PayFor SearchPayFor(ushort id)
        {
            string    sqlstr = "SELECT PAF_ID, PAF_DES FROM db_p2_payfor WHERE PAF_ID=";
            DataSet   ds     = MySqlHelper.ExecuteQuery(sqlstr + id);
            DataTable dt     = ds.Tables[0];

            PayFor temp = new PayFor();

            temp.Id          = ushort.Parse(dt.Rows[0][0].ToString());
            temp.Description = dt.Rows[0][1].ToString();

            return(temp);
        }
        public IList <PayFor> SearchPayFor()
        {
            string    sqlstr = "SELECT PAF_ID, PAF_DES FROM db_p2_payfor";
            DataSet   ds     = MySqlHelper.ExecuteQuery(sqlstr);
            DataTable dt     = ds.Tables[0];

            IList <PayFor> result = new List <PayFor>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PayFor temp = new PayFor();

                temp.Id          = ushort.Parse(dt.Rows[i][0].ToString());
                temp.Description = dt.Rows[i][1].ToString();

                result.Add(temp);
            }
            return(result);
        }
Esempio n. 4
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);
        }