diff --git a/src/Shentun.ColumnReferencePlugIns/PlugInsBase.cs b/src/Shentun.ColumnReferencePlugIns/PlugInsBase.cs index 4879a30..55a0773 100644 --- a/src/Shentun.ColumnReferencePlugIns/PlugInsBase.cs +++ b/src/Shentun.ColumnReferencePlugIns/PlugInsBase.cs @@ -188,7 +188,7 @@ namespace Shentun.Peis.PlugIns } result = await response.Content.ReadAsStringAsync(); - var resultDto = JsonConvert.DeserializeObject< WebApiOutDtoExter>(result); + var resultDto = JsonConvert.DeserializeObject< WebApiOutDto>(result); if (resultDto.Code == -1) { @@ -212,7 +212,7 @@ namespace Shentun.Peis.PlugIns return Task.CompletedTask; } - public async virtual Task> LoginAsync() + public async virtual Task> LoginAsync() { if(string.IsNullOrWhiteSpace(SelfUser)) { @@ -225,7 +225,7 @@ namespace Shentun.Peis.PlugIns var relult = await LoginAsync(SelfUser, SelfPassword); return relult; } - public async Task> LoginAsync(string userId, string password) + public async Task> LoginAsync(string userId, string password) { if (string.IsNullOrWhiteSpace(userId)) { @@ -261,7 +261,7 @@ namespace Shentun.Peis.PlugIns throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result); } result = await response.Content.ReadAsStringAsync(); - var restultDto = JsonConvert.DeserializeObject>(result); + var restultDto = JsonConvert.DeserializeObject>(result); if (restultDto == null) { throw new Exception("返回结果是空"); diff --git a/src/Shentun.ColumnReferencePlugIns/WebAppoints/WebAppointWebPeisPlugIns.cs b/src/Shentun.ColumnReferencePlugIns/WebAppoints/WebAppointWebPeisPlugIns.cs index fb68017..c67b98b 100644 --- a/src/Shentun.ColumnReferencePlugIns/WebAppoints/WebAppointWebPeisPlugIns.cs +++ b/src/Shentun.ColumnReferencePlugIns/WebAppoints/WebAppointWebPeisPlugIns.cs @@ -78,7 +78,7 @@ namespace Shentun.Peis.PlugIns.WebAppoints (_webPeisGetAppointRegisterAsbitemListByIdUrl, webAppointPatientRegisterIdInput); return appointRegisterAsbitemDtos; } - public async virtual Task> LoginWebPeisAsync() + public async virtual Task> LoginWebPeisAsync() { if (string.IsNullOrWhiteSpace(_webPeisUser)) { @@ -92,7 +92,7 @@ namespace Shentun.Peis.PlugIns.WebAppoints return relult; } - public async Task> LoginWebPeisAsync(string userId, string password) + public async Task> LoginWebPeisAsync(string userId, string password) { if (string.IsNullOrWhiteSpace(userId)) { @@ -128,7 +128,7 @@ namespace Shentun.Peis.PlugIns.WebAppoints throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result); } result = await response.Content.ReadAsStringAsync(); - var restultDto = JsonConvert.DeserializeObject>(result); + var restultDto = JsonConvert.DeserializeObject>(result); if (restultDto == null) { throw new Exception("返回结果是空"); @@ -187,7 +187,7 @@ namespace Shentun.Peis.PlugIns.WebAppoints } result = await response.Content.ReadAsStringAsync(); - var resultDto = JsonConvert.DeserializeObject>(result); + var resultDto = JsonConvert.DeserializeObject>(result); if (resultDto != null) { if (resultDto.Code == -1) diff --git a/src/Shentun.Peis.Application.Contracts/WebApiOutDto.cs b/src/Shentun.Peis.Application.Contracts/WebApiOutDto.cs index 08db698..510b581 100644 --- a/src/Shentun.Peis.Application.Contracts/WebApiOutDto.cs +++ b/src/Shentun.Peis.Application.Contracts/WebApiOutDto.cs @@ -4,8 +4,10 @@ using System.Text; namespace Shentun.Peis { - public class WebApiOutDto: WebApiOutDtoBase + public class WebApiOutDto { - public object Data { get; set; } + public int Code { get; set; } + public string Message { get; set; } + public T? Data { get; set; } } } diff --git a/src/Shentun.Peis.Application.Contracts/WebApiOutDtoBase.cs b/src/Shentun.Peis.Application.Contracts/WebApiOutDtoBase.cs deleted file mode 100644 index be75744..0000000 --- a/src/Shentun.Peis.Application.Contracts/WebApiOutDtoBase.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Shentun.Peis -{ - public class WebApiOutDtoBase - { - public string Code { get; set; } - public string Message { get; set; } - - } -} diff --git a/src/Shentun.Peis.Application.Contracts/WebApiOutDtoExter.cs b/src/Shentun.Peis.Application.Contracts/WebApiOutDtoExter.cs deleted file mode 100644 index 2b2ec1e..0000000 --- a/src/Shentun.Peis.Application.Contracts/WebApiOutDtoExter.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Shentun.Peis -{ - public class WebApiOutDtoExter - { - public int Code { get; set; } - public string Message { get; set; } - public T? Data { get; set; } - } -} diff --git a/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs b/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs index 5aaf7d5..3407d28 100644 --- a/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs +++ b/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs @@ -200,7 +200,7 @@ namespace Shentun.Peis.TransToWebPeis var user = interfaceConfig.GetSection("Interface").GetSection("User").Value; var password = interfaceConfig.GetSection("Interface").GetSection("Password").Value; - var result = await CallAppServiceAsync(url, "", input); + var result = await CallAppServiceAsync(url, "", input); } @@ -329,16 +329,13 @@ namespace Shentun.Peis.TransToWebPeis } result = await response.Content.ReadAsStringAsync(); - var resultDto = JsonConvert.DeserializeObject(result); - if (resultDto is WebApiOutDtoBase) + var resultDto = JsonConvert.DeserializeObject>(result); + if (resultDto.Code == -1) { - var webApiOutDtoBase = resultDto as WebApiOutDtoBase; - if (webApiOutDtoBase.Code == "-1") - { - throw new Exception($"调用服务失败{webApiOutDtoBase.Message}"); - } + throw new Exception($"调用服务失败{resultDto.Message}"); } - return resultDto; + return resultDto.Data; + } } diff --git a/src/Shentun.Peis.HttpApi.Host/AppServiceHelper.cs b/src/Shentun.Peis.HttpApi.Host/AppServiceHelper.cs index 7aaf65c..8ec6817 100644 --- a/src/Shentun.Peis.HttpApi.Host/AppServiceHelper.cs +++ b/src/Shentun.Peis.HttpApi.Host/AppServiceHelper.cs @@ -68,7 +68,7 @@ namespace Shentun.Peis } result = await response.Content.ReadAsStringAsync(); - var resultDto = JsonConvert.DeserializeObject< WebApiOutDtoExter >(result); + var resultDto = JsonConvert.DeserializeObject< WebApiOutDto >(result); if (resultDto.Code == -1 ) { throw new Exception($"调用服务失败{resultDto.Message}"); @@ -112,7 +112,7 @@ namespace Shentun.Peis } result = response.Content.ReadAsStringAsync().Result; - var resultDto = JsonConvert.DeserializeObject>(result); + var resultDto = JsonConvert.DeserializeObject>(result); if (resultDto.Code == -1) { throw new Exception($"调用服务失败{resultDto.Message}"); @@ -162,7 +162,7 @@ namespace Shentun.Peis throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result); } result = await response.Content.ReadAsStringAsync(); - var restultDto = JsonConvert.DeserializeObject>(result); + var restultDto = JsonConvert.DeserializeObject>(result); if (restultDto == null) { throw new Exception("返回结果是空"); @@ -208,7 +208,7 @@ namespace Shentun.Peis throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result); } result = response.Content.ReadAsStringAsync().Result; - var restultDto = JsonConvert.DeserializeObject>(result); + var restultDto = JsonConvert.DeserializeObject>(result); if (restultDto == null) { throw new Exception("返回结果是空");