public HttpResponseMessage GetStockInfoList(string NameorCodeorPinyin) { ParamHelper paramHelper = new ParamHelper(); string one = NameorCodeorPinyin; string res; JObject jObject = null; try { if (paramHelper.HaveHanZi(one)) { res = new ShowApiRequest("http://route.showapi.com/131-43", "138438", "dd520f20268747d4bbda22ac31c9cbdf") .addTextPara("name", one) .post(); } else { if (paramHelper.HaveNumber(one)) { res = new ShowApiRequest("http://route.showapi.com/131-43", "138438", "dd520f20268747d4bbda22ac31c9cbdf") .addTextPara("code", one) .post(); } else { res = new ShowApiRequest("http://route.showapi.com/131-43", "138438", "dd520f20268747d4bbda22ac31c9cbdf") .addTextPara("pinyin", one) .post(); } } jObject = JsonConvert.DeserializeObject <JObject>(res); StockInfo.Info info = JsonConvert.DeserializeObject <StockInfo.Info>(res); if (info.showapi_res_body.list.Count == 0) { return(ApiResponse.NotFound("您输入有误,请重新输入!")); } } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(ApiResponse.BadRequest("糟糕,网络好像出问题了")); } return(ApiResponse.Ok(jObject)); }