mirror of
https://github.com/KevinWG/OSS.Tools.git
synced 2026-10-29 14:09:29 +08:00
升级基础类库响应实体
This commit is contained in:
@@ -9,10 +9,10 @@
|
||||
<Copyright>OSSCoder</Copyright>
|
||||
<PackageProjectUrl>https://github.com/KevinWG/OSS.Http</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/KevinWG/OSS.Http</RepositoryUrl>
|
||||
<Version>1.3.2.1</Version>
|
||||
<PackageReleaseNotes></PackageReleaseNotes>
|
||||
<AssemblyVersion>1.3.2.1</AssemblyVersion>
|
||||
<FileVersion>1.3.2.1</FileVersion>
|
||||
<Version>1.5</Version>
|
||||
<PackageReleaseNotes>升级基础类库响应实体</PackageReleaseNotes>
|
||||
<AssemblyVersion>1.5.0.0</AssemblyVersion>
|
||||
<FileVersion>1.5.0.0</FileVersion>
|
||||
<PackageIconUrl>http://img1.static.osscoder.com/logo.jpg</PackageIconUrl>
|
||||
<PackageLicenseUrl>https://github.com/KevinWG/OSS.Http/blob/master/LICENSE</PackageLicenseUrl>
|
||||
</PropertyGroup>
|
||||
@@ -26,8 +26,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
||||
<PackageReference Include="OSS.Common" Version="1.3.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="OSS.Common" Version="2.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -15,8 +15,8 @@ using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using OSS.Common.ComModels;
|
||||
using OSS.Common.Plugs;
|
||||
using OSS.Common.Resp;
|
||||
using OSS.Http.Mos;
|
||||
|
||||
namespace OSS.Http.Extention
|
||||
@@ -38,12 +38,12 @@ namespace OSS.Http.Extention
|
||||
public static async Task<T> RestCommon<T>(this OsHttpRequest request,
|
||||
Func<HttpResponseMessage, Task<T>> formatFunc, HttpClient client = null,
|
||||
string moduleName = ModuleNames.Default)
|
||||
where T : ResultMo, new()
|
||||
where T : Resp, new()
|
||||
{
|
||||
var resp = await request.RestSend(client);
|
||||
var t = await formatFunc(resp);
|
||||
|
||||
return t ?? new T() {ret = (int)ResultTypes.ObjectNull, msg = "未发现网络结果"};
|
||||
return t ?? new T() {ret = (int)RespTypes.ObjectNull, msg = "未发现网络结果"};
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OSS.Http.Extention
|
||||
/// <param name="resp"></param>
|
||||
/// <returns></returns>
|
||||
private static async Task<TResp> JsonFormat<TResp>(HttpResponseMessage resp)
|
||||
where TResp : ResultMo, new()
|
||||
where TResp : Resp, new()
|
||||
{
|
||||
if (!resp.IsSuccessStatusCode)
|
||||
return new TResp()
|
||||
@@ -76,7 +76,7 @@ namespace OSS.Http.Extention
|
||||
/// <returns></returns>
|
||||
public static async Task<TResp> RestCommonJson<TResp>(this OsHttpRequest request, HttpClient client = null,
|
||||
string moduleName = ModuleNames.Default)
|
||||
where TResp : ResultMo, new()
|
||||
where TResp : Resp, new()
|
||||
{
|
||||
return await RestCommon(request, JsonFormat<TResp>, client, moduleName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user