Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a50c45f7a3 | ||
|
|
2bc8837155 | ||
|
|
8a6e5abf48 | ||
|
|
8b191330b8 | ||
|
|
0d2f2cb826 | ||
|
|
571df74c43 | ||
|
|
cefde6848d |
@@ -12,6 +12,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SatelliteResourceLanguages>en;zh-CN</SatelliteResourceLanguages>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Version>1.0.0</Version>
|
||||
<NoWarn>$(NoWarn);CS1591;CS8618;CS1998;CS8604;CS8620;CS8600;CS8602</NoWarn>
|
||||
|
||||
@@ -3,7 +3,6 @@ using Mapster;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using TencentCloud.Pds.V20210701.Models;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.EventBus.Local;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using TencentCloud.Tbm.V20180129.Models;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.Domain.Entities.Events;
|
||||
using Volo.Abp.EventBus;
|
||||
using Volo.Abp.EventBus.Local;
|
||||
|
||||
@@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.VisualBasic;
|
||||
using TencentCloud.Mna.V20210119.Models;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Caching;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using TencentCloud.Tcr.V20190924.Models;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Caching;
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TencentCloud.Common.Profile;
|
||||
using TencentCloud.Common;
|
||||
using TencentCloud.Sms.V20210111.Models;
|
||||
using TencentCloud.Sms.V20210111;
|
||||
using Volo.Abp.Domain.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Yi.Framework.Rbac.Domain.Managers
|
||||
{
|
||||
public class TencentCloudManager : DomainService
|
||||
{
|
||||
private ILogger<TencentCloudManager> _logger;
|
||||
public TencentCloudManager(ILogger<TencentCloudManager> logger)
|
||||
{
|
||||
_logger= logger;
|
||||
}
|
||||
|
||||
public async Task SendSmsAsync()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
||||
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
||||
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
||||
Credential cred = new Credential
|
||||
{
|
||||
SecretId = "SecretId",
|
||||
SecretKey = "SecretKey"
|
||||
};
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.Endpoint = ("sms.tencentcloudapi.com");
|
||||
clientProfile.HttpProfile = httpProfile;
|
||||
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
SmsClient client = new SmsClient(cred, "", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
SendSmsRequest req = new SendSmsRequest();
|
||||
|
||||
// 返回的resp是一个SendSmsResponse的实例,与请求对象对应
|
||||
SendSmsResponse resp = await client.SendSms(req);
|
||||
// 输出json格式的字符串回包
|
||||
_logger.LogInformation("腾讯云Sms返回:"+AbstractModel.ToJsonString(resp));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e,e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
// using TencentCloud.Common.Profile;
|
||||
// using TencentCloud.Common;
|
||||
// using TencentCloud.Sms.V20210111.Models;
|
||||
// using TencentCloud.Sms.V20210111;
|
||||
// using Volo.Abp.Domain.Services;
|
||||
// using Microsoft.Extensions.Logging;
|
||||
//
|
||||
// namespace Yi.Framework.Rbac.Domain.Managers
|
||||
// {
|
||||
// public class TencentCloudManager : DomainService
|
||||
// {
|
||||
// private ILogger<TencentCloudManager> _logger;
|
||||
// public TencentCloudManager(ILogger<TencentCloudManager> logger)
|
||||
// {
|
||||
// _logger= logger;
|
||||
// }
|
||||
//
|
||||
// public async Task SendSmsAsync()
|
||||
// {
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// // 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
||||
// // 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
||||
// // 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
||||
// Credential cred = new Credential
|
||||
// {
|
||||
// SecretId = "SecretId",
|
||||
// SecretKey = "SecretKey"
|
||||
// };
|
||||
// // 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
// ClientProfile clientProfile = new ClientProfile();
|
||||
// // 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
// HttpProfile httpProfile = new HttpProfile();
|
||||
// httpProfile.Endpoint = ("sms.tencentcloudapi.com");
|
||||
// clientProfile.HttpProfile = httpProfile;
|
||||
//
|
||||
// // 实例化要请求产品的client对象,clientProfile是可选的
|
||||
// SmsClient client = new SmsClient(cred, "", clientProfile);
|
||||
// // 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
// SendSmsRequest req = new SendSmsRequest();
|
||||
//
|
||||
// // 返回的resp是一个SendSmsResponse的实例,与请求对象对应
|
||||
// SendSmsResponse resp = await client.SendSms(req);
|
||||
// // 输出json格式的字符串回包
|
||||
// _logger.LogInformation("腾讯云Sms返回:"+AbstractModel.ToJsonString(resp));
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// _logger.LogError(e,e.ToString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<PackageReference Include="IPTools.China" Version="1.6.0" />
|
||||
|
||||
<PackageReference Include="TencentCloudSDK" Version="3.0.966" />
|
||||
<!-- <PackageReference Include="TencentCloudSDK" Version="3.0.966" />-->
|
||||
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
|
||||
|
||||
@@ -280,19 +280,19 @@ namespace Yi.Abp.Web
|
||||
};
|
||||
options.Events = new JwtBearerEvents
|
||||
{
|
||||
OnMessageReceived = context =>
|
||||
OnMessageReceived = messageContext =>
|
||||
{
|
||||
//优先Query中获取,再去cookies中获取
|
||||
var accessToken = context.Request.Query["access_token"];
|
||||
var accessToken = messageContext.Request.Query["access_token"];
|
||||
if (!string.IsNullOrEmpty(accessToken))
|
||||
{
|
||||
context.Token = accessToken;
|
||||
messageContext.Token = accessToken;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (context.Request.Cookies.TryGetValue("Token", out var cookiesToken))
|
||||
if (messageContext.Request.Cookies.TryGetValue("Token", out var cookiesToken))
|
||||
{
|
||||
context.Token = cookiesToken;
|
||||
messageContext.Token = cookiesToken;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,19 +313,19 @@ namespace Yi.Abp.Web
|
||||
};
|
||||
options.Events = new JwtBearerEvents
|
||||
{
|
||||
OnMessageReceived = context =>
|
||||
OnMessageReceived = messageContext =>
|
||||
{
|
||||
var refresh_token = context.Request.Headers["refresh_token"];
|
||||
if (!string.IsNullOrEmpty(refresh_token))
|
||||
var headerRefreshToken = messageContext.Request.Headers["refresh_token"];
|
||||
if (!string.IsNullOrEmpty(headerRefreshToken))
|
||||
{
|
||||
context.Token = refresh_token;
|
||||
messageContext.Token = headerRefreshToken;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
var refreshToken = context.Request.Query["refresh_token"];
|
||||
if (!string.IsNullOrEmpty(refreshToken))
|
||||
var queryRefreshToken = messageContext.Request.Query["refresh_token"];
|
||||
if (!string.IsNullOrEmpty(queryRefreshToken))
|
||||
{
|
||||
context.Token = refreshToken;
|
||||
messageContext.Token = queryRefreshToken;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Shouldly;
|
||||
using TencentCloud.Ame.V20190916.Models;
|
||||
using TencentCloud.Tiw.V20190919.Models;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Xunit;
|
||||
using Yi.Framework.Rbac.Application.Contracts.Dtos.User;
|
||||
|
||||
@@ -50,7 +50,7 @@ export function delDept(deptId) {
|
||||
return request({
|
||||
url: `/dept`,
|
||||
method: 'delete',
|
||||
params:{id:deptId}
|
||||
params:{ids:deptId}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user