/// <summary> /// 获取股票名称 /// </summary> /// <param name="code"></param> /// <returns></returns> public static string GetStockNameByJuhe(string code) { string name = ""; object stock_name = CacheHelper.Get(code); if (stock_name != null) { name = stock_name.ToString(); } else { string stock_code = ""; if (code.Trim().Length == 6) { if (Utils.subStr(code, 0, 1) == "6") { //上证A、B股 stock_code = "sh" + code; } else { //沪深A股-深圳A、B股 stock_code = "sz" + code; } } //1.沪深股市 var parameters1 = new Dictionary <string, string>(); parameters1.Add("gid", stock_code); //股票编号,上海股市以sh开头,深圳股市以sz开头如:sh601009 parameters1.Add("key", AppKeys.JUHE_API_KEY); //你申请的key name = Utils.GetHttpValue(sendPost(AppKeys.JUHE_API_URL, parameters1, "get"), "\"name\":\"", "\",\"nowPri\""); CacheHelper.Insert(code, name, 1440); } return(name); }