/// <summary> /// Get api data /// </summary> /// <typeparam name="T">data type</typeparam> /// <param name="requestUrl">request url</param> /// <param name="paramsDic">params dictionary</param> /// <param name="isPost">is post way get data</param> /// <returns>Api data,if error return default T</returns> public T GetDataApi <T>(string requestUrl, IDictionary <string, object> paramsDic = null, bool isPost = false) { try { var resultStr = isPost ? WebCommonHelper.CreatePostHttpResponse(requestUrl, paramsDic, 16000, null, Encoding.UTF8) : WebCommonHelper.HttpGetWebRequest(requestUrl); if (string.IsNullOrEmpty(resultStr)) { return(default(T)); } var resultModel = JsonConvert.DeserializeObject <ApiResultModel <T> >(resultStr); if (resultModel == null) { return(default(T)); } return(resultModel.Data); } catch (Exception) { return(default(T)); } }