Beispiel #1
0
        /// <summary>
        /// 查询用户余额GET
        /// </summary>
        /// <param name="phone">手机号</param>
        /// <param name="coin_name">币种名称:BCCB, FBCC</param>
        /// <returns>返回调用结果</returns>
        public static decimal MB(string phone, string coin_name)
        {
            decimal b = 0;

            try
            {
                SortedDictionary <string, string> dic = new SortedDictionary <string, string>();
                //dic.Add("httpid", LCommon.TimeToUNIX(DateTime.Now));
                dic.Add("phone", phone);
                dic.Add("coin_name", coin_name);
                string sign = Helper.BuildRequest(dic);
                string json = PostGet.Get("http://bccbtoken.com/api/Memberapi/getUserBalance?phone=" + phone + "&coin_name=" + coin_name + "&sign=" + sign);
                //LogManager.WriteLog("APP接口", json);
                JObject paramJson = JsonConvert.DeserializeObject(json) as JObject;
                if (paramJson["success"].ToString() == "True")
                {
                    b = decimal.Parse(paramJson["data"].ToString());
                }
            }
            catch (Exception err)
            {
                LogManager.WriteLog("APP接口异常", "查询余额(" + phone + ")=" + err.Message);
            }
            return(b);
        }
Beispiel #2
0
        /// <summary>
        /// 24小时均值Get
        /// </summary>
        /// <returns>
        /// {
        //  "success": true,
        //  "data": [
        //    {
        //      "coin_name": "BCCB",
        //      "total_num": "13.0000000",
        //      "total_amount": "31.0000000",
        //      "avg_price": "2.38462"
        //    },
        //    {
        //      "coin_name": "FBCC",
        //      "total_num": "13.0000000",
        //      "total_amount": "31.0000000",
        //      "avg_price": "2.38462"
        //    },
        //  ]
        //}
        /// </returns>
        public static decimal AVG(int TB)
        {
            decimal price = 0;

            try
            {
                string json = PostGet.Get("http://bccbtoken.com/api/Memberapi/dailyAvg");
                //LogManager.WriteLog("APP接口", json);
                JObject paramJson = JsonConvert.DeserializeObject(json) as JObject;
                if (paramJson["success"].ToString() == "True")
                {
                    if (paramJson["data"].ToString() != "[]")
                    {
                        price = TB == 1? decimal.Parse(paramJson["data"][0]["avg_price"].ToString()): decimal.Parse(paramJson["data"][1]["avg_price"].ToString());
                    }
                }
            }
            catch (Exception err)
            {
                LogManager.WriteLog("APP接口异常", "24小时均值=" + err.Message);
            }
            return(price);
        }