public ApiJsonResultData GetUserInfo([FromBody] UiInIParam param) { return(new ApiJsonResultData(ModelState, new UiInIParam()).RunWithTry(y => { var userBase = webServiceBasicService.GetUserBaseInfo(param.UserId); y.Data = userBase; })); }
public ApiJsonResultData MedicalInsurancePairCode([FromBody] UiInIParam param) { return(new ApiJsonResultData(ModelState, new MedicalInsurancePairCodesUiParam()).RunWithTry(y => { var userBase = webServiceBasicService.GetUserBaseInfo(param.UserId); if (userBase != null && string.IsNullOrWhiteSpace(userBase.OrganizationCode) == false) { var data = webServiceBasicService.ThreeCataloguePairCodeUpload( new UpdateThreeCataloguePairCodeUploadParam() { User = userBase, ProjectCodeList = new List <string>() } ); y.Data = data; } })); }
public async Task <ApiJsonResultData> GetPostUrl([FromBody] UiInIParam param) { return(await new ApiJsonResultData(ModelState).RunWithTryAsync(async y => { //var requestJson = JsonConvert.SerializeObject("{'orderAmt':0.01,'token':'134757426273844039'}"); var paramData = new GetPostUrlDto(); paramData.orderAmt = Convert.ToDecimal(0.01); paramData.token = "134757426273844039"; string content = JsonConvert.SerializeObject(paramData); //第一种方法 var buffer = Encoding.UTF8.GetBytes(content); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.ExpectContinue = false; var response = await httpClient.PostAsync("http://triage.natapp1.cc/scrcu/pay/order", byteContent) .ConfigureAwait(false); string result = await response.Content.ReadAsStringAsync(); //第二种方法 byte[] byteArray = Encoding.Default.GetBytes(content); //转化 HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri("http://triage.natapp1.cc/scrcu/pay/order")); webReq.Method = "POST"; webReq.ServicePoint.Expect100Continue = false; webReq.ContentType = "application/json"; webReq.ContentLength = byteArray.Length; Stream newStream = webReq.GetRequestStream(); newStream.Write(byteArray, 0, byteArray.Length); //写入参数 newStream.Close(); HttpWebResponse responsebbb = (HttpWebResponse)webReq.GetResponse(); StreamReader sr = new StreamReader(responsebbb.GetResponseStream(), Encoding.UTF8); var ret = sr.ReadToEnd(); sr.Close(); responsebbb.Close(); newStream.Close(); })); }
public ApiJsonResultData HospitalThreeCatalogBatchUpload([FromBody] UiInIParam param) { return(new ApiJsonResultData(ModelState, new UiInIParam()).RunWithTry(y => { var userBase = webServiceBasicService.GetUserBaseInfo(param.UserId); var paramIni = new MedicalInsurancePairCodesUiParam(); if (userBase != null && string.IsNullOrWhiteSpace(userBase.OrganizationCode) == false) { paramIni.OrganizationCode = userBase.OrganizationCode; paramIni.OrganizationName = userBase.OrganizationName; webServiceBasicService.ThreeCataloguePairCodeUpload( new UpdateThreeCataloguePairCodeUploadParam() { User = userBase, ProjectCodeList = new List <string>() } ); } ImedicalInsuranceSqlRepository.HospitalThreeCatalogBatchUpload(userBase); })); }