Browse Source

feat(docs): 添加微信发送模块文档

pull/1049/head
feijie 1 year ago
parent
commit
6d1a197455
  1. 79
      aspnet-core/framework/wx-pusher/LINGYUN.Abp.Identity.WxPusher/README.EN.md
  2. 68
      aspnet-core/framework/wx-pusher/LINGYUN.Abp.Identity.WxPusher/README.md
  3. 98
      aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher.SettingManagement/README.EN.md
  4. 98
      aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher.SettingManagement/README.md
  5. 102
      aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher/README.EN.md
  6. 97
      aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher/README.md
  7. 97
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WxPusher/README.EN.md
  8. 88
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WxPusher/README.md

79
aspnet-core/framework/wx-pusher/LINGYUN.Abp.Identity.WxPusher/README.EN.md

@ -0,0 +1,79 @@
# LINGYUN.Abp.Identity.WxPusher
Implementation of the IWxPusherUserStore interface for the Identity module, retrieving subscribed topic lists through user Claims.
[简体中文](./README.md)
## Features
* Integration with WxPusher user storage interface
* Manage WxPusher UID and Topic through user Claims
* Support batch retrieval of user-bound UIDs
* Support batch retrieval of user-subscribed Topics
## Installation
```bash
dotnet add package LINGYUN.Abp.Identity.WxPusher
```
## Module Reference
```csharp
[DependsOn(typeof(AbpIdentityWxPusherModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
## Usage
This module implements the `IWxPusherUserStore` interface, storing WxPusher-related information through user Claims:
* `AbpWxPusherClaimTypes.Uid`: Stores the WxPusher UID bound to the user
* `AbpWxPusherClaimTypes.Topic`: Stores the Topic ID subscribed by the user
### Get User-Bound UIDs
```csharp
public class YourService
{
private readonly IWxPusherUserStore _wxPusherUserStore;
public YourService(IWxPusherUserStore wxPusherUserStore)
{
_wxPusherUserStore = wxPusherUserStore;
}
public async Task DoSomethingAsync(IEnumerable<Guid> userIds)
{
var uids = await _wxPusherUserStore.GetBindUidsAsync(userIds);
// Use the retrieved uids for message pushing or other operations
}
}
```
### Get User-Subscribed Topics
```csharp
public class YourService
{
private readonly IWxPusherUserStore _wxPusherUserStore;
public YourService(IWxPusherUserStore wxPusherUserStore)
{
_wxPusherUserStore = wxPusherUserStore;
}
public async Task DoSomethingAsync(IEnumerable<Guid> userIds)
{
var topics = await _wxPusherUserStore.GetSubscribeTopicsAsync(userIds);
// Use the retrieved topics for message pushing or other operations
}
}
```
## Source Code
[LINGYUN.Abp.Identity.WxPusher](https://github.com/colinin/abp-next-admin/tree/master/aspnet-core/framework/wx-pusher/LINGYUN.Abp.Identity.WxPusher)

68
aspnet-core/framework/wx-pusher/LINGYUN.Abp.Identity.WxPusher/README.md

@ -2,12 +2,78 @@
IWxPusherUserStore 接口的Identity模块实现, 通过用户Claims来获取关注的topic列表 IWxPusherUserStore 接口的Identity模块实现, 通过用户Claims来获取关注的topic列表
[English](./README.EN.md)
## 功能特性
* 集成WxPusher用户存储接口
* 通过用户Claims管理WxPusher的UID和Topic
* 支持批量获取用户绑定的UID
* 支持批量获取用户订阅的Topic
## 安装
```bash
dotnet add package LINGYUN.Abp.Identity.WxPusher
```
## 模块引用 ## 模块引用
```csharp ```csharp
[DependsOn(typeof(AbpIdentityWxPusherModule))] [DependsOn(typeof(AbpIdentityWxPusherModule))]
public class YouProjectModule : AbpModule public class YouProjectModule : AbpModule
{ {
// other // other
} }
``` ```
## 使用方式
该模块实现了 `IWxPusherUserStore` 接口,通过用户Claims存储WxPusher相关信息:
* `AbpWxPusherClaimTypes.Uid`: 存储用户绑定的WxPusher UID
* `AbpWxPusherClaimTypes.Topic`: 存储用户订阅的Topic ID
### 获取用户绑定的UID
```csharp
public class YourService
{
private readonly IWxPusherUserStore _wxPusherUserStore;
public YourService(IWxPusherUserStore wxPusherUserStore)
{
_wxPusherUserStore = wxPusherUserStore;
}
public async Task DoSomethingAsync(IEnumerable<Guid> userIds)
{
var uids = await _wxPusherUserStore.GetBindUidsAsync(userIds);
// 使用获取到的uids进行消息推送等操作
}
}
```
### 获取用户订阅的Topic
```csharp
public class YourService
{
private readonly IWxPusherUserStore _wxPusherUserStore;
public YourService(IWxPusherUserStore wxPusherUserStore)
{
_wxPusherUserStore = wxPusherUserStore;
}
public async Task DoSomethingAsync(IEnumerable<Guid> userIds)
{
var topics = await _wxPusherUserStore.GetSubscribeTopicsAsync(userIds);
// 使用获取到的topics进行消息推送等操作
}
}
```
## 源码位置
[LINGYUN.Abp.Identity.WxPusher](https://github.com/colinin/abp-next-admin/tree/master/aspnet-core/framework/wx-pusher/LINGYUN.Abp.Identity.WxPusher)

98
aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher.SettingManagement/README.EN.md

@ -0,0 +1,98 @@
# LINGYUN.Abp.WxPusher.SettingManagement
WxPusher setting management module, providing management functionality for WxPusher-related settings.
[简体中文](./README.md)
## Features
* WxPusher settings management
* AppToken management
* Security settings management
* Permission control
* Based on ABP permission system
* Fine-grained settings management permissions
* Multi-tenant support
* Global settings support
* Tenant-level settings support
* Localization support
* Multi-language interface
* Localized setting descriptions
## Installation
```bash
dotnet add package LINGYUN.Abp.WxPusher.SettingManagement
```
## Module Reference
```csharp
[DependsOn(typeof(AbpWxPusherSettingManagementModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
## Permission Configuration
### 1. Permission Definitions
* `WxPusher`: WxPusher permission group
* `WxPusher.ManageSetting`: Permission to manage WxPusher settings
### 2. Authorization Configuration
```csharp
public class YourAuthorizationProvider : AuthorizationProvider
{
public override void Define(IAuthorizationDefinitionContext context)
{
var wxPusher = context.GetPermissionOrNull(WxPusherSettingPermissionNames.GroupName)
?? context.AddGroup(WxPusherSettingPermissionNames.GroupName);
wxPusher.AddPermission(WxPusherSettingPermissionNames.ManageSetting);
}
}
```
## Usage
### 1. Getting Settings
```csharp
public class YourService
{
private readonly IWxPusherSettingAppService _wxPusherSettingAppService;
public YourService(IWxPusherSettingAppService wxPusherSettingAppService)
{
_wxPusherSettingAppService = wxPusherSettingAppService;
}
public async Task GetSettingsAsync()
{
// Get global settings
var globalSettings = await _wxPusherSettingAppService.GetAllForGlobalAsync();
// Get current tenant settings
var tenantSettings = await _wxPusherSettingAppService.GetAllForCurrentTenantAsync();
}
}
```
### 2. API Endpoints
* `GET /api/setting-management/wxpusher/by-global`: Get global settings
* `GET /api/setting-management/wxpusher/by-current-tenant`: Get current tenant settings
## Important Notes
1. Proper permission configuration is required to manage settings.
2. Sensitive information like AppToken needs to be properly secured.
3. Pay attention to the scope of settings in multi-tenant environments.
## Source Code
[LINGYUN.Abp.WxPusher.SettingManagement](https://github.com/colinin/abp-next-admin/tree/master/aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher.SettingManagement)

98
aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher.SettingManagement/README.md

@ -0,0 +1,98 @@
# LINGYUN.Abp.WxPusher.SettingManagement
WxPusher设置管理模块,提供WxPusher相关设置的管理功能。
[English](./README.EN.md)
## 功能特性
* 支持WxPusher设置管理
* AppToken管理
* 安全设置管理
* 权限控制
* 基于ABP权限系统
* 细粒度的设置管理权限
* 多租户支持
* 支持全局设置
* 支持租户级设置
* 本地化支持
* 支持多语言界面
* 支持本地化设置描述
## 安装
```bash
dotnet add package LINGYUN.Abp.WxPusher.SettingManagement
```
## 模块引用
```csharp
[DependsOn(typeof(AbpWxPusherSettingManagementModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
## 权限配置
### 1. 权限定义
* `WxPusher`: WxPusher权限组
* `WxPusher.ManageSetting`: 管理WxPusher设置的权限
### 2. 授权配置
```csharp
public class YourAuthorizationProvider : AuthorizationProvider
{
public override void Define(IAuthorizationDefinitionContext context)
{
var wxPusher = context.GetPermissionOrNull(WxPusherSettingPermissionNames.GroupName)
?? context.AddGroup(WxPusherSettingPermissionNames.GroupName);
wxPusher.AddPermission(WxPusherSettingPermissionNames.ManageSetting);
}
}
```
## 使用方式
### 1. 获取设置
```csharp
public class YourService
{
private readonly IWxPusherSettingAppService _wxPusherSettingAppService;
public YourService(IWxPusherSettingAppService wxPusherSettingAppService)
{
_wxPusherSettingAppService = wxPusherSettingAppService;
}
public async Task GetSettingsAsync()
{
// 获取全局设置
var globalSettings = await _wxPusherSettingAppService.GetAllForGlobalAsync();
// 获取当前租户设置
var tenantSettings = await _wxPusherSettingAppService.GetAllForCurrentTenantAsync();
}
}
```
### 2. API接口
* `GET /api/setting-management/wxpusher/by-global`: 获取全局设置
* `GET /api/setting-management/wxpusher/by-current-tenant`: 获取当前租户设置
## 注意事项
1. 需要正确配置权限才能管理设置。
2. AppToken等敏感信息需要妥善保管。
3. 多租户环境下需要注意设置的作用范围。
## 源码位置
[LINGYUN.Abp.WxPusher.SettingManagement](https://github.com/colinin/abp-next-admin/tree/master/aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher.SettingManagement)

102
aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher/README.EN.md

@ -0,0 +1,102 @@
# LINGYUN.Abp.WxPusher
ABP module integrating WxPusher WeChat push service, implementing WxPusher related API documentation and providing WxPusher capabilities.
[简体中文](./README.md)
For more details, see WxPusher documentation: https://wxpusher.dingliqc.com/docs/#/
## Features
* Integration with WxPusher API
* Support message pushing to users and Topics
* Support multiple message types (Text, HTML, Markdown)
* Support message sending limits and quota management
* Support QR code generation
* Support user subscription management
## Installation
```bash
dotnet add package LINGYUN.Abp.WxPusher
```
## Module Reference
```csharp
[DependsOn(typeof(AbpWxPusherModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
## Configuration
### Settings Configuration
* `WxPusher.Security.AppToken`: Application identity token. With APP_TOKEN, you can send messages to users of the corresponding application. Please keep it strictly confidential.
### Features Configuration
* `WxPusher`: WxPusher feature group
* `WxPusher.Enable`: Globally enable WxPusher
* `WxPusher.Message.Enable`: Globally enable WxPusher message channel
* `WxPusher.Message`: WxPusher message push
* `WxPusher.Message.SendLimit`: WxPusher message push limit count
* `WxPusher.Message.SendLimitInterval`: WxPusher message push limit interval (days)
## Usage
### Sending Messages
```csharp
public class YourService
{
private readonly IWxPusherMessageSender _messageSender;
public YourService(IWxPusherMessageSender messageSender)
{
_messageSender = messageSender;
}
public async Task SendMessageAsync()
{
await _messageSender.SendAsync(
content: "Hello, WxPusher!",
summary: "Message Summary",
contentType: MessageContentType.Text,
topicIds: new List<int> { 1, 2 }, // Optional: Send to specific Topics
uids: new List<string> { "UID1", "UID2" }, // Optional: Send to specific users
url: "https://example.com" // Optional: URL to jump to when clicking the message
);
}
}
```
### User Subscription
Implement the `IWxPusherUserStore` interface to manage user subscriptions:
```csharp
public class YourWxPusherUserStore : IWxPusherUserStore
{
public async Task<List<string>> GetBindUidsAsync(
IEnumerable<Guid> userIds,
CancellationToken cancellationToken = default)
{
// Implement logic to get WxPusher UIDs bound to users
}
public async Task<List<int>> GetSubscribeTopicsAsync(
IEnumerable<Guid> userIds,
CancellationToken cancellationToken = default)
{
// Implement logic to get Topic list subscribed by users
}
}
```
## Source Code
[LINGYUN.Abp.WxPusher](https://github.com/colinin/abp-next-admin/tree/master/aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher)

97
aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher/README.md

@ -1,35 +1,102 @@
# LINGYUN.Abp.WxPusher # LINGYUN.Abp.WxPusher
集成WxPusher 集成WxPusher微信推送服务的ABP模块,实现WxPusher相关Api文档,拥有WxPusher开放能力。
实现WxPusher相关Api文档,拥有WxPusher开放能力 [English](./README.EN.md)
详情见WxPusher文档: https://wxpusher.dingliqc.com/docs/#/ 详情见WxPusher文档: https://wxpusher.dingliqc.com/docs/#/
## 功能特性
* 集成WxPusher API
* 支持消息推送到用户和Topic
* 支持多种消息类型(文本、HTML、Markdown)
* 支持消息发送限制和配额管理
* 支持二维码生成
* 支持用户订阅管理
## 安装
```bash
dotnet add package LINGYUN.Abp.WxPusher
```
## 模块引用 ## 模块引用
```csharp ```csharp
[DependsOn(typeof(AbpWxPusherModule))] [DependsOn(typeof(AbpWxPusherModule))]
public class YouProjectModule : AbpModule public class YouProjectModule : AbpModule
{ {
// other // other
} }
``` ```
## 用户订阅 ## 配置
### Settings配置
实现 [IWxPusherUserStore](./LINGYUN/Abp/WxPusher/User/IWxPusherUserStore) 接口获取用户订阅列表 * `WxPusher.Security.AppToken`: 应用的身份标志,拥有APP_TOKEN后可以给对应的应用的用户发送消息,请严格保密。
## Features ### Features功能
* `WxPusher`: WxPusher特性分组
* `WxPusher.Enable`: 全局启用WxPusher
* `WxPusher.Message.Enable`: 全局启用WxPusher消息通道
* `WxPusher.Message`: WxPusher消息推送
* `WxPusher.Message.SendLimit`: WxPusher消息推送限制次数
* `WxPusher.Message.SendLimitInterval`: WxPusher消息推送限制周期(天)
## 使用方式
### 发送消息
```csharp
public class YourService
{
private readonly IWxPusherMessageSender _messageSender;
* WxPusher WxPusher特性分组 public YourService(IWxPusherMessageSender messageSender)
* WxPusher.Enable 全局启用WxPusher {
* WxPusher.Message.Enable 全局启用WxPusher消息通道 _messageSender = messageSender;
* WxPusher.Message WxPusher消息推送 }
* WxPusher.Message.Enable 启用WxPusher消息推送
* WxPusher.Message.SendLimit WxPusher消息推送限制次数 public async Task SendMessageAsync()
* WxPusher.Message.SendLimitInterval WxPusher消息推送限制周期(天) {
await _messageSender.SendAsync(
content: "Hello, WxPusher!",
summary: "消息摘要",
contentType: MessageContentType.Text,
topicIds: new List<int> { 1, 2 }, // 可选:发送到指定Topic
uids: new List<string> { "UID1", "UID2" }, // 可选:发送到指定用户
url: "https://example.com" // 可选:点击消息跳转的URL
);
}
}
```
### 用户订阅
实现 `IWxPusherUserStore` 接口来管理用户订阅:
```csharp
public class YourWxPusherUserStore : IWxPusherUserStore
{
public async Task<List<string>> GetBindUidsAsync(
IEnumerable<Guid> userIds,
CancellationToken cancellationToken = default)
{
// 实现获取用户绑定的WxPusher UID的逻辑
}
public async Task<List<int>> GetSubscribeTopicsAsync(
IEnumerable<Guid> userIds,
CancellationToken cancellationToken = default)
{
// 实现获取用户订阅的Topic列表的逻辑
}
}
```
## Settings ## 源码位置
* WxPusher.Security.AppToken 应用的身份标志,拥有APP_TOKEN,就可以给对应的应用的用户发送消息, 请严格保密. [LINGYUN.Abp.WxPusher](https://github.com/colinin/abp-next-admin/tree/master/aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher)

97
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WxPusher/README.EN.md

@ -0,0 +1,97 @@
# LINGYUN.Abp.Notifications.WxPusher
ABP notification module implemented through WxPusher, providing real-time notification functionality via WxPusher.
[简体中文](./README.md)
## Features
* Support for multiple message types
* Text messages
* HTML messages
* Markdown messages
* Flexible message targeting
* Send to specific users
* Send to specific Topics
* Multi-language support
* Localized message content
* Multi-language titles and descriptions
* Feature toggle control
* Message sending controlled by feature switches
## Installation
```bash
dotnet add package LINGYUN.Abp.Notifications.WxPusher
```
## Module Reference
```csharp
[DependsOn(typeof(AbpNotificationsWxPusherModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
## Configuration
### 1. Notification Definition Configuration
```csharp
public class YourNotificationDefinitionProvider : NotificationDefinitionProvider
{
public override void Define(INotificationDefinitionContext context)
{
var notification = context.Create(
name: "App.Notification.Test",
displayName: L("TestNotification"))
.WithContentType(MessageContentType.Text) // Set message type
.WithTopics(new List<int> { 1, 2 }) // Set message Topics
.WithUrl("https://example.com"); // Set URL to jump to when clicking the message
}
}
```
### 2. Sending Notifications
```csharp
public class YourService
{
private readonly INotificationPublisher _notificationPublisher;
public YourService(INotificationPublisher notificationPublisher)
{
_notificationPublisher = notificationPublisher;
}
public async Task SendNotificationAsync()
{
var notificationData = new NotificationData();
// Set message content
notificationData.TrySetData("title", "Message Title");
notificationData.TrySetData("message", "Message Content");
notificationData.SetUrl("https://example.com"); // Set URL to jump to when clicking the message
await _notificationPublisher.PublishAsync(
"App.Notification.Test", // Notification name
notificationData, // Notification data
userIds: new[] { "userId" }, // Recipient user IDs
tenantIds: new[] { "tenantId" } // Tenant IDs
);
}
}
```
## Important Notes
1. Implementation of `IWxPusherUserStore` interface is required to manage user associations with WxPusher.
2. Message sending depends on WxPusher API, ensure network connectivity is stable.
3. Set message content length reasonably to avoid exceeding WxPusher limits.
4. When using multi-language features, ensure localization resources are properly configured.
## Source Code
[LINGYUN.Abp.Notifications.WxPusher](https://github.com/colinin/abp-next-admin/tree/master/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WxPusher)

88
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WxPusher/README.md

@ -1,8 +1,29 @@
# LINGYUN.Abp.Notifications.WxPusher # LINGYUN.Abp.Notifications.WxPusher
知模块的WxPusher实现 过WxPusher实现的ABP通知模块,提供通过WxPusher发送实时通知的功能。
使应用可通过WxPusher发布实时通知 [English](./README.EN.md)
## 功能特性
* 支持多种消息类型
* 文本消息
* HTML消息
* Markdown消息
* 灵活的消息发送目标
* 支持发送到指定用户
* 支持发送到指定Topic
* 多语言支持
* 支持本地化消息内容
* 支持多语言标题和描述
* 特性开关控制
* 支持通过功能开关控制消息发送
## 安装
```bash
dotnet add package LINGYUN.Abp.Notifications.WxPusher
```
## 模块引用 ## 模块引用
@ -10,6 +31,67 @@
[DependsOn(typeof(AbpNotificationsWxPusherModule))] [DependsOn(typeof(AbpNotificationsWxPusherModule))]
public class YouProjectModule : AbpModule public class YouProjectModule : AbpModule
{ {
// other // other
} }
``` ```
## 配置说明
### 1. 通知定义配置
```csharp
public class YourNotificationDefinitionProvider : NotificationDefinitionProvider
{
public override void Define(INotificationDefinitionContext context)
{
var notification = context.Create(
name: "App.Notification.Test",
displayName: L("TestNotification"))
.WithContentType(MessageContentType.Text) // 设置消息类型
.WithTopics(new List<int> { 1, 2 }) // 设置消息Topic
.WithUrl("https://example.com"); // 设置点击消息跳转的URL
}
}
```
### 2. 发送通知
```csharp
public class YourService
{
private readonly INotificationPublisher _notificationPublisher;
public YourService(INotificationPublisher notificationPublisher)
{
_notificationPublisher = notificationPublisher;
}
public async Task SendNotificationAsync()
{
var notificationData = new NotificationData();
// 设置消息内容
notificationData.TrySetData("title", "消息标题");
notificationData.TrySetData("message", "消息内容");
notificationData.SetUrl("https://example.com"); // 设置点击消息跳转的URL
await _notificationPublisher.PublishAsync(
"App.Notification.Test", // 通知名称
notificationData, // 通知数据
userIds: new[] { "userId" }, // 接收用户ID列表
tenantIds: new[] { "tenantId" } // 租户ID列表
);
}
}
```
## 注意事项
1. 需要实现 `IWxPusherUserStore` 接口来管理用户与WxPusher的关联关系。
2. 消息发送依赖于WxPusher API,需要确保网络连接正常。
3. 请合理设置消息内容长度,避免超过WxPusher的限制。
4. 使用多语言功能时,需要确保已正确配置本地化资源。
## 源码位置
[LINGYUN.Abp.Notifications.WxPusher](https://github.com/colinin/abp-next-admin/tree/master/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WxPusher)

Loading…
Cancel
Save