Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fangqm
RsCode
提交
ffac4739
R
RsCode
项目概览
fangqm
/
RsCode
10 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
RsCode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ffac4739
编写于
9月 26, 2022
作者:
K
kuiyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix many bugs
上级
93ab8909
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
815 addition
and
176 deletion
+815
-176
src/RsCode.AspNetCore/Jwt/JwtExtensions.cs
src/RsCode.AspNetCore/Jwt/JwtExtensions.cs
+59
-0
src/RsCode.AspNetCore/Jwt/JwtHelper.cs
src/RsCode.AspNetCore/Jwt/JwtHelper.cs
+34
-16
src/RsCode.AspNetCore/RsCode.AspNetCore.csproj
src/RsCode.AspNetCore/RsCode.AspNetCore.csproj
+4
-2
src/RsCode.Storage.Aliyun/AliyunOssService.cs
src/RsCode.Storage.Aliyun/AliyunOssService.cs
+219
-0
src/RsCode.Storage.Aliyun/AliyunStorageExtensions.cs
src/RsCode.Storage.Aliyun/AliyunStorageExtensions.cs
+17
-0
src/RsCode.Storage.Aliyun/AliyunStorageOptions.cs
src/RsCode.Storage.Aliyun/AliyunStorageOptions.cs
+32
-0
src/RsCode.Storage.Aliyun/AliyunStorageService.cs
src/RsCode.Storage.Aliyun/AliyunStorageService.cs
+48
-0
src/RsCode.Storage.Aliyun/EndPoint.cs
src/RsCode.Storage.Aliyun/EndPoint.cs
+16
-0
src/RsCode.Storage.Aliyun/IAliyunOssService.cs
src/RsCode.Storage.Aliyun/IAliyunOssService.cs
+39
-0
src/RsCode.Storage.Aliyun/RsCode.Storage.Aliyun.csproj
src/RsCode.Storage.Aliyun/RsCode.Storage.Aliyun.csproj
+8
-1
src/RsCode.Storage.Aliyun/StorageService.cs
src/RsCode.Storage.Aliyun/StorageService.cs
+0
-14
src/RsCode/Config/AppSettings.cs
src/RsCode/Config/AppSettings.cs
+47
-7
src/RsCode/Helper/DateTimeHelper.cs
src/RsCode/Helper/DateTimeHelper.cs
+1
-1
src/RsCode/Helper/HttpHelper.cs
src/RsCode/Helper/HttpHelper.cs
+85
-127
src/RsCode/Helper/JsonHelper.cs
src/RsCode/Helper/JsonHelper.cs
+3
-0
src/RsCode/Helper/XmlHelper.cs
src/RsCode/Helper/XmlHelper.cs
+67
-3
src/RsCode/RsCode.csproj
src/RsCode/RsCode.csproj
+3
-3
src/RsCode/RsCode.xml
src/RsCode/RsCode.xml
+133
-2
未找到文件。
src/RsCode.AspNetCore/Jwt/JwtExtensions.cs
0 → 100644
浏览文件 @
ffac4739
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.AspNetCore.Authentication.JwtBearer
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Microsoft.IdentityModel.Tokens
;
using
System.Threading.Tasks
;
namespace
RsCode.AspNetCore
{
public
static
class
JwtExtensions
{
public
static
void
AddJwt
(
this
IServiceCollection
services
,
string
Url
=
"/UserAuthHub"
)
{
services
.
AddAuthentication
(
JwtBearerDefaults
.
AuthenticationScheme
)
.
AddJwtBearer
(
options
=>
{
var
jwt
=
JwtHelper
.
GetJwtInfo
();
if
(
jwt
.
Expire
<
0
)
jwt
.
Expire
=
60
*
24
*
360
;
options
.
TokenValidationParameters
=
new
TokenValidationParameters
{
ValidateIssuer
=
true
,
//是否验证发行者
ValidateAudience
=
true
,
//是否验证接收者
ValidateLifetime
=
true
,
//是否验证失效时间
ClockSkew
=
TimeSpan
.
FromMinutes
(
jwt
.
Expire
),
ValidateIssuerSigningKey
=
true
,
//是否验证安全key
ValidAudience
=
jwt
.
Audience
,
//有效的接收者
ValidIssuer
=
jwt
.
Issuer
,
//有效的发行者
IssuerSigningKey
=
new
SymmetricSecurityKey
(
Encoding
.
UTF8
.
GetBytes
(
jwt
.
SecurityKey
))
};
////signalr auth
options
.
Events
=
new
JwtBearerEvents
{
OnMessageReceived
=
context
=>
{
var
accessToken
=
context
.
Request
.
Query
[
"access_token"
];
var
path
=
context
.
HttpContext
.
Request
.
Path
;
if
(!
string
.
IsNullOrEmpty
(
accessToken
)
&&
(
path
.
StartsWithSegments
(
Url
)))
{
context
.
Token
=
accessToken
;
}
return
Task
.
CompletedTask
;
}
};
});
services
.
AddScoped
<
JwtHelper
>();
}
}
}
src/RsCode.AspNetCore/Jwt/JwtHelper.cs
浏览文件 @
ffac4739
...
...
@@ -19,6 +19,7 @@ using RsCode.AspNetCore.Jwt;
using
System
;
using
System.Collections.Generic
;
using
System.IdentityModel.Tokens.Jwt
;
using
System.Linq
;
using
System.Security.Claims
;
using
System.Text
;
...
...
@@ -26,7 +27,7 @@ namespace RsCode.AspNetCore
{
public
class
JwtHelper
{
public
static
int
RefreshTokenExpire
{
get
;
set
;
}=
3600
*
24
*
180
;
//180天
static
int
RefreshTokenExpire
{
get
;
set
;
}=
60
*
24
*
366
;
//366
public
static
JwtInfo
GetJwtInfo
()
{
...
...
@@ -42,15 +43,11 @@ namespace RsCode.AspNetCore
/// <param name="claims"></param>
/// <param name="expire">过期时间(以分钟为单位)</param>
/// <returns></returns>
public
static
AccessTokenInfo
CreateAccessToken
(
List
<
Claim
>
claims
,
int
expire
=-
1
)
public
AccessTokenInfo
CreateAccessToken
(
List
<
Claim
>
claims
,
int
expire
=-
1
)
{
var
jwt
=
GetJwtInfo
();
//accesstoken
if
(
expire
==
-
1
)
expire
=
jwt
.
Expire
*
60
;
else
expire
=
expire
*
60
;
expire
=
60
*
24
*
360
;
var
token
=
CreateToken
(
claims
,
expire
);
//refreshtoken
...
...
@@ -59,34 +56,43 @@ namespace RsCode.AspNetCore
var
refreshToken
=
CreateToken
(
claims
,
RefreshTokenExpire
);
AccessTokenInfo
tokenInfo
=
new
AccessTokenInfo
();
tokenInfo
.
ExpiresIn
=
expire
;
tokenInfo
.
ExpiresIn
=
expire
*
60
;
tokenInfo
.
AccessToken
=
token
;
tokenInfo
.
RefreshToken
=
refreshToken
;
return
tokenInfo
;
}
public
static
string
CreateToken
(
List
<
Claim
>
claims
,
int
minutes
)
/// <summary>
/// 创建AccessToken
/// </summary>
/// <param name="claims"></param>
/// <param name="expire"></param>
/// <returns></returns>
public
AccessTokenInfo
CreateAccessToken
(
IEnumerable
<
Claim
>
claims
,
int
expire
=
-
1
)
{
return
CreateAccessToken
(
claims
.
ToList
(),
expire
);
}
public
string
CreateToken
(
List
<
Claim
>
claims
,
int
minutes
)
{
var
jwt
=
GetJwtInfo
();
string
securityKey
=
jwt
.
SecurityKey
;
//安全码
string
issuer
=
jwt
.
Issuer
;
//发行者
string
audience
=
jwt
.
Audience
;
//接收者
int
expire
=
minutes
;
//秒
string
audience
=
jwt
.
Audience
;
//接收者
claims
.
Add
(
new
Claim
(
JwtRegisteredClaimNames
.
Nbf
,
$"
{
new
DateTimeOffset
(
DateTime
.
Now
).
ToUnixTimeSeconds
()}
"
));
claims
.
Add
(
new
Claim
(
JwtRegisteredClaimNames
.
Exp
,
$"
{
new
DateTimeOffset
(
DateTime
.
Now
.
AddMinutes
(
expire
)).
ToUnixTimeSeconds
()}
"
));
claims
.
Add
(
new
Claim
(
JwtRegisteredClaimNames
.
Exp
,
$"
{
new
DateTimeOffset
(
DateTime
.
Now
.
AddMinutes
(
minutes
)).
ToUnixTimeSeconds
()}
"
));
var
key
=
new
SymmetricSecurityKey
(
Encoding
.
UTF8
.
GetBytes
(
securityKey
));
var
creds
=
new
SigningCredentials
(
key
,
SecurityAlgorithms
.
HmacSha256
);
var
token
=
new
JwtSecurityToken
(
issuer
:
issuer
,
audience
:
audience
,
claims
:
claims
,
expires
:
DateTime
.
Now
.
AddMinutes
(
expire
),
expires
:
DateTime
.
Now
.
AddMinutes
(
minutes
),
signingCredentials
:
creds
);
return
new
JwtSecurityTokenHandler
().
WriteToken
(
token
);
}
public
static
IEnumerable
<
Claim
>
GetClaims
(
string
accessToken
)
public
IEnumerable
<
Claim
>
GetClaims
(
string
accessToken
)
{
try
{
...
...
@@ -100,6 +106,18 @@ namespace RsCode.AspNetCore
}
}
public
AccessTokenInfo
RefreshToken
(
ClaimsPrincipal
claimsPrincipal
)
{
var
jwtInfo
=
GetJwtInfo
();
var
code
=
claimsPrincipal
.
Claims
.
FirstOrDefault
(
m
=>
m
.
Type
.
Equals
(
ClaimTypes
.
NameIdentifier
));
if
(
null
!=
code
)
{
return
CreateAccessToken
(
claimsPrincipal
.
Claims
,
jwtInfo
.
Expire
);
}
else
{
return
null
;
}
}
}
}
\ No newline at end of file
src/RsCode.AspNetCore/RsCode.AspNetCore.csproj
浏览文件 @
ffac4739
...
...
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>1.5.
6
</Version>
<Version>1.5.
8
</Version>
<Authors>Tony</Authors>
<Company>河南软商网络科技有限公司</Company>
<PackageIcon>rscode64_64.png</PackageIcon>
...
...
@@ -12,7 +12,8 @@
<PackageReleaseNotes>软商网络asp.net core项目开发工具包</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<AssemblyVersion>1.5.4.0</AssemblyVersion>
<AssemblyVersion>1.5.8.0</AssemblyVersion>
<FileVersion>1.5.8.0</FileVersion>
</PropertyGroup>
<ItemGroup>
...
...
@@ -31,6 +32,7 @@
<PackageReference Include="Caching.CSRedis" Version="3.6.5" />
<PackageReference Include="CSRedisCore" Version="3.6.5" />
<PackageReference Include="EnyimMemcachedCore" Version="2.4.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HttpOverrides" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="3.1.0" />
...
...
src/RsCode.Storage.Aliyun/AliyunOssService.cs
0 → 100644
浏览文件 @
ffac4739
using
Aliyun.OSS
;
using
System
;
using
Microsoft.Extensions.Options
;
using
System.Threading.Tasks
;
using
static
AlibabaCloud
.
SDK
.
Sts20150401
.
Models
.
AssumeRoleResponseBody
;
using
Microsoft.AspNetCore.Http
;
using
System.IO
;
namespace
RsCode.Storage.Aliyun
{
public
class
AliyunOssService
:
IAliyunOssService
{
string
AccessKeyId
{
get
;
set
;
}
string
AccessKeySecret
{
get
;
set
;
}
AliyunStorageOptions
Options
;
public
AliyunOssService
(
IOptionsSnapshot
<
AliyunStorageOptions
>
optionsSnapshot
)
{
Options
=
optionsSnapshot
.
Value
;
if
(
Options
==
null
)
throw
new
Exception
(
"aliyun oss config err"
);
AccessKeyId
=
optionsSnapshot
.
Value
.
AccessKeyId
;
AccessKeySecret
=
optionsSnapshot
.
Value
.
AccessKeySecret
;
}
public
async
Task
<
AlibabaCloud
.
SDK
.
Sts20150401
.
Models
.
AssumeRoleResponseBody
>
GetStsTokenAsync
(
string
sessionName
,
string
endpointName
,
string
roleArn
=
""
,
int
durationSeconds
=
900
)
{
try
{
if
(
string
.
IsNullOrEmpty
(
sessionName
))
{
throw
new
Exception
(
"sessionName不能为空"
);
}
AlibabaCloud
.
SDK
.
Sts20150401
.
Models
.
AssumeRoleResponseBody
body
=
null
;
await
Task
.
Run
(()
=>
{
var
endpoint
=
Options
.
GetEndPoint
(
endpointName
);
var
client
=
CreateStsClient
(
AccessKeyId
,
AccessKeySecret
,
endpoint
.
Sts
);
if
(
string
.
IsNullOrEmpty
(
roleArn
))
{
roleArn
=
Options
.
RoleArn
[
0
];
}
AlibabaCloud
.
SDK
.
Sts20150401
.
Models
.
AssumeRoleRequest
assumeRoleRequest
=
new
AlibabaCloud
.
SDK
.
Sts20150401
.
Models
.
AssumeRoleRequest
();
assumeRoleRequest
.
DurationSeconds
=
durationSeconds
;
assumeRoleRequest
.
RoleArn
=
roleArn
;
assumeRoleRequest
.
RoleSessionName
=
sessionName
;
//自定义会话名称
var
response
=
client
.
AssumeRole
(
assumeRoleRequest
);
body
=
response
.
Body
;
});
return
body
;
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/// <summary>
/// 使用AK&SK初始化账号Client
/// </summary>
/// <param name="accessKeyId"></param>
/// <param name="accessKeySecret"></param>
/// <param name="endpoint"></param>
/// <returns></returns>
public
AlibabaCloud
.
SDK
.
Sts20150401
.
Client
CreateStsClient
(
string
accessKeyId
,
string
accessKeySecret
,
string
endpoint
)
{
AlibabaCloud
.
OpenApiClient
.
Models
.
Config
config
=
new
AlibabaCloud
.
OpenApiClient
.
Models
.
Config
{
AccessKeyId
=
accessKeyId
,
AccessKeySecret
=
accessKeySecret
,
};
// 访问的域名
config
.
Endpoint
=
endpoint
;
return
new
AlibabaCloud
.
SDK
.
Sts20150401
.
Client
(
config
);
}
public
async
Task
<
PutObjectResult
>
UploadFileAsync
(
IFormFile
file
,
string
key
,
string
bucketName
,
string
endpointName
,
AssumeRoleResponseBodyCredentials
stsToken
)
{
PutObjectResult
result
=
null
;
await
Task
.
Run
(()
=>
{
var
endpoint
=
Options
.
GetEndPoint
(
endpointName
);
var
client
=
GetOssClient
(
stsToken
.
AccessKeyId
,
stsToken
.
AccessKeySecret
,
endpoint
.
Oss
);
using
(
var
fs
=
file
.
OpenReadStream
())
{
ObjectMetadata
objectMetadata
=
new
ObjectMetadata
();
objectMetadata
.
AddHeader
(
"x-oss-security-token"
,
stsToken
.
SecurityToken
);
SetContentType
(
key
,
objectMetadata
);
var
request
=
new
PutObjectRequest
(
bucketName
,
key
,
fs
,
objectMetadata
);
result
=
client
.
PutObject
(
request
);
}
});
return
result
;
}
public
async
Task
<
PutObjectResult
>
UploadFileAsync
(
Stream
fs
,
string
key
,
string
bucketName
,
string
endpointName
,
AssumeRoleResponseBodyCredentials
stsToken
)
{
PutObjectResult
result
=
null
;
await
Task
.
Run
(()
=>
{
var
endpoint
=
Options
.
GetEndPoint
(
endpointName
);
var
client
=
GetOssClient
(
stsToken
.
AccessKeyId
,
stsToken
.
AccessKeySecret
,
endpoint
.
Oss
);
using
(
fs
)
{
ObjectMetadata
objectMetadata
=
new
ObjectMetadata
();
objectMetadata
.
AddHeader
(
"x-oss-security-token"
,
stsToken
.
SecurityToken
);
SetContentType
(
key
,
objectMetadata
);
var
request
=
new
PutObjectRequest
(
bucketName
,
key
,
fs
,
objectMetadata
);
result
=
client
.
PutObject
(
request
);
}
});
return
result
;
}
void
SetContentType
(
string
key
,
ObjectMetadata
objectMetadata
)
{
var
ext
=
System
.
IO
.
Path
.
GetExtension
(
key
).
ToLower
();
if
(
ext
==
".bmp"
)
{
objectMetadata
.
ContentType
=
"image/bmp"
;
}
if
(
ext
==
".gif"
)
{
objectMetadata
.
ContentType
=
"image/gif"
;
}
if
(
ext
==
".jpeg"
||
ext
==
".jpg"
)
{
objectMetadata
.
ContentType
=
"image/jpg"
;
}
if
(
ext
==
".png"
)
{
objectMetadata
.
ContentType
=
"image/png"
;
}
if
(
ext
==
".html"
)
{
objectMetadata
.
ContentType
=
"text/html"
;
}
if
(
ext
==
".txt"
)
{
objectMetadata
.
ContentType
=
"text/plain"
;
}
if
(
ext
==
".vsd"
)
{
objectMetadata
.
ContentType
=
"application/vnd.visio"
;
}
if
(
ext
==
".pptx"
)
{
objectMetadata
.
ContentType
=
"application/vnd.ms-powerpoint"
;
}
if
(
ext
==
".docx"
||
ext
==
".doc"
)
{
objectMetadata
.
ContentType
=
"application/msword"
;
}
if
(
ext
==
".xml"
)
{
objectMetadata
.
ContentType
=
"text/xml"
;
}
}
public
async
Task
<
DeleteObjectResult
>
DeleteFileAsync
(
string
bucketName
,
string
key
,
string
endpointName
,
AssumeRoleResponseBodyCredentials
stsToken
)
{
var
endpoint
=
Options
.
GetEndPoint
(
endpointName
);
var
client
=
GetOssClient
(
stsToken
.
AccessKeyId
,
stsToken
.
AccessKeySecret
,
endpoint
.
Oss
,
stsToken
.
SecurityToken
);
return
await
Task
.
Run
(()=>
client
.
DeleteObject
(
bucketName
,
key
));
}
public
Uri
GeneratePresignedUri
(
string
bucketName
,
string
key
,
string
endpointName
,
AssumeRoleResponseBodyCredentials
stsToken
)
{
var
endpoint
=
Options
.
GetEndPoint
(
endpointName
);
var
client
=
GetOssClient
(
stsToken
.
AccessKeyId
,
stsToken
.
AccessKeySecret
,
endpoint
.
Oss
,
stsToken
.
SecurityToken
);
//创建临时访问的url
return
client
.
GeneratePresignedUri
(
bucketName
,
key
,
DateTime
.
Now
.
AddMinutes
(
5
),
SignHttpMethod
.
Get
);
}
OssClient
CurrentOssClient
=
null
;
OssClient
GetOssClient
(
string
accessKeyId
,
string
accessKeySecret
,
string
ossEndpoint
)
{
// 构造OssClient实例。
//if(OssClient==null)
CurrentOssClient
=
new
OssClient
(
ossEndpoint
,
accessKeyId
,
accessKeySecret
);
return
CurrentOssClient
;
}
OssClient
GetOssClient
(
string
accessKeyId
,
string
accessKeySecret
,
string
ossEndpoint
,
string
securityToken
)
{
// 构造OssClient实例。
//if(OssClient==null)
CurrentOssClient
=
new
OssClient
(
ossEndpoint
,
accessKeyId
,
accessKeySecret
,
securityToken
);
return
CurrentOssClient
;
}
public
async
Task
<
string
>
GetImgUrl
(
string
key
,
string
sessionName
,
string
bucketName
=
"rswl-resource"
,
string
endpointName
=
"cn-shanghai"
)
{
if
(
key
.
StartsWith
(
"http"
))
{
return
key
;
}
var
stsToken
=
await
GetStsTokenAsync
(
sessionName
,
endpointName
);
var
uri
=
GeneratePresignedUri
(
bucketName
,
key
,
endpointName
,
stsToken
.
Credentials
);
return
uri
.
ToString
();
}
}
}
src/RsCode.Storage.Aliyun/AliyunStorageExtensions.cs
0 → 100644
浏览文件 @
ffac4739
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
RsCode.Storage.Aliyun
;
public
static
class
AliyunStorageExtensions
{
public
static
void
AddAliyunStorage
(
this
IServiceCollection
services
,
IConfiguration
configuration
)
{
services
.
AddScoped
<
IAliyunOssService
,
AliyunOssService
>();
services
.
AddScoped
<
AliyunStorageOptions
>();
services
.
Configure
<
AliyunStorageOptions
>(
configuration
.
GetSection
(
"aliyun:oss"
));
}
}
src/RsCode.Storage.Aliyun/AliyunStorageOptions.cs
0 → 100644
浏览文件 @
ffac4739
using
System
;
using
System.Linq
;
using
System.Text.Json.Serialization
;
namespace
RsCode.Storage.Aliyun
{
public
class
AliyunStorageOptions
{
[
JsonPropertyName
(
"accessKeyId"
)]
public
string
AccessKeyId
{
get
;
set
;
}
[
JsonPropertyName
(
"accessKeySecret"
)]
public
string
AccessKeySecret
{
get
;
set
;
}
/// <summary>
///角色的ARN值
/// </summary>
[
JsonPropertyName
(
"roleArn"
)]
public
string
[]
RoleArn
{
get
;
set
;
}
[
JsonPropertyName
(
"endpoint"
)]
public
EndPoint
[]
EndPoint
{
get
;
set
;
}
public
EndPoint
GetEndPoint
(
string
endpointName
)
{
if
(
EndPoint
==
null
)
{
throw
new
Exception
(
"aliyun oss config err"
);
}
return
EndPoint
.
FirstOrDefault
(
x
=>
x
.
Name
==
endpointName
);
}
}
}
src/RsCode.Storage.Aliyun/AliyunStorageService.cs
0 → 100644
浏览文件 @
ffac4739
using
System
;
using
System.Net.Http
;
using
System.Threading.Tasks
;
namespace
RsCode.Storage.Aliyun
{
public
class
AliyunStorageService
:
IStorageProvider
{
public
string
StorageName
{
get
;
}
=
"aliyun"
;
public
string
CreateDownloadUrl
(
string
url
,
int
expireInSeconds
=
3600
)
{
throw
new
NotImplementedException
();
}
public
string
GetUploadToken
(
string
key
,
DateTime
expiresTime
)
{
throw
new
NotImplementedException
();
}
public
Task
<
TokenResult
>
GetUploadTokenInfoAsync
(
string
key
,
DateTime
expiresTime
)
{
throw
new
NotImplementedException
();
}
public
Task
<
T
>
SendAsync
<
T
>(
StorageRequest
request
)
where
T
:
StorageResponse
{
throw
new
NotImplementedException
();
}
public
Task
<(
HttpResponseMessage
,
string
)>
SendAsync
(
StorageRequest
request
)
{
throw
new
NotImplementedException
();
}
public
Task
<
UploadResult
>
UploadAsync
()
{
throw
new
NotImplementedException
();
}
public
StorageOptions
UseBucket
(
string
bucketName
)
{
throw
new
NotImplementedException
();
}
}
}
src/RsCode.Storage.Aliyun/EndPoint.cs
0 → 100644
浏览文件 @
ffac4739
using
System.Text.Json.Serialization
;
namespace
RsCode.Storage.Aliyun
{
public
class
EndPoint
{
[
JsonPropertyName
(
"name"
)]
public
string
Name
{
get
;
set
;
}
[
JsonPropertyName
(
"sts"
)]
public
string
Sts
{
get
;
set
;
}
[
JsonPropertyName
(
"oss"
)]
public
string
Oss
{
get
;
set
;
}
}
}
src/RsCode.Storage.Aliyun/IAliyunOssService.cs
0 → 100644
浏览文件 @
ffac4739
using
Aliyun.OSS
;
using
Microsoft.AspNetCore.Http
;
using
System
;
using
System.IO
;
using
System.Threading.Tasks
;
using
static
AlibabaCloud
.
SDK
.
Sts20150401
.
Models
.
AssumeRoleResponseBody
;
namespace
RsCode.Storage.Aliyun
{
public
interface
IAliyunOssService
{
Task
<
AlibabaCloud
.
SDK
.
Sts20150401
.
Models
.
AssumeRoleResponseBody
>
GetStsTokenAsync
(
string
sessionName
,
string
endpointName
,
string
roleArn
=
""
,
int
durationSeconds
=
900
);
AlibabaCloud
.
SDK
.
Sts20150401
.
Client
CreateStsClient
(
string
accessKeyId
,
string
accessKeySecret
,
string
endpoint
);
Task
<
PutObjectResult
>
UploadFileAsync
(
IFormFile
file
,
string
key
,
string
bucketName
,
string
endpointName
,
AssumeRoleResponseBodyCredentials
stsToken
);
Task
<
PutObjectResult
>
UploadFileAsync
(
Stream
fs
,
string
key
,
string
bucketName
,
string
endpointName
,
AssumeRoleResponseBodyCredentials
stsToken
);
/// <summary>
/// 获取临时访问的url
/// </summary>
/// <param name="bucketName"></param>
/// <param name="key"></param>
/// <param name="endpointName"></param>
/// <param name="stsToken"></param>
/// <returns></returns>
Uri
GeneratePresignedUri
(
string
bucketName
,
string
key
,
string
endpointName
,
AssumeRoleResponseBodyCredentials
stsToken
);
Task
<
DeleteObjectResult
>
DeleteFileAsync
(
string
bucketName
,
string
key
,
string
endpointName
,
AssumeRoleResponseBodyCredentials
stsToken
);
/// <summary>
/// 查询指定key对应UrL
/// </summary>
/// <param name="key"></param>
/// <param name="sessionName"></param>
/// <param name="bucketName"></param>
/// <param name="endpointName"></param>
/// <returns></returns>
Task
<
string
>
GetImgUrl
(
string
key
,
string
sessionName
,
string
bucketName
=
"rswl-resource"
,
string
endpointName
=
"cn-shanghai"
);
}
}
src/RsCode.Storage.Aliyun/RsCode.Storage.Aliyun.csproj
浏览文件 @
ffac4739
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.
0
</TargetFramework>
<TargetFramework>netcoreapp3.
1
</TargetFramework>
<Company>河南软商网络科技有限公司</Company>
<Authors>Tony</Authors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AlibabaCloud.SDK.Sts20150401" Version="1.1.1" />
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RsCode.Storage\RsCode.Storage.csproj" />
</ItemGroup>
...
...
src/RsCode.Storage.Aliyun/StorageService.cs
已删除
100644 → 0
浏览文件 @
93ab8909
using
System
;
namespace
RsCode.Storage.Aliyun
{
public
class
StorageService
{
public
string
StorageName
{
get
=>
throw
new
NotImplementedException
();
set
=>
throw
new
NotImplementedException
();
}
public
string
GetToken
()
{
throw
new
NotImplementedException
();
}
}
}
src/RsCode/Config/AppSettings.cs
浏览文件 @
ffac4739
...
...
@@ -43,22 +43,43 @@ namespace RsCode
SetJsonFile
(
JsonFilePath
);
return
config
.
GetValue
<
string
>(
key
);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="Key"></param>
/// <param name="JsonFilePath"></param>
/// <returns></returns>
public
static
T
GetValue
<
T
>(
string
Key
,
string
JsonFilePath
=
"appsettings.json"
)
{
return
GetSection
(
Key
,
JsonFilePath
).
Get
<
T
>();
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="JsonFilePath"></param>
/// <returns></returns>
public
static
T
GetAllValue
<
T
>(
string
JsonFilePath
=
"appsettings.json"
)
{
return
GetSection
(
""
).
Get
<
T
>();
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="JsonFilePath"></param>
/// <returns></returns>
public
static
IConfigurationSection
GetSection
(
string
key
,
string
JsonFilePath
=
"appsettings.json"
)
{
SetJsonFile
(
JsonFilePath
);
return
config
.
GetSection
(
key
);
}
/// <summary>
///
/// </summary>
/// <param name="connStrName"></param>
/// <returns></returns>
public
static
string
GetConnectionString
(
string
connStrName
)
{
if
(
config
==
null
)
...
...
@@ -68,12 +89,23 @@ namespace RsCode
return
config
.
GetValue
<
string
>(
"ConnectionStrings:"
+
connStrName
);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="JsonFilePath"></param>
/// <returns></returns>
public
static
T
GetSection
<
T
>(
string
key
,
string
JsonFilePath
=
"appsettings.json"
)
{
return
GetSection
(
key
,
JsonFilePath
).
Get
<
T
>();
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="JsonFilePath"></param>
/// <returns></returns>
public
static
T
GetAllSection
<
T
>(
string
JsonFilePath
=
"appsettings.json"
)
{
SetJsonFile
(
JsonFilePath
);
...
...
@@ -91,7 +123,11 @@ namespace RsCode
return
GetSection
(
key
,
JsonFilePath
).
Exists
();
}
/// <summary>
///
/// </summary>
/// <param name="JsonFilePath"></param>
/// <returns></returns>
public
static
JObject
GetJObject
(
string
JsonFilePath
=
"appsettings.json"
)
{
SetJsonFile
(
JsonFilePath
);
...
...
@@ -129,7 +165,11 @@ namespace RsCode
return
config
;
}
/// <summary>
///
/// </summary>
/// <param name="path"></param>
/// <param name="jsonConents"></param>
public
static
void
WriteJsonFile
(
string
path
,
string
jsonConents
)
{
using
(
FileStream
fs
=
new
FileStream
(
path
,
FileMode
.
Create
,
System
.
IO
.
FileAccess
.
ReadWrite
,
FileShare
.
ReadWrite
))
...
...
src/RsCode/Helper/DateTimeHelper.cs
浏览文件 @
ffac4739
...
...
@@ -96,7 +96,7 @@ namespace System
/// <summary>
/// 时间戳转为C#格式时间
/// </summary>
/// <param name=
”timeStamp”
></param>
/// <param name=
"timeStamp"
></param>
/// <returns></returns>
public
static
DateTime
GetTimeByJavascript
(
long
jsTimeStamp
)
{
...
...
src/RsCode/Helper/HttpHelper.cs
浏览文件 @
ffac4739
...
...
@@ -38,7 +38,14 @@ namespace RsCode
HttpClient
=
client
;
}
/// <summary>
/// 发送get请求
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="url"></param>
/// <param name="accessToken"></param>
/// <returns></returns>
/// <exception cref="AppException"></exception>
public
virtual
async
Task
<
T
>
GetAsync
<
T
>(
string
url
,
string
accessToken
=
""
)
{
...
...
@@ -70,22 +77,16 @@ namespace RsCode
}
else
{
string
ret
=
await
response
.
Content
.
ReadAsStringAsync
();
ReturnInfo
returnInfo
=
JsonSerializer
.
Deserialize
<
ReturnInfo
>(
ret
);
if
(
returnInfo
!=
null
)
{
throw
new
AppException
(
returnInfo
.
Msg
);
}
int
code
=
(
int
)
response
.
StatusCode
;
string
content
=
await
response
.
Content
.
ReadAsStringAsync
();
GetException
(
code
,
$"RequestUri=
{
httpRequestMessage
.
RequestUri
.
ToString
()}
"
+
content
);
return
default
(
T
);
}
if
(
typeof
(
T
)==
typeof
(
PetaPoco
.
Page
<>))
{
}
}
/// <summary>
///
对PetaPoco.Page<>结果的封装
///
获取PetaPoco.Page结果的数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="url"></param>
...
...
@@ -125,58 +126,23 @@ namespace RsCode
}
else
{
string
ret
=
await
response
.
Content
.
ReadAsStringAsync
();
ReturnInfo
returnInfo
=
JsonSerializer
.
Deserialize
<
ReturnInfo
>(
ret
);
if
(
returnInfo
!=
null
)
{
throw
new
AppException
(
returnInfo
.
Msg
);
}
int
code
=
(
int
)
response
.
StatusCode
;
string
content
=
await
response
.
Content
.
ReadAsStringAsync
();
GetException
(
code
,
$"RequestUri=
{
httpRequestMessage
.
RequestUri
.
ToString
()}
"
+
content
);
}
return
page
;
}
public
virtual
async
Task
<
T
>
GetItemsAsync
<
T
>(
string
url
,
string
accessToken
=
""
)
{
HttpRequestMessage
httpRequestMessage
=
new
HttpRequestMessage
(
HttpMethod
.
Get
,
url
);
if
(!
string
.
IsNullOrWhiteSpace
(
accessToken
))
{
httpRequestMessage
.
Headers
.
Add
(
"Authorization"
,
$"Bearer
{
accessToken
}
"
);
}
var
response
=
await
HttpClient
.
SendAsync
(
httpRequestMessage
);
if
(
response
.
StatusCode
==
System
.
Net
.
HttpStatusCode
.
Unauthorized
)
{
throw
new
AppException
(
401
,
"无访问权限"
);
}
if
(
response
.
StatusCode
==
System
.
Net
.
HttpStatusCode
.
OK
)
{
string
s
=
await
response
.
Content
.
ReadAsStringAsync
();
var
ret
=
JsonSerializer
.
Deserialize
<
ReturnInfo
>(
s
);
JsonSerializerOptions
options
=
new
JsonSerializerOptions
();
options
.
Converters
.
Add
(
new
DateTimeConverterUsingDateTimeParse
());
JsonDocument
doc
=
JsonDocument
.
Parse
(
s
);
var
root
=
doc
.
RootElement
;
var
result
=
root
.
GetProperty
(
"result"
);
var
items
=
result
.
GetProperty
(
"items"
);
var
ls
=
items
.
EnumerateArray
();
var
data
=
JsonSerializer
.
Deserialize
<
T
>(
ls
.
JsonSerialize
(),
options
);
return
data
;
}
else
{
string
ret
=
await
response
.
Content
.
ReadAsStringAsync
();
ReturnInfo
returnInfo
=
JsonSerializer
.
Deserialize
<
ReturnInfo
>(
ret
);
if
(
returnInfo
!=
null
)
{
throw
new
AppException
(
returnInfo
.
Msg
);
}
return
default
(
T
);
}
}
/// <summary>
/// 请求POST数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="url"></param>
/// <param name="httpContent"></param>
/// <param name="accessToken"></param>
/// <returns></returns>
/// <exception cref="AppException"></exception>
public
virtual
async
Task
<
T
>
PostAsync
<
T
>(
string
url
,
HttpContent
httpContent
,
string
accessToken
=
""
)
{
...
...
@@ -207,60 +173,24 @@ namespace RsCode
}
else
{
string
ret
=
await
response
.
Content
.
ReadAsStringAsync
();
ReturnInfo
returnInfo
=
JsonSerializer
.
Deserialize
<
ReturnInfo
>(
ret
);
if
(
returnInfo
!=
null
)
{
throw
new
AppException
(
returnInfo
.
Msg
);
}
return
default
(
T
);
}
}
public
virtual
async
Task
<
T
>
PostItemsAsync
<
T
>(
string
url
,
HttpContent
httpContent
,
string
accessToken
=
""
)
{
HttpRequestMessage
request
=
new
HttpRequestMessage
(
HttpMethod
.
Post
,
url
);
request
.
Content
=
httpContent
;
if
(!
string
.
IsNullOrWhiteSpace
(
accessToken
))
{
request
.
Headers
.
Add
(
"Authorization"
,
$"Bearer
{
accessToken
}
"
);
}
var
response
=
await
HttpClient
.
SendAsync
(
request
);
if
(
response
.
StatusCode
==
System
.
Net
.
HttpStatusCode
.
Unauthorized
)
{
throw
new
AppException
(
401
,
"无访问权限"
);
}
if
(
response
.
StatusCode
==
System
.
Net
.
HttpStatusCode
.
OK
)
{
string
s
=
await
response
.
Content
.
ReadAsStringAsync
();
int
code
=
(
int
)
response
.
StatusCode
;
string
content
=
await
response
.
Content
.
ReadAsStringAsync
();
GetException
(
code
,
$"RequestUri=
{
response
.
RequestMessage
.
RequestUri
.
ToString
()}
"
+
content
);
JsonSerializerOptions
options
=
new
JsonSerializerOptions
();
options
.
Converters
.
Add
(
new
DateTimeConverterUsingDateTimeParse
());
JsonDocument
doc
=
JsonDocument
.
Parse
(
s
);
var
root
=
doc
.
RootElement
;
var
result
=
root
.
GetProperty
(
"result"
);
var
items
=
result
.
GetProperty
(
"items"
);
var
ls
=
items
.
EnumerateArray
();
var
data
=
JsonSerializer
.
Deserialize
<
T
>(
ls
.
JsonSerialize
(),
options
);
return
data
;
}
else
{
string
ret
=
await
response
.
Content
.
ReadAsStringAsync
();
ReturnInfo
returnInfo
=
JsonSerializer
.
Deserialize
<
ReturnInfo
>(
ret
);
if
(
returnInfo
!=
null
)
{
throw
new
AppException
(
returnInfo
.
Msg
);
}
return
default
(
T
);
}
}
}
/// <summary>
/// PUT数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="url"></param>
/// <param name="httpContent"></param>
/// <param name="accessToken"></param>
/// <returns></returns>
/// <exception cref="AppException"></exception>
public
virtual
async
Task
<
T
>
PutAsync
<
T
>(
string
url
,
HttpContent
httpContent
,
string
accessToken
=
""
)
{
...
...
@@ -291,19 +221,22 @@ namespace RsCode
}
else
{
string
ret
=
await
response
.
Content
.
ReadAsStringAsync
();
ReturnInfo
returnInfo
=
JsonSerializer
.
Deserialize
<
ReturnInfo
>(
ret
);
if
(
returnInfo
!=
null
)
{
throw
new
AppException
(
returnInfo
.
Msg
);
}
int
code
=
(
int
)
response
.
StatusCode
;
string
content
=
await
response
.
Content
.
ReadAsStringAsync
();
GetException
(
code
,
$"RequestUri=
{
response
.
RequestMessage
.
RequestUri
.
ToString
()}
"
+
content
);
return
default
(
T
);
}
}
}
/// <summary>
/// DELETE数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="url"></param>
/// <param name="httpContent"></param>
/// <param name="accessToken"></param>
/// <returns></returns>
/// <exception cref="AppException"></exception>
public
virtual
async
Task
<
T
>
DeleteAsync
<
T
>(
string
url
,
HttpContent
httpContent
,
string
accessToken
=
""
)
{
...
...
@@ -334,12 +267,9 @@ namespace RsCode
}
else
{
string
ret
=
await
response
.
Content
.
ReadAsStringAsync
();
ReturnInfo
returnInfo
=
JsonSerializer
.
Deserialize
<
ReturnInfo
>(
ret
);
if
(
returnInfo
!=
null
)
{
throw
new
AppException
(
returnInfo
.
Msg
);
}
int
code
=
(
int
)
response
.
StatusCode
;
string
content
=
await
response
.
Content
.
ReadAsStringAsync
();
GetException
(
code
,
$"RequestUri=
{
response
.
RequestMessage
.
RequestUri
.
ToString
()}
"
+
content
);
return
default
(
T
);
}
...
...
@@ -360,8 +290,36 @@ namespace RsCode
return
p
.
Get
(
urlParamName
);
}
void
GetException
(
int
code
,
string
content
)
{
try
{
if
(!
string
.
IsNullOrWhiteSpace
(
content
))
{
if
(
content
.
Contains
(
"{"
)&&
content
.
Contains
(
"}"
))
{
var
returnInfo
=
JsonSerializer
.
Deserialize
<
ReturnInfo
>(
content
);
throw
new
AppException
(
returnInfo
.
code
,
returnInfo
.
Msg
);
}
else
{
throw
new
AppException
(
code
,
content
);
}
}
else
{
throw
new
AppException
(
code
,
content
);
}
}
catch
(
Exception
e
)
{
throw
e
;
}
}
}
/// <summary>
/// 日期格式处理
/// </summary>
public
class
DateTimeConverterUsingDateTimeParse
:
JsonConverter
<
DateTime
>
{
...
...
src/RsCode/Helper/JsonHelper.cs
浏览文件 @
ffac4739
...
...
@@ -16,6 +16,9 @@ using System.IO;
namespace
System.Text.Json
{
/// <summary>
/// json helper
/// </summary>
public
static
class
JsonHelper
{
/// <summary>
...
...
src/RsCode/Helper/XmlHelper.cs
浏览文件 @
ffac4739
/*
* .netcore 对xml操作的工具类
*
* RsCode is .net core platform rapid development framework
* Apache License 2.0
*
* 作者:lrj
*
* 项目己托管于
* gitee
* https://gitee.com/rswl/RsCode.git
*
* github
https://github.com/kuiyu/RsCode.git
*/
using
System
;
using
System.Globalization
;
using
System.IO
;
using
System.Xml.Serialization
;
...
...
@@ -10,7 +26,7 @@ namespace RsCode.Helper
public
class
XmlHelper
{
/// <summary>
///
xml
ת
///
将指定xml文件的内容
转对象
/// </summary>
/// <param name="type"></param>
/// <param name="filePath"></param>
...
...
@@ -41,7 +57,7 @@ namespace RsCode.Helper
return
obj
;
}
/// <summary>
///
xml
л
///
将指定xml文件的内容
序列化
/// </summary>
/// <param name="obj"></param>
/// <param name="filePath"></param>
...
...
@@ -72,5 +88,53 @@ namespace RsCode.Helper
}
return
flag
;
}
}
/// <summary>
/// 将xml字符串转化对象
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="xml"></param>
/// <param name="xmlRoot"></param>
/// <returns></returns>
public
static
T
Deserializer
<
T
>(
string
xml
,
string
xmlRoot
=
""
)
{
XmlSerializer
serializer
=
new
XmlSerializer
(
typeof
(
T
),
new
XmlRootAttribute
(
xmlRoot
));
using
(
StringReader
sr
=
new
StringReader
(
xml
))
{
var
obj
=
serializer
.
Deserialize
(
sr
);
return
obj
!=
null
?
(
T
)
obj
:
default
(
T
);
}
return
default
(
T
);
}
/// <summary>
/// 将对象转成xml字符串
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <param name="xsd"></param>
/// <param name="xsi"></param>
/// <param name="xmlRoot"></param>
/// <returns></returns>
public
static
string
Serializer
<
T
>(
T
obj
,
string
xsd
=
""
,
string
xsi
=
""
,
string
xmlRoot
=
""
)
{
XmlSerializerNamespaces
ns
=
new
XmlSerializerNamespaces
();
if
(!
string
.
IsNullOrWhiteSpace
(
xsd
))
{
ns
.
Add
(
"xsd"
,
xsd
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
xsi
))
{
ns
.
Add
(
"xsi"
,
xsi
);
}
XmlRootAttribute
xra
=
new
XmlRootAttribute
(
xmlRoot
);
XmlSerializer
serializer
=
new
XmlSerializer
(
typeof
(
T
),
xra
);
using
(
StringWriter
writer
=
new
StringWriter
(
CultureInfo
.
InvariantCulture
))
{
serializer
.
Serialize
(
writer
,
obj
,
ns
);
string
xml
=
writer
.
ToString
();
return
xml
;
}
}
}
}
\ No newline at end of file
src/RsCode/RsCode.csproj
浏览文件 @
ffac4739
...
...
@@ -4,14 +4,14 @@
<TargetFramework>netstandard2.0</TargetFramework>
<Company>河南软商网络科技有限公司</Company>
<Copyright>河南软商网络科技有限公司</Copyright>
<AssemblyVersion>1.5.
6
.0</AssemblyVersion>
<FileVersion>1.5.
6
.0</FileVersion>
<AssemblyVersion>1.5.
8
.0</AssemblyVersion>
<FileVersion>1.5.
8
.0</FileVersion>
<Authors>Tony</Authors>
<Description>快速高效的开发.net就用RsCode,文档访问https://rscode.cn</Description>
<PackageProjectUrl>https://github.com/kuiyu/RsCode.git</PackageProjectUrl>
<PackageIcon>rscode64_64.png</PackageIcon>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>1.5.
6
</Version>
<Version>1.5.
8
</Version>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
</PropertyGroup>
...
...
src/RsCode/RsCode.xml
浏览文件 @
ffac4739
...
...
@@ -183,7 +183,13 @@
日期帮助类
</summary>
</member>
<!-- Badly formed XML comment ignored for member "M:System.DateTimeHelper.GetTimeByJavascript(System.Int64)" -->
<member
name=
"M:System.DateTimeHelper.GetTimeByJavascript(System.Int64)"
>
<summary>
时间戳转为C#格式时间
</summary>
<param
name=
"timeStamp"
></param>
<returns></returns>
</member>
<member
name=
"M:System.DateTimeHelper.ConvertDateTimeByJavascript(System.DateTime)"
>
<summary>
把时间转换为javascript所使用的时间
...
...
@@ -245,6 +251,11 @@
<param
name=
"value"
>
要获取描述信息的枚举值。
</param>
<returns>
枚举值的描述信息。
</returns>
</member>
<member
name=
"T:System.Text.Json.JsonHelper"
>
<summary>
json helper
</summary>
</member>
<member
name=
"M:System.Text.Json.JsonHelper.JsonSerialize(System.Object)"
>
<summary>
使用json格式序列化对象
...
...
@@ -306,6 +317,55 @@
.netcore json config
</summary>
</member>
<member
name=
"M:RsCode.AppSettings.GetValue``1(System.String,System.String)"
>
<summary>
</summary>
<typeparam
name=
"T"
></typeparam>
<param
name=
"Key"
></param>
<param
name=
"JsonFilePath"
></param>
<returns></returns>
</member>
<member
name=
"M:RsCode.AppSettings.GetAllValue``1(System.String)"
>
<summary>
</summary>
<typeparam
name=
"T"
></typeparam>
<param
name=
"JsonFilePath"
></param>
<returns></returns>
</member>
<member
name=
"M:RsCode.AppSettings.GetSection(System.String,System.String)"
>
<summary>
</summary>
<param
name=
"key"
></param>
<param
name=
"JsonFilePath"
></param>
<returns></returns>
</member>
<member
name=
"M:RsCode.AppSettings.GetConnectionString(System.String)"
>
<summary>
</summary>
<param
name=
"connStrName"
></param>
<returns></returns>
</member>
<member
name=
"M:RsCode.AppSettings.GetSection``1(System.String,System.String)"
>
<summary>
</summary>
<typeparam
name=
"T"
></typeparam>
<param
name=
"key"
></param>
<param
name=
"JsonFilePath"
></param>
<returns></returns>
</member>
<member
name=
"M:RsCode.AppSettings.GetAllSection``1(System.String)"
>
<summary>
</summary>
<typeparam
name=
"T"
></typeparam>
<param
name=
"JsonFilePath"
></param>
<returns></returns>
</member>
<member
name=
"M:RsCode.AppSettings.Exists(System.String,System.String)"
>
<summary>
检查节点是否存在
...
...
@@ -314,6 +374,20 @@
<param
name=
"JsonFilePath"
></param>
<returns></returns>
</member>
<member
name=
"M:RsCode.AppSettings.GetJObject(System.String)"
>
<summary>
</summary>
<param
name=
"JsonFilePath"
></param>
<returns></returns>
</member>
<member
name=
"M:RsCode.AppSettings.WriteJsonFile(System.String,System.String)"
>
<summary>
</summary>
<param
name=
"path"
></param>
<param
name=
"jsonConents"
></param>
</member>
<member
name=
"M:RsCode.DI.Context.#ctor(System.Collections.Generic.IEnumerable{System.Type},System.Collections.Generic.IDictionary{System.String,System.Object},System.Action{System.String})"
>
<summary>
初始化一个
<see
cref=
"T:RsCode.DI.Context"
/>
类
...
...
@@ -748,7 +822,59 @@
针对RsCode WebApi响应做的封装
</summary>
</member>
<!-- Badly formed XML comment ignored for member "M:RsCode.HttpHelper.GetPageAsync``1(System.String,System.String)" -->
<member
name=
"M:RsCode.HttpHelper.GetAsync``1(System.String,System.String)"
>
<summary>
发送get请求
</summary>
<typeparam
name=
"T"
></typeparam>
<param
name=
"url"
></param>
<param
name=
"accessToken"
></param>
<returns></returns>
<exception
cref=
"T:RsCode.AspNetCore.AppException"
></exception>
</member>
<member
name=
"M:RsCode.HttpHelper.GetPageAsync``1(System.String,System.String)"
>
<summary>
获取PetaPoco.Page结果的数据
</summary>
<typeparam
name=
"T"
></typeparam>
<param
name=
"url"
></param>
<param
name=
"accessToken"
></param>
<returns></returns>
<exception
cref=
"T:RsCode.AspNetCore.AppException"
></exception>
</member>
<member
name=
"M:RsCode.HttpHelper.PostAsync``1(System.String,System.Net.Http.HttpContent,System.String)"
>
<summary>
请求POST数据
</summary>
<typeparam
name=
"T"
></typeparam>
<param
name=
"url"
></param>
<param
name=
"httpContent"
></param>
<param
name=
"accessToken"
></param>
<returns></returns>
<exception
cref=
"T:RsCode.AspNetCore.AppException"
></exception>
</member>
<member
name=
"M:RsCode.HttpHelper.PutAsync``1(System.String,System.Net.Http.HttpContent,System.String)"
>
<summary>
PUT数据
</summary>
<typeparam
name=
"T"
></typeparam>
<param
name=
"url"
></param>
<param
name=
"httpContent"
></param>
<param
name=
"accessToken"
></param>
<returns></returns>
<exception
cref=
"T:RsCode.AspNetCore.AppException"
></exception>
</member>
<member
name=
"M:RsCode.HttpHelper.DeleteAsync``1(System.String,System.Net.Http.HttpContent,System.String)"
>
<summary>
DELETE数据
</summary>
<typeparam
name=
"T"
></typeparam>
<param
name=
"url"
></param>
<param
name=
"httpContent"
></param>
<param
name=
"accessToken"
></param>
<returns></returns>
<exception
cref=
"T:RsCode.AspNetCore.AppException"
></exception>
</member>
<member
name=
"M:RsCode.HttpHelper.GetUrlParamValue(System.String,System.String)"
>
<summary>
获取地址栏参数值
...
...
@@ -757,6 +883,11 @@
<param
name=
"urlParamName"
></param>
<returns></returns>
</member>
<member
name=
"T:RsCode.DateTimeConverterUsingDateTimeParse"
>
<summary>
日期格式处理
</summary>
</member>
<member
name=
"M:RsCode.RandomHelper.RandAmount(System.Double,System.Int32)"
>
<summary>
正态随机分配额度
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录