diff --git a/apps/vue/src/views/account/setting/SecureSetting.vue b/apps/vue/src/views/account/setting/SecureSetting.vue index 188ce238b..b0c16d6db 100644 --- a/apps/vue/src/views/account/setting/SecureSetting.vue +++ b/apps/vue/src/views/account/setting/SecureSetting.vue @@ -95,6 +95,7 @@ createMessage.success(L('Successful')); }).finally(() => { item.loading = false; + item.switch!.checked = false; }); break; } diff --git a/apps/vue/src/views/auditing/components/ModalData.ts b/apps/vue/src/views/auditing/components/ModalData.ts index 5102a2acf..e3cd8aed9 100644 --- a/apps/vue/src/views/auditing/components/ModalData.ts +++ b/apps/vue/src/views/auditing/components/ModalData.ts @@ -64,7 +64,7 @@ export function getSearchFormSchemas(): Partial { labelWidth: 100, alwaysShowLines: 3, fieldMapToTime: [ - ['dateRange', ['startTime', 'endTime'], ['YYYY-MM-DDT00:00:00', 'YYYY-MM-DDT00:00:00']], + ['executionTime', ['startTime', 'endTime'], ['YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD HH:mm:ss']], ], schemas: [ { @@ -116,11 +116,12 @@ export function getSearchFormSchemas(): Partial { colProps: { span: 12 }, }, { - field: 'dateRange', + field: 'executionTime', component: 'RangePicker', - label: L('StartTime'), - colProps: { span: 6 }, + label: L('ExecutionTime'), + colProps: { span: 8 }, componentProps: { + showTime: true, style: { width: '100%' }, @@ -130,7 +131,7 @@ export function getSearchFormSchemas(): Partial { field: 'correlationId', component: 'Input', label: L('CorrelationId'), - colProps: { span: 12 }, + colProps: { span: 10 }, }, { field: 'hasException', diff --git a/apps/vue/src/views/sys/logging/datas/ModalData.ts b/apps/vue/src/views/sys/logging/datas/ModalData.ts index 20b5b0208..1fb6ebd26 100644 --- a/apps/vue/src/views/sys/logging/datas/ModalData.ts +++ b/apps/vue/src/views/sys/logging/datas/ModalData.ts @@ -9,7 +9,7 @@ export function getSearchFormSchemas(): Partial { labelWidth: 100, alwaysShowLines: 3, fieldMapToTime: [ - ['dateRange', ['startTime', 'endTime'], ['YYYY-MM-DDT00:00:00', 'YYYY-MM-DDT00:00:00']], + ['timeStamp', ['startTime', 'endTime'], ['YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD HH:mm:ss']], ], schemas: [ { @@ -51,11 +51,12 @@ export function getSearchFormSchemas(): Partial { }, }, { - field: 'dateRange', + field: 'timeStamp', component: 'RangePicker', - label: L('StartTime'), - colProps: { span: 6 }, + label: L('TimeStamp'), + colProps: { span: 8 }, componentProps: { + showTime: true, style: { width: '100%', }, @@ -71,7 +72,7 @@ export function getSearchFormSchemas(): Partial { field: 'requestPath', component: 'Input', label: L('RequestPath'), - colProps: { span: 12 }, + colProps: { span: 10 }, }, { field: 'hasException', diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Common/LINGYUN/Abp/WeChat/Common/Messages/MessageResolver.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Common/LINGYUN/Abp/WeChat/Common/Messages/MessageResolver.cs index 2cbdc49c6..145b4efca 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Common/LINGYUN/Abp/WeChat/Common/Messages/MessageResolver.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Common/LINGYUN/Abp/WeChat/Common/Messages/MessageResolver.cs @@ -3,6 +3,7 @@ using LINGYUN.Abp.WeChat.Common.Crypto.Models; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using System; +using System.Linq; using System.Threading.Tasks; using System.Xml.Linq; using Volo.Abp.DependencyInjection; @@ -45,8 +46,7 @@ public class MessageResolver : IMessageResolver, ITransientDependency */ var xmlDocument = XDocument.Parse(messageData.Data); - var encryptData = xmlDocument.Root.Element("Encrypt")?.Value; - if (!encryptData.IsNullOrWhiteSpace()) + if (!xmlDocument.Elements("Encrypt").Any()) { /* 加密数据格式 * @@ -55,7 +55,7 @@ public class MessageResolver : IMessageResolver, ITransientDependency */ var cryptoDecryptData = new WeChatCryptoDecryptData( - encryptData, + messageData.Data, messageData.AppId, messageData.Token, messageData.EncodingAESKey, diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official.Application.Contracts/LINGYUN/Abp/WeChat/Official/Message/Dto/MessageHandleInput.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official.Application.Contracts/LINGYUN/Abp/WeChat/Official/Message/Dto/MessageHandleInput.cs index 317005143..dd36e61f2 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official.Application.Contracts/LINGYUN/Abp/WeChat/Official/Message/Dto/MessageHandleInput.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official.Application.Contracts/LINGYUN/Abp/WeChat/Official/Message/Dto/MessageHandleInput.cs @@ -1,10 +1,12 @@ using LINGYUN.Abp.WeChat.Official.Models; using System; +using Volo.Abp.Auditing; namespace LINGYUN.Abp.WeChat.Official.Message; [Serializable] public class MessageHandleInput : WeChatMessage { + [DisableAuditing] public string Data { get; set; } } diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/AbpWeChatOfficialModule.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/AbpWeChatOfficialModule.cs index 66a074f75..9ad334465 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/AbpWeChatOfficialModule.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/AbpWeChatOfficialModule.cs @@ -52,15 +52,6 @@ namespace LINGYUN.Abp.WeChat.Official options.MessageResolvers.AddIfNotContains(new WeChatOfficialMessageResolveContributor()); }); - Configure(options => - { - // 回复文本消息 - options.MapMessage(); - - // 处理关注事件 - options.MapEvent(); - }); - Configure(options => { options.FileSets.AddEmbedded(); diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialEventResolveContributor.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialEventResolveContributor.cs index d6052e7c3..9db7070ca 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialEventResolveContributor.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialEventResolveContributor.cs @@ -8,11 +8,11 @@ namespace LINGYUN.Abp.WeChat.Official.Messages; /// /// 微信公众号事件处理器 /// -public class WeChatOfficialEventResolveContributor : MessageResolveContributorBase +public class WeChatOfficialEventResolveContributor : WeChatOfficialMessageResolveContributorBase { public override string Name => "WeChat.Official.Event"; - public override Task ResolveAsync(IMessageResolveContext context) + protected override Task ResolveWeChatMessageAsync(IMessageResolveContext context) { var options = context.ServiceProvider.GetRequiredService>().Value; var messageType = context.GetMessageData("MsgType"); diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialMessageResolveContributor.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialMessageResolveContributor.cs index 8a8408523..5a0b4aa3c 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialMessageResolveContributor.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialMessageResolveContributor.cs @@ -7,11 +7,11 @@ namespace LINGYUN.Abp.WeChat.Official.Messages; /// /// 微信公众号消息处理器 /// -public class WeChatOfficialMessageResolveContributor : MessageResolveContributorBase +public class WeChatOfficialMessageResolveContributor : WeChatOfficialMessageResolveContributorBase { public override string Name => "WeChat.Official.Message"; - public override Task ResolveAsync(IMessageResolveContext context) + protected override Task ResolveWeChatMessageAsync(IMessageResolveContext context) { var options = context.ServiceProvider.GetRequiredService>().Value; var messageType = context.GetMessageData("MsgType"); diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialMessageResolveContributorBase.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialMessageResolveContributorBase.cs new file mode 100644 index 000000000..cf82e7a8e --- /dev/null +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/WeChatOfficialMessageResolveContributorBase.cs @@ -0,0 +1,18 @@ +using LINGYUN.Abp.WeChat.Common.Messages; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.WeChat.Official.Messages; +public abstract class WeChatOfficialMessageResolveContributorBase : MessageResolveContributorBase +{ + public override Task ResolveAsync(IMessageResolveContext context) + { + if (!context.HasMessageKey("AgentID")) + { + return ResolveWeChatMessageAsync(context); + } + + return Task.CompletedTask; + } + + protected abstract Task ResolveWeChatMessageAsync(IMessageResolveContext context); +} diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Application.Contracts/LINGYUN/Abp/WeChat/Work/Message/Dto/MessageHandleInput.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Application.Contracts/LINGYUN/Abp/WeChat/Work/Message/Dto/MessageHandleInput.cs index 7898cfccf..ee16fa81b 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Application.Contracts/LINGYUN/Abp/WeChat/Work/Message/Dto/MessageHandleInput.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Application.Contracts/LINGYUN/Abp/WeChat/Work/Message/Dto/MessageHandleInput.cs @@ -1,10 +1,12 @@ using LINGYUN.Abp.WeChat.Work.Models; using System; +using Volo.Abp.Auditing; namespace LINGYUN.Abp.WeChat.Work.Message; [Serializable] public class MessageHandleInput : WeChatWorkMessage { + [DisableAuditing] public string Data { get; set; } } diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/IdentityErrorCodes.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/IdentityErrorCodes.cs index 31cea94a7..d1241c982 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/IdentityErrorCodes.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/IdentityErrorCodes.cs @@ -26,5 +26,9 @@ /// 重复确认的邮件地址 /// public const string DuplicateConfirmEmailAddress = "Volo.Abp.Identity:020010"; + /// + /// 尝试在未绑定MFA设备时启用二次认证 + /// + public const string ChangeTwoFactorWithMFANotBound = "Volo.Abp.Identity:020011"; } } diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/en.json b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/en.json index 610572181..ce2a4f983 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/en.json +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/en.json @@ -47,6 +47,7 @@ "Volo.Abp.Identity:020008": "You can't modify your phone's binding information!", "Volo.Abp.Identity:020009": "You cannot modify your email binding information!", "Volo.Abp.Identity:020010": "The email address is bound!", + "Volo.Abp.Identity:020011": "Secondary authentication cannot be enabled when an MFA device is not attached!", "Volo.Abp.Identity:DuplicatePhoneNumber": "Phone number '{0}' is already taken.", "DisplayName:Abp.Identity.User.SmsNewUserRegister": "Register sms template", "Description:Abp.Identity.User.SmsNewUserRegister": "When the user registers, he/she should send the template number of the SMS verification code and fill in the template number of the corresponding cloud platform registration", diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/zh-Hans.json b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/zh-Hans.json index c4e922f93..053410e93 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/zh-Hans.json +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/zh-Hans.json @@ -47,6 +47,7 @@ "Volo.Abp.Identity:020008": "你不能修改你的手机绑定信息!", "Volo.Abp.Identity:020009": "你不能修改你的邮件绑定信息!", "Volo.Abp.Identity:020010": "邮件地址已绑定!", + "Volo.Abp.Identity:020011": "未绑定MFA设备时无法启用二次认证!", "Volo.Abp.Identity:DuplicatePhoneNumber": "手机号 '{0}' 已存在.", "DisplayName:Abp.Identity.User.SmsNewUserRegister": "新用户注册模板", "Description:Abp.Identity.User.SmsNewUserRegister": "新用户通过手机注册账号验证码模板", diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/IdentityUserManagerExtensions.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/IdentityUserManagerExtensions.cs index 42a79f545..880729a39 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/IdentityUserManagerExtensions.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/IdentityUserManagerExtensions.cs @@ -1,7 +1,7 @@ using JetBrains.Annotations; +using LINGYUN.Abp.Identity; using System.Threading.Tasks; using Volo.Abp; -using Volo.Abp.Identity; namespace Microsoft.AspNetCore.Identity { @@ -27,8 +27,8 @@ namespace Microsoft.AspNetCore.Identity //var error = new IdentityError(); //return IdentityResult.Failed(error); - throw new LINGYUN.Abp.Identity.IdentityException( - IdentityErrorCodes.CanNotChangeTwoFactor, + throw new IdentityException( + IdentityErrorCodes.ChangeTwoFactorWithMFANotBound, details: phoneNumberConfirmed ? "phone number not confirmed" : "email address not confirmed"); } } diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs index d74fd53e9..39b44bbf5 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs @@ -15,8 +15,10 @@ using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.TextTemplating; using LINGYUN.Abp.WebhooksManagement; +using LINGYUN.Abp.WeChat.Common.Messages.Handlers; using LINGYUN.Abp.Wrapper; using LY.MicroService.Applications.Single.IdentityResources; +using LY.MicroService.Applications.Single.WeChat.Official.Messages; using Medallion.Threading; using Medallion.Threading.Redis; using Microsoft.AspNetCore.Authentication.JwtBearer; @@ -764,4 +766,23 @@ public partial class MicroServiceApplicationsSingleModule }); }); } + + private void ConfigureWeChat() + { + Configure(options => + { + // 回复文本消息 + options.MapMessage< + LINGYUN.Abp.WeChat.Official.Messages.Models.TextMessage, + LY.MicroService.Applications.Single.WeChat.Official.Messages.TextMessageReplyContributor>(); + // 处理关注事件 + options.MapEvent< + LINGYUN.Abp.WeChat.Official.Messages.Models.UserSubscribeEvent, + LY.MicroService.Applications.Single.WeChat.Official.Messages.UserSubscribeEventContributor>(); + + options.MapMessage< + LINGYUN.Abp.WeChat.Work.Common.Messages.Models.TextMessage, + LY.MicroService.Applications.Single.WeChat.Work.Messages.TextMessageReplyContributor>(); + }); + } } diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs index 03ee3168a..a96a673be 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs @@ -289,6 +289,7 @@ public partial class MicroServiceApplicationsSingleModule : AbpModule var hostingEnvironment = context.Services.GetHostingEnvironment(); var configuration = context.Services.GetConfiguration(); + ConfigureWeChat(); ConfigureWrapper(); ConfigureAuditing(); ConfigureDbContext(); diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/Handlers/TextMessageReplyContributor.cs b/aspnet-core/services/LY.MicroService.Applications.Single/WeChat/Official/Messages/TextMessageReplyContributor.cs similarity index 72% rename from aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/Handlers/TextMessageReplyContributor.cs rename to aspnet-core/services/LY.MicroService.Applications.Single/WeChat/Official/Messages/TextMessageReplyContributor.cs index 9d3bff545..e5662420f 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/Handlers/TextMessageReplyContributor.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/WeChat/Official/Messages/TextMessageReplyContributor.cs @@ -1,10 +1,8 @@ using LINGYUN.Abp.WeChat.Common.Messages.Handlers; using LINGYUN.Abp.WeChat.Official.Messages.Models; using LINGYUN.Abp.WeChat.Official.Services; -using Microsoft.Extensions.DependencyInjection; -using System.Threading.Tasks; -namespace LINGYUN.Abp.WeChat.Official.Messages.Handlers; +namespace LY.MicroService.Applications.Single.WeChat.Official.Messages; /// /// 文本消息客服回复 /// @@ -15,9 +13,9 @@ public class TextMessageReplyContributor : IMessageHandleContributor(); await messageSender.SendAsync( - new Services.Models.TextMessageModel( + new LINGYUN.Abp.WeChat.Official.Services.Models.TextMessageModel( context.Message.FromUserName, - new Services.Models.TextMessage( + new LINGYUN.Abp.WeChat.Official.Services.Models.TextMessage( context.Message.Content))); } } diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/Handlers/UserSubscribeEventContributor.cs b/aspnet-core/services/LY.MicroService.Applications.Single/WeChat/Official/Messages/UserSubscribeEventContributor.cs similarity index 74% rename from aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/Handlers/UserSubscribeEventContributor.cs rename to aspnet-core/services/LY.MicroService.Applications.Single/WeChat/Official/Messages/UserSubscribeEventContributor.cs index 216a050e8..ba3d93bc2 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Messages/Handlers/UserSubscribeEventContributor.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/WeChat/Official/Messages/UserSubscribeEventContributor.cs @@ -1,10 +1,8 @@ using LINGYUN.Abp.WeChat.Common.Messages.Handlers; using LINGYUN.Abp.WeChat.Official.Messages.Models; using LINGYUN.Abp.WeChat.Official.Services; -using Microsoft.Extensions.DependencyInjection; -using System.Threading.Tasks; -namespace LINGYUN.Abp.WeChat.Official.Messages.Handlers; +namespace LY.MicroService.Applications.Single.WeChat.Official.Messages; /// /// 用户关注回复消息 /// @@ -15,9 +13,9 @@ public class UserSubscribeEventContributor : IEventHandleContributor(); await messageSender.SendAsync( - new Services.Models.TextMessageModel( + new LINGYUN.Abp.WeChat.Official.Services.Models.TextMessageModel( context.Message.FromUserName, - new Services.Models.TextMessage( + new LINGYUN.Abp.WeChat.Official.Services.Models.TextMessage( "感谢您的关注, 点击菜单了解更多."))); } } diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/WeChat/Work/Messages/TextMessageReplyContributor.cs b/aspnet-core/services/LY.MicroService.Applications.Single/WeChat/Work/Messages/TextMessageReplyContributor.cs new file mode 100644 index 000000000..b8e89695e --- /dev/null +++ b/aspnet-core/services/LY.MicroService.Applications.Single/WeChat/Work/Messages/TextMessageReplyContributor.cs @@ -0,0 +1,24 @@ +using LINGYUN.Abp.WeChat.Common.Messages.Handlers; +using LINGYUN.Abp.WeChat.Work.Common.Messages.Models; +using LINGYUN.Abp.WeChat.Work.Messages; + +namespace LY.MicroService.Applications.Single.WeChat.Work.Messages; +/// +/// 文本消息客服回复 +/// +public class TextMessageReplyContributor : IMessageHandleContributor +{ + public async virtual Task HandleAsync(MessageHandleContext context) + { + var messageSender = context.ServiceProvider.GetRequiredService(); + + await messageSender.SendAsync( + new LINGYUN.Abp.WeChat.Work.Messages.Models.WeChatWorkTextMessage( + context.Message.AgentId.ToString(), + new LINGYUN.Abp.WeChat.Work.Messages.Models.TextMessage( + context.Message.Content)) + { + ToUser = context.Message.FromUserName, + }); + } +}