Browse Source
Merge pull request #12 from colinin/2.9
增加几个常用模块README.md
pull/21/head
cKey
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
164 additions and
0 deletions
-
aspnet-core/modules/common/LINGYUN.Abp.Aliyun.Authorization/README.md
-
aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Aliyun/README.md
-
aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Emailing/README.md
-
aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/README.md
-
aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/README.md
|
|
|
@ -0,0 +1,29 @@ |
|
|
|
# LINGYUN.Abp.Aliyun.Authorization |
|
|
|
|
|
|
|
阿里云基础认证模块, 目前只需要访问控制功能, 因此只定义了AppKeyId和AccessKeySecret。 |
|
|
|
|
|
|
|
## 配置使用 |
|
|
|
|
|
|
|
模块按需引用,使用到阿里云的模块基本都需要依赖于此 |
|
|
|
|
|
|
|
事先定义**appsettings.json**文件 |
|
|
|
|
|
|
|
```json |
|
|
|
{ |
|
|
|
"Aliyun": { |
|
|
|
"Auth": { |
|
|
|
"AccessKeyId": "你的阿里云访问标识", |
|
|
|
"AccessKeySecret": "你的阿里云访问密钥" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
```csharp |
|
|
|
[DependsOn(typeof(AbpAliyunAuthorizationModule))] |
|
|
|
public class YouProjectModule : AbpModule |
|
|
|
{ |
|
|
|
// other |
|
|
|
} |
|
|
|
``` |
|
|
|
@ -0,0 +1,34 @@ |
|
|
|
# LINGYUN.Abp.BlobStoring.Aliyun |
|
|
|
|
|
|
|
abp框架对象存储提供者**IBlobProvider**的阿里云实现 |
|
|
|
|
|
|
|
## 配置使用 |
|
|
|
|
|
|
|
模块按需引用,需要引用阿里云公共基础认证模块 |
|
|
|
|
|
|
|
事先定义**appsettings.json**文件 |
|
|
|
|
|
|
|
```json |
|
|
|
{ |
|
|
|
"Aliyun": { |
|
|
|
"Auth": { |
|
|
|
"AccessKeyId": "你的阿里云访问标识", |
|
|
|
"AccessKeySecret": "你的阿里云访问密钥" |
|
|
|
}, |
|
|
|
"OSS": { |
|
|
|
"BucketName": "你定义的BucketName", |
|
|
|
"Endpoint": "http://oss-cn-shanghai.aliyuncs.com", |
|
|
|
"CreateBucketIfNotExists": true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
```csharp |
|
|
|
[DependsOn(typeof(AbpBlobStoringAliyunModule))] |
|
|
|
public class YouProjectModule : AbpModule |
|
|
|
{ |
|
|
|
// other |
|
|
|
} |
|
|
|
``` |
|
|
|
@ -0,0 +1,37 @@ |
|
|
|
# LINGYUN.Abp.ExceptionHandling.Emailing |
|
|
|
|
|
|
|
基于abp框架底层的**IExceptionSubscriber**的邮件通知类型 |
|
|
|
|
|
|
|
## 配置使用 |
|
|
|
|
|
|
|
使用前需要配置**AbpExceptionHandlingOptions**定义需要发送通知的异常 |
|
|
|
然后配置**AbpEmailExceptionHandlingOptions**定义具体异常类型通知方式 |
|
|
|
|
|
|
|
```csharp |
|
|
|
|
|
|
|
[DependsOn( |
|
|
|
typeof(AbpEmailingExceptionHandlingModule) |
|
|
|
)] |
|
|
|
public class YouProjectModule : AbpModule |
|
|
|
{ |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
// 自定义需要处理的异常 |
|
|
|
Configure<AbpExceptionHandlingOptions>(options => |
|
|
|
{ |
|
|
|
// 加入需要处理的异常类型 |
|
|
|
options.Handlers.Add<AbpException>(); |
|
|
|
}); |
|
|
|
// 自定义需要发送邮件通知的异常类型 |
|
|
|
Configure<AbpEmailExceptionHandlingOptions>(options => |
|
|
|
{ |
|
|
|
// 是否发送堆栈信息 |
|
|
|
options.SendStackTrace = true; |
|
|
|
// 未指定异常接收者的默认接收邮件 |
|
|
|
options.DefaultReceiveEmail = "colin.in@foxmail.com"; |
|
|
|
// 指定某种异常发送到哪个邮件 |
|
|
|
options.HandReceivedException<AbpException>("colin.in@foxmail.com"); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
``` |
|
|
|
@ -0,0 +1,26 @@ |
|
|
|
# LINGYUN.Abp.ExceptionHandling |
|
|
|
|
|
|
|
基于abp框架底层的**IExceptionSubscriber**实现二次扩展,用于自定义异常通知方式 |
|
|
|
|
|
|
|
## 配置使用 |
|
|
|
|
|
|
|
使用前只需配置**AbpExceptionHandlingOptions**定义需要发送通知的异常即可。 |
|
|
|
|
|
|
|
```csharp |
|
|
|
|
|
|
|
[DependsOn( |
|
|
|
typeof(AbpExceptionHandlingModule) |
|
|
|
)] |
|
|
|
public class YouProjectModule : AbpModule |
|
|
|
{ |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
// 自定义需要处理的异常 |
|
|
|
Configure<AbpExceptionHandlingOptions>(options => |
|
|
|
{ |
|
|
|
// 加入需要处理的异常类型 |
|
|
|
options.Handlers.Add<AbpException>(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
``` |
|
|
|
@ -0,0 +1,38 @@ |
|
|
|
# LINGYUN.Abp.Sms.Aliyun |
|
|
|
|
|
|
|
abp框架短信发送接口**ISmsSender**的阿里云实现 |
|
|
|
|
|
|
|
## 配置使用 |
|
|
|
|
|
|
|
模块按需引用,需要引用阿里云公共基础认证模块 |
|
|
|
|
|
|
|
事先定义**appsettings.json**文件 |
|
|
|
|
|
|
|
```json |
|
|
|
{ |
|
|
|
"Aliyun": { |
|
|
|
"Auth": { |
|
|
|
"AccessKeyId": "你的阿里云访问标识", |
|
|
|
"AccessKeySecret": "你的阿里云访问密钥" |
|
|
|
}, |
|
|
|
"Sms": { |
|
|
|
"RegionId": "cn-hangzhou", |
|
|
|
"Domain": "dysmsapi.aliyuncs.com", |
|
|
|
"Version": "2017-05-25", |
|
|
|
"DefaultSignName": "你的阿里云短信签名,SmsMessage.Properties[SignName]不存在则使用DefaultSignName", |
|
|
|
"DefaultTemplateCode": "你的阿里云短信模板,SmsMessage.Properties[TemplateCode]不存在则使用DefaultTemplateCode", |
|
|
|
"DeveloperPhoneNumber": "这是用于在开发模式下的短信号码,用于统一接收短信", |
|
|
|
"VisableErrorToClient": true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
```csharp |
|
|
|
[DependsOn(typeof(AbpAliyunSmsModule))] |
|
|
|
public class YouProjectModule : AbpModule |
|
|
|
{ |
|
|
|
// other |
|
|
|
} |
|
|
|
``` |