Aisix.Common.QCloud
1.0.0
dotnet add package Aisix.Common.QCloud --version 1.0.0
NuGet\Install-Package Aisix.Common.QCloud -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aisix.Common.QCloud" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aisix.Common.QCloud" Version="1.0.0" />
<PackageReference Include="Aisix.Common.QCloud" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aisix.Common.QCloud --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Aisix.Common.QCloud, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Aisix.Common.QCloud@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Aisix.Common.QCloud&version=1.0.0
#tool nuget:?package=Aisix.Common.QCloud&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Aisix.Common.QCloud
Aisix.Common.QCloud 是一个腾讯云服务集成库,提供了腾讯云临时凭证服务和验证码功能。
功能特性
- 腾讯云临时凭证 (STS) 服务
- 腾讯云验证码服务
- 支持 .NET 7.0 和 .NET 8.0
安装
dotnet add package Aisix.Common.QCloud
依赖项
- Tencent.QCloud.Cos.Sts.Sdk (>= 3.0.5)
使用方法
1. 配置服务
// 在 appsettings.json 中配置
{
"TencentCloud": {
"SecretId": "your-secret-id",
"SecretKey": "your-secret-key",
"Region": "ap-beijing",
"Bucket": "your-bucket-name",
"CaptchaAppId": "your-captcha-app-id",
"CaptchaAppSecretKey": "your-captcha-app-secret-key"
}
}
// 在 Startup.cs 或 Program.cs 中配置
builder.Services.Configure<TencentCloudOptions>(builder.Configuration.GetSection("TencentCloud"));
builder.Services.AddSingleton<TencentCloudService>();
2. 使用临时凭证服务
public class FileUploadService
{
private readonly TencentCloudService _tencentCloudService;
public FileUploadService(TencentCloudService tencentCloudService)
{
_tencentCloudService = tencentCloudService;
}
public async Task<CredentialsResult> GetUploadCredentials()
{
var result = await _tencentCloudService.GetCredentialsAsync();
return result;
}
}
3. 使用验证码服务
public class AccountController : ControllerBase
{
private readonly TencentCloudService _tencentCloudService;
public AccountController(TencentCloudService tencentCloudService)
{
_tencentCloudService = tencentCloudService;
}
[HttpPost("verify-captcha")]
public async Task<IActionResult> VerifyCaptcha([FromBody] CaptchaRequest request)
{
var result = await _tencentCloudService.VerifyCaptchaAsync(
request.Ticket,
request.RandomStr,
request.UserIp
);
if (result.CaptchaCode == 1)
{
return Ok(new { success = true });
}
return BadRequest(new { success = false, message = result.ErrorMessage });
}
}
配置选项
TencentCloudOptions
SecretId: 腾讯云 SecretIdSecretKey: 腾讯云 SecretKeyRegion: 地域信息Bucket: 存储桶名称CaptchaAppId: 验证码应用IDCaptchaAppSecretKey: 验证码应用密钥
许可证
MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- Tencent.QCloud.Cos.Sts.Sdk (>= 3.0.5)
-
net8.0
- Tencent.QCloud.Cos.Sts.Sdk (>= 3.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 297 | 8/6/2025 |