81 changed files with 941 additions and 112 deletions
@ -1,3 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait /> |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,179 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages.Handlers; |
|||
using LINGYUN.Abp.WeChat.Work.Common.Messages.Models; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages.Handlers; |
|||
public class WeChatWorkEventEventHandler : |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<CustomMenuPushEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<MenuClickJumpLinkPushEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<ScanCodePushEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<ScanCodeWaitMsgPushEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<PictureSystemPushEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<PictureAlbumPushEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<PictureWeixinPushEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<UserSubscribeEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<UserUnSubscribeEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<EnterAgentEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<ReportingGeoLocationEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<GeoLocationSelectPushEevent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<BatchJobResultEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<ApprovalStatusChangeEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<ShareAgentChangeEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<ShareChainChangeEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<TemplateCardPushEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<TemplateCardMenuPushEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<CloseInActiveAgentEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<ReOpenInActiveAgentEevent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<CreateUserEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<UpdateUserEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<DeleteUserEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<CreateDepartmentEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<UpdateDepartmentEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<DeleteDepartmentEvent>>, |
|||
IDistributedEventHandler<WeChatWorkEventMessageEto<UserTagChangeEvent>>, |
|||
ITransientDependency |
|||
{ |
|||
private readonly IMessageHandler _messageHandler; |
|||
|
|||
public WeChatWorkEventEventHandler(IMessageHandler messageHandler) |
|||
{ |
|||
_messageHandler = messageHandler; |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<UserSubscribeEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<UserUnSubscribeEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<ReportingGeoLocationEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<CustomMenuPushEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<MenuClickJumpLinkPushEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<ScanCodePushEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<ScanCodeWaitMsgPushEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<PictureSystemPushEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<PictureAlbumPushEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<PictureWeixinPushEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<EnterAgentEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<GeoLocationSelectPushEevent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<BatchJobResultEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<ApprovalStatusChangeEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<ShareAgentChangeEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<ShareChainChangeEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<TemplateCardPushEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<TemplateCardMenuPushEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<CloseInActiveAgentEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<ReOpenInActiveAgentEevent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<CreateUserEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<UpdateUserEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<DeleteUserEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<CreateDepartmentEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<UpdateDepartmentEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<DeleteDepartmentEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkEventMessageEto<UserTagChangeEvent> eventData) |
|||
{ |
|||
await _messageHandler.HandleEventAsync(eventData.Event); |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages.Handlers; |
|||
using LINGYUN.Abp.WeChat.Work.Common.Messages.Models; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages.Handlers; |
|||
public class WeChatWorkMessageEventHandler : |
|||
IDistributedEventHandler<WeChatWorkGeneralMessageEto<TextMessage>>, |
|||
IDistributedEventHandler<WeChatWorkGeneralMessageEto<LinkMessage>>, |
|||
IDistributedEventHandler<WeChatWorkGeneralMessageEto<VoiceMessage>>, |
|||
IDistributedEventHandler<WeChatWorkGeneralMessageEto<VideoMessage>>, |
|||
IDistributedEventHandler<WeChatWorkGeneralMessageEto<PictureMessage>>, |
|||
IDistributedEventHandler<WeChatWorkGeneralMessageEto<GeoLocationMessage>>, |
|||
ITransientDependency |
|||
{ |
|||
private readonly IMessageHandler _messageHandler; |
|||
|
|||
public WeChatWorkMessageEventHandler(IMessageHandler messageHandler) |
|||
{ |
|||
_messageHandler = messageHandler; |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkGeneralMessageEto<TextMessage> eventData) |
|||
{ |
|||
await _messageHandler.HandleMessageAsync(eventData.Message); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkGeneralMessageEto<LinkMessage> eventData) |
|||
{ |
|||
await _messageHandler.HandleMessageAsync(eventData.Message); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkGeneralMessageEto<VoiceMessage> eventData) |
|||
{ |
|||
await _messageHandler.HandleMessageAsync(eventData.Message); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkGeneralMessageEto<VideoMessage> eventData) |
|||
{ |
|||
await _messageHandler.HandleMessageAsync(eventData.Message); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkGeneralMessageEto<PictureMessage> eventData) |
|||
{ |
|||
await _messageHandler.HandleMessageAsync(eventData.Message); |
|||
} |
|||
|
|||
public async virtual Task HandleEventAsync(WeChatWorkGeneralMessageEto<GeoLocationMessage> eventData) |
|||
{ |
|||
await _messageHandler.HandleMessageAsync(eventData.Message); |
|||
} |
|||
} |
|||
@ -0,0 +1,195 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using System.Collections.Generic; |
|||
using System.Xml.Serialization; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages.Models; |
|||
/// <summary>
|
|||
/// 审批状态通知事件
|
|||
/// </summary>
|
|||
[EventName("open_approval_change")] |
|||
public class ApprovalStatusChangeEvent : WeChatWorkEventMessage |
|||
{ |
|||
/// <summary>
|
|||
/// 事件KEY值
|
|||
/// </summary>
|
|||
[XmlElement("EventKey")] |
|||
public string EventKey { get; set; } |
|||
/// <summary>
|
|||
/// 审批信息
|
|||
/// </summary>
|
|||
[XmlElement("ApprovalInfo")] |
|||
public ApprovalInfo ApprovalInfo { get; set; } |
|||
public override WeChatMessageEto ToEto() |
|||
{ |
|||
return new WeChatWorkEventMessageEto<ApprovalStatusChangeEvent>(this); |
|||
} |
|||
} |
|||
|
|||
public class ApprovalInfo |
|||
{ |
|||
/// <summary>
|
|||
/// 审批单编号,由开发者在发起申请时自定义
|
|||
/// </summary>
|
|||
[XmlElement("ThirdNo")] |
|||
public string ThirdNo { get; set; } |
|||
/// <summary>
|
|||
/// 审批模板名称
|
|||
/// </summary>
|
|||
[XmlElement("OpenSpName")] |
|||
public string OpenSpName { get; set; } |
|||
/// <summary>
|
|||
/// 审批模板id
|
|||
/// </summary>
|
|||
[XmlElement("OpenTemplateId")] |
|||
public string OpenTemplateId { get; set; } |
|||
/// <summary>
|
|||
/// 申请单当前审批状态:
|
|||
/// 1-审批中;
|
|||
/// 2-已通过;
|
|||
/// 3-已驳回;
|
|||
/// 4-已取消
|
|||
/// </summary>
|
|||
[XmlElement("OpenSpStatus")] |
|||
public byte OpenSpStatus { get; set; } |
|||
/// <summary>
|
|||
/// 提交申请时间
|
|||
/// </summary>
|
|||
[XmlElement("ApplyTime")] |
|||
public int ApplyTime { get; set; } |
|||
/// <summary>
|
|||
/// 提交者姓名
|
|||
/// </summary>
|
|||
[XmlElement("ApplyUserName")] |
|||
public string ApplyUserName { get; set; } |
|||
/// <summary>
|
|||
/// 提交者userid
|
|||
/// </summary>
|
|||
[XmlElement("ApplyUserId")] |
|||
public string ApplyUserId { get; set; } |
|||
/// <summary>
|
|||
/// 提交者所在部门
|
|||
/// </summary>
|
|||
[XmlElement("ApplyUserParty")] |
|||
public string ApplyUserParty { get; set; } |
|||
/// <summary>
|
|||
/// 提交者头像
|
|||
/// </summary>
|
|||
[XmlElement("ApplyUserImage")] |
|||
public string ApplyUserImage { get; set; } |
|||
/// <summary>
|
|||
/// 审批流程信息
|
|||
/// </summary>
|
|||
[XmlElement("ApprovalNodes")] |
|||
public List<ApprovalNode> ApprovalNodes { get; set; } |
|||
/// <summary>
|
|||
/// 抄送信息,可能有多个抄送人
|
|||
/// </summary>
|
|||
[XmlElement("NotifyNodes")] |
|||
public List<NotifyNode> NotifyNodes { get; set; } |
|||
/// <summary>
|
|||
/// 当前审批节点:0-第一个审批节点;1-第二个审批节点…以此类推
|
|||
/// </summary>
|
|||
[XmlElement("approverstep")] |
|||
public int ApproverStep { get; set; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 审批流程信息,可以有多个审批节点
|
|||
/// </summary>
|
|||
[XmlRoot("ApprovalNode")] |
|||
public class ApprovalNode |
|||
{ |
|||
/// <summary>
|
|||
/// 节点审批操作状态:
|
|||
/// 1-审批中;
|
|||
/// 2-已同意;
|
|||
/// 3-已驳回;
|
|||
/// 4-已转审
|
|||
/// </summary>
|
|||
[XmlElement("NodeStatus")] |
|||
public byte NodeStatus { get; set; } |
|||
/// <summary>
|
|||
/// 审批节点属性:
|
|||
/// 1-或签;
|
|||
/// 2-会签
|
|||
/// </summary>
|
|||
[XmlElement("NodeAttr")] |
|||
public byte NodeAttr { get; set; } |
|||
/// <summary>
|
|||
/// 审批节点类型:
|
|||
/// 1-固定成员;
|
|||
/// 2-标签;
|
|||
/// 3-上级
|
|||
/// </summary>
|
|||
[XmlElement("NodeType")] |
|||
public byte NodeType { get; set; } |
|||
/// <summary>
|
|||
/// 审批节点信息,当节点为标签或上级时,一个节点可能有多个分支
|
|||
/// </summary>
|
|||
[XmlElement("Items")] |
|||
public List<ApprovalNodeItem> Items { get; set; } |
|||
} |
|||
/// <summary>
|
|||
/// 审批节点分支,当节点为标签或上级时,一个节点可能有多个分支
|
|||
/// </summary>
|
|||
[XmlRoot("Item")] |
|||
public class ApprovalNodeItem |
|||
{ |
|||
/// <summary>
|
|||
/// 分支审批人姓名
|
|||
/// </summary>
|
|||
[XmlElement("ItemName")] |
|||
public string ItemName { get; set; } |
|||
/// <summary>
|
|||
/// 分支审批人userid
|
|||
/// </summary>
|
|||
[XmlElement("ItemUserId")] |
|||
public string ItemUserId { get; set; } |
|||
/// <summary>
|
|||
/// 分支审批人头像
|
|||
/// </summary>
|
|||
[XmlElement("ItemImage")] |
|||
public string ItemImage { get; set; } |
|||
/// <summary>
|
|||
/// 分支审批审批操作状态:
|
|||
/// 1-审批中;
|
|||
/// 2-已同意;
|
|||
/// 3-已驳回;
|
|||
/// 4-已转审
|
|||
/// </summary>
|
|||
[XmlElement("ItemStatus")] |
|||
public byte ItemStatus { get; set; } |
|||
/// <summary>
|
|||
/// 分支审批人审批意见
|
|||
/// </summary>
|
|||
[XmlElement("ItemSpeech")] |
|||
public string ItemSpeech { get; set; } |
|||
/// <summary>
|
|||
/// 分支审批人审批意见
|
|||
/// </summary>
|
|||
[XmlElement("ItemOpTime")] |
|||
public int ItemOpTime { get; set; } |
|||
} |
|||
/// <summary>
|
|||
/// 抄送人信息
|
|||
/// </summary>
|
|||
[XmlRoot("NotifyNode")] |
|||
public class NotifyNode |
|||
{ |
|||
/// <summary>
|
|||
/// 抄送人姓名
|
|||
/// </summary>
|
|||
[XmlElement("ItemName")] |
|||
public string ItemName { get; set; } |
|||
/// <summary>
|
|||
/// 抄送人userid
|
|||
/// </summary>
|
|||
[XmlElement("ItemUserId")] |
|||
public string ItemUserId { get; set; } |
|||
/// <summary>
|
|||
/// 抄送人头像
|
|||
/// </summary>
|
|||
[XmlElement("ItemImage")] |
|||
public string ItemImage { get; set; } |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages.Models; |
|||
/// <summary>
|
|||
/// 长期未使用应用临时停用事件
|
|||
/// </summary>
|
|||
[EventName("close_inactive_agent")] |
|||
public class CloseInActiveAgentEvent : WeChatWorkEventMessage |
|||
{ |
|||
public override WeChatMessageEto ToEto() |
|||
{ |
|||
return new WeChatWorkEventMessageEto<CloseInActiveAgentEvent>(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,61 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using System.Xml.Serialization; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages.Models; |
|||
/// <summary>
|
|||
/// 弹出地理位置选择器的事件推送
|
|||
/// </summary>
|
|||
[EventName("location_select")] |
|||
public class GeoLocationSelectPushEevent : WeChatWorkEventMessage |
|||
{ |
|||
/// <summary>
|
|||
/// 事件KEY值
|
|||
/// </summary>
|
|||
[XmlElement("EventKey")] |
|||
public string EventKey { get; set; } |
|||
/// <summary>
|
|||
/// 发送的位置信息
|
|||
/// </summary>
|
|||
[XmlElement("SendLocationInfo")] |
|||
public LocationInfo SendLocationInfo { get; set; } |
|||
/// <summary>
|
|||
/// app类型,在企业微信固定返回wxwork,在微信不返回该字段
|
|||
/// </summary>
|
|||
[XmlElement("AppType")] |
|||
public string AppType { get; set; } |
|||
|
|||
public override WeChatMessageEto ToEto() |
|||
{ |
|||
return new WeChatWorkEventMessageEto<GeoLocationSelectPushEevent>(this); |
|||
} |
|||
} |
|||
|
|||
public class LocationInfo |
|||
{ |
|||
/// <summary>
|
|||
/// 地理位置纬度
|
|||
/// </summary>
|
|||
[XmlElement("Location_X")] |
|||
public double Latitude { get; set; } |
|||
/// <summary>
|
|||
/// 地理位置经度
|
|||
/// </summary>
|
|||
[XmlElement("Location_Y")] |
|||
public double Longitude { get; set; } |
|||
/// <summary>
|
|||
/// 地图缩放大小
|
|||
/// </summary>
|
|||
[XmlElement("Scale")] |
|||
public double Scale { get; set; } |
|||
/// <summary>
|
|||
/// 地理位置信息
|
|||
/// </summary>
|
|||
[XmlElement("Label")] |
|||
public string Label { get; set; } |
|||
/// <summary>
|
|||
/// POI的名字,可能为空
|
|||
/// </summary>
|
|||
[XmlElement("Poiname")] |
|||
public string PoiName { get; set; } |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages.Models; |
|||
/// <summary>
|
|||
/// 长期未使用应用重新启用事件
|
|||
/// </summary>
|
|||
[EventName("reopen_inactive_agent")] |
|||
public class ReOpenInActiveAgentEevent : WeChatWorkEventMessage |
|||
{ |
|||
public override WeChatMessageEto ToEto() |
|||
{ |
|||
return new WeChatWorkEventMessageEto<ReOpenInActiveAgentEevent>(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages.Models; |
|||
/// <summary>
|
|||
/// 企业互联共享应用事件
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 本事件触发时机为:
|
|||
/// 1. 上级企业把自建应用共享给下级企业使用
|
|||
/// 2. 上级企业把下级企业从共享应用中移除
|
|||
/// </remarks>
|
|||
[EventName("share_agent_change")] |
|||
public class ShareAgentChangeEvent : WeChatWorkEventMessage |
|||
{ |
|||
public override WeChatMessageEto ToEto() |
|||
{ |
|||
return new WeChatWorkEventMessageEto<ShareAgentChangeEvent>(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages.Models; |
|||
/// <summary>
|
|||
/// 上下游共享应用事件
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 本事件触发时机为:
|
|||
/// 1. 上游企业把自建应用共享给下游企业使用
|
|||
/// 2. 上游企业把下游企业从共享应用中移除
|
|||
/// </remarks>
|
|||
[EventName("share_chain_change")] |
|||
public class ShareChainChangeEvent : WeChatWorkEventMessage |
|||
{ |
|||
public override WeChatMessageEto ToEto() |
|||
{ |
|||
return new WeChatWorkEventMessageEto<ShareChainChangeEvent>(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using System.Xml.Serialization; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages.Models; |
|||
/// <summary>
|
|||
/// 通用模板卡片右上角菜单事件推送
|
|||
/// </summary>
|
|||
[EventName("template_card_menu_event")] |
|||
public class TemplateCardMenuPushEvent : WeChatWorkEventMessage |
|||
{ |
|||
/// <summary>
|
|||
/// 与发送模板卡片消息时指定的task_id相同
|
|||
/// </summary>
|
|||
[XmlElement("TaskId")] |
|||
public string TaskId { get; set; } |
|||
/// <summary>
|
|||
/// 通用模板卡片的类型,
|
|||
/// 类型有
|
|||
/// "text_notice",
|
|||
/// "news_notice",
|
|||
/// "button_interaction"
|
|||
/// 三种
|
|||
/// </summary>
|
|||
[XmlElement("CardType")] |
|||
public string CardType { get; set; } |
|||
/// <summary>
|
|||
/// 用于调用更新卡片接口的ResponseCode
|
|||
/// </summary>
|
|||
[XmlElement("ResponseCode")] |
|||
public string ResponseCode { get; set; } |
|||
/// <summary>
|
|||
/// 与发送模板卡片右上角菜单的按钮key值相同
|
|||
/// </summary>
|
|||
[XmlElement("EventKey")] |
|||
public string EventKey { get; set; } |
|||
public override WeChatMessageEto ToEto() |
|||
{ |
|||
return new WeChatWorkEventMessageEto<TemplateCardMenuPushEvent>(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,80 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using System.Collections.Generic; |
|||
using System.Xml.Serialization; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages.Models; |
|||
/// <summary>
|
|||
/// 模板卡片事件推送
|
|||
/// </summary>
|
|||
[EventName("template_card_event")] |
|||
public class TemplateCardPushEvent : WeChatWorkEventMessage |
|||
{ |
|||
/// <summary>
|
|||
/// 与发送模板卡片消息时指定的task_id相同
|
|||
/// </summary>
|
|||
[XmlElement("TaskId")] |
|||
public string TaskId { get; set; } |
|||
/// <summary>
|
|||
/// 通用模板卡片的类型,类型有
|
|||
/// "text_notice",
|
|||
/// "news_notice",
|
|||
/// "button_interaction",
|
|||
/// "vote_interaction",
|
|||
/// "multiple_interaction"
|
|||
/// 五种
|
|||
/// </summary>
|
|||
[XmlElement("CardType")] |
|||
public string CardType { get; set; } |
|||
/// <summary>
|
|||
/// 用于调用更新卡片接口的ResponseCode,72小时内有效,且只能使用一次
|
|||
/// </summary>
|
|||
[XmlElement("ResponseCode")] |
|||
public string ResponseCode { get; set; } |
|||
/// <summary>
|
|||
/// 与发送模板卡片消息时指定的按钮btn:key值相同
|
|||
/// </summary>
|
|||
[XmlElement("EventKey")] |
|||
public string EventKey { get; set; } |
|||
/// <summary>
|
|||
/// 事件KEY值
|
|||
/// </summary>
|
|||
[XmlElement("SelectedItems")] |
|||
public TemplateCardQuestionInfo QuestionInfo { get; set; } |
|||
public override WeChatMessageEto ToEto() |
|||
{ |
|||
return new WeChatWorkEventMessageEto<TemplateCardPushEvent>(this); |
|||
} |
|||
} |
|||
|
|||
public class TemplateCardQuestionInfo |
|||
{ |
|||
/// <summary>
|
|||
/// 事件KEY值
|
|||
/// </summary>
|
|||
[XmlElement("SelectedItem")] |
|||
public List<TemplateCardQuestion> Items { get; set; } |
|||
} |
|||
|
|||
public class TemplateCardQuestion |
|||
{ |
|||
/// <summary>
|
|||
/// 问题的key值
|
|||
/// </summary>
|
|||
[XmlElement("QuestionKey")] |
|||
public string QuestionKey { get; set; } |
|||
/// <summary>
|
|||
/// 问题的key值
|
|||
/// </summary>
|
|||
[XmlArray("OptionIds")] |
|||
public List<TemplateCardQuestionOption> OptionIds { get; set; } |
|||
} |
|||
|
|||
public class TemplateCardQuestionOption |
|||
{ |
|||
/// <summary>
|
|||
/// 问题的key值
|
|||
/// </summary>
|
|||
[XmlElement("OpitonId")] |
|||
public List<string> Items { get; set; } |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Options; |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages; |
|||
/// <summary>
|
|||
/// 微信公众号事件处理器
|
|||
/// </summary>
|
|||
public class WeChatWorkEventResolveContributor : WeChatWorkMessageResolveContributorBase |
|||
{ |
|||
public override string Name => "WeChat.Work.Event"; |
|||
|
|||
protected override Task ResolveWeComMessageAsync(IMessageResolveContext context) |
|||
{ |
|||
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpWeChatWorkMessageResolveOptions>>().Value; |
|||
var messageType = context.GetMessageData("MsgType"); |
|||
var eventName = context.GetMessageData("Event"); |
|||
if ("event".Equals(messageType, StringComparison.InvariantCultureIgnoreCase) && |
|||
!eventName.IsNullOrWhiteSpace() && |
|||
options.EventMaps.TryGetValue(eventName, out var eventFactory)) |
|||
{ |
|||
context.Message = eventFactory(context); |
|||
context.Handled = true; |
|||
} |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Options; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages; |
|||
/// <summary>
|
|||
/// 微信公众号消息处理器
|
|||
/// </summary>
|
|||
public class WeChatWorkMessageResolveContributor : WeChatWorkMessageResolveContributorBase |
|||
{ |
|||
public override string Name => "WeChat.Work.Message"; |
|||
|
|||
protected override Task ResolveWeComMessageAsync(IMessageResolveContext context) |
|||
{ |
|||
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpWeChatWorkMessageResolveOptions>>().Value; |
|||
var messageType = context.GetMessageData("MsgType"); |
|||
if (options.MessageMaps.TryGetValue(messageType, out var messageFactory)) |
|||
{ |
|||
context.Message = messageFactory(context); |
|||
context.Handled = true; |
|||
} |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using LINGYUN.Abp.WeChat.Common.Messages; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Common.Messages; |
|||
public abstract class WeChatWorkMessageResolveContributorBase : MessageResolveContributorBase |
|||
{ |
|||
public override Task ResolveAsync(IMessageResolveContext context) |
|||
{ |
|||
// 企业微信消息需要企业标识字段
|
|||
if (context.HasMessageKey("AgentID")) |
|||
{ |
|||
return ResolveWeComMessageAsync(context); |
|||
} |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
protected abstract Task ResolveWeComMessageAsync(IMessageResolveContext context); |
|||
} |
|||
Loading…
Reference in new issue