8 changed files with 708 additions and 19 deletions
@ -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) |
|||
@ -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) |
|||
@ -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) |
|||
@ -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) |
|||
@ -1,35 +1,102 @@ |
|||
# LINGYUN.Abp.WxPusher |
|||
|
|||
集成WxPusher |
|||
集成WxPusher微信推送服务的ABP模块,实现WxPusher相关Api文档,拥有WxPusher开放能力。 |
|||
|
|||
实现WxPusher相关Api文档,拥有WxPusher开放能力 |
|||
[English](./README.EN.md) |
|||
|
|||
详情见WxPusher文档: https://wxpusher.dingliqc.com/docs/#/ |
|||
|
|||
## 功能特性 |
|||
|
|||
* 集成WxPusher API |
|||
* 支持消息推送到用户和Topic |
|||
* 支持多种消息类型(文本、HTML、Markdown) |
|||
* 支持消息发送限制和配额管理 |
|||
* 支持二维码生成 |
|||
* 支持用户订阅管理 |
|||
|
|||
## 安装 |
|||
|
|||
```bash |
|||
dotnet add package LINGYUN.Abp.WxPusher |
|||
``` |
|||
|
|||
## 模块引用 |
|||
|
|||
```csharp |
|||
[DependsOn(typeof(AbpWxPusherModule))] |
|||
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特性分组 |
|||
* WxPusher.Enable 全局启用WxPusher |
|||
* WxPusher.Message.Enable 全局启用WxPusher消息通道 |
|||
* WxPusher.Message WxPusher消息推送 |
|||
* WxPusher.Message.Enable 启用WxPusher消息推送 |
|||
* WxPusher.Message.SendLimit WxPusher消息推送限制次数 |
|||
* WxPusher.Message.SendLimitInterval WxPusher消息推送限制周期(天) |
|||
public YourService(IWxPusherMessageSender messageSender) |
|||
{ |
|||
_messageSender = messageSender; |
|||
} |
|||
|
|||
public async Task SendMessageAsync() |
|||
{ |
|||
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) |
|||
|
|||
@ -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) |
|||
Loading…
Reference in new issue