Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

企业微信中间件增加:会话存档-产生会话回调事件回调 #2993

Merged
merged 4 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*----------------------------------------------------------------
Copyright (C) 2024 Senparc

文件名:RequestMessageEvent_MsgAuditNotify.cs
文件功能描述:企业微信会话存档-产生会话回调事件


创建标识:IcedMango - 20240229

----------------------------------------------------------------*/

namespace Senparc.Weixin.Work.Entities
{
/// <summary>
/// 企业微信会话存档-产生会话回调事件
/// </summary>
public class RequestMessageEvent_MsgAuditNotify : RequestMessageEventBase, IRequestMessageEventBase
{
/// <summary>
/// 事件类型
/// </summary>
public override Event Event => Event.MSGAUDIT_NOTIFY;
}
}
10 changes: 9 additions & 1 deletion src/Senparc.Weixin.Work/Senparc.Weixin.Work/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ GroupTaskSentStatus 枚举

修改标识:XiaoPoTian - 20231119
修改描述:v3.18.1 添加枚举“企业客户标签变更事件”(CHANGE_EXTERNAL_Tag)

修改标识:IcedMango - 20240229
修改描述:添加枚举“企业微信会话存档-产生会话回调事件”(MSGAUDIT_NOTIFY)

----------------------------------------------------------------*/

Expand Down Expand Up @@ -204,8 +207,13 @@ public enum Event
/// 自建应用审批状态变化通知回调
/// <para><see href="https://developer.work.weixin.qq.com/document/path/97175"/></para>
/// </summary>
OPEN_APPROVAL_CHANGE
OPEN_APPROVAL_CHANGE,
#endregion

/// <summary>
/// 会话存档-产生会话回调事件
/// </summary>
MSGAUDIT_NOTIFY
}

public enum TencentGender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

修改标识:XiaoPoTian - 20231119
修改描述:v3.18.1 添加“企业客户标签变更事件回调通知”(CHANGE_EXTERNAL_Tag)

修改标识:IcedMango - 20240229
修改描述:添加: 企业微信会话存档-产生会话回调事件(MSGAUDIT_NOTIFY)
----------------------------------------------------------------*/

using Senparc.NeuChar;
Expand Down Expand Up @@ -227,6 +230,11 @@ public override IWorkRequestMessageBase GetRequestEntityMappingResult(RequestMsg
case "OPEN_APPROVAL_CHANGE":
requestMessage = new RequestMessageEvent_OpenApprovalChange();
break;
// 企业微信会话存档-产生会话回调事件(msgaudit_notify)
// 文档: https://developer.work.weixin.qq.com/document/path/95039
case "MSGAUDIT_NOTIFY":
requestMessage = new RequestMessageEvent_MsgAuditNotify();
break;
default://其他意外类型(也可以选择抛出异常)
requestMessage = new RequestMessageEventBase();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

修改标识:Senparc - 20230914
修改描述:v3.16.4 企业微信三方代开发处理事件: 修复 Async 方法循环调用的 Bug

修改标识:IcedMango - 20240229
修改描述:添加: 企业微信会话存档-产生会话回调事件

----------------------------------------------------------------*/

Expand Down Expand Up @@ -382,6 +385,12 @@ public virtual async Task<IWorkResponseMessageBase> OnEventRequestAsync(IRequest
OnEvent_Open_Approval_Change_Status_ChangeRequestAsync(
RequestMessage as RequestMessageEvent_OpenApprovalChange);
break;

case Event.MSGAUDIT_NOTIFY: //企业微信会话存档-产生会话回调事件
responseMessage = await
OnEvent_MsgAuditNotifyRequestAsync(
RequestMessage as RequestMessageEvent_MsgAuditNotify);
break;
default:
throw new UnknownRequestMsgTypeException("未知的Event下属请求信息", null);
}
Expand Down Expand Up @@ -790,6 +799,16 @@ public virtual async Task<IWorkResponseMessageBase> OnEvent_Open_Approval_Change
}

#endregion

/// <summary>
/// 企业微信会话存档-产生会话回调事件
/// </summary>
/// <param name="requestMessage"></param>
/// <returns></returns>
public virtual async Task<IWorkResponseMessageBase> OnEvent_MsgAuditNotifyRequestAsync(RequestMessageEvent_MsgAuditNotify requestMessage)
{
return await Task.Run(() => OnEvent_MsgAuditNotifyRequest(requestMessage)).ConfigureAwait(false);
}

#endregion //Event 下属分类

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ OnThirdPartyEvent_Contact_Sync 改名为 OnThirdPartyEvent_Change_Contact()

修改标识:XiaoPoTian - 20231119
修改描述:v3.18.1 添加 RequestMessageEvent_Change_External_Tag_Base 事件中 ChangeType 的判断

修改标识:IcedMango - 20240229
修改描述:添加: 企业微信会话存档-产生会话回调事件
----------------------------------------------------------------*/

using System;
Expand Down Expand Up @@ -883,6 +886,16 @@ public virtual IWorkResponseMessageBase OnEvent_Open_Approval_Change_Status_Chan
return DefaultResponseMessage(requestMessage);
}
#endregion

/// <summary>
/// 企业微信会话存档-产生会话回调事件
/// </summary>
/// <param name="requestMessage"></param>
/// <returns></returns>
public virtual IWorkResponseMessageBase OnEvent_MsgAuditNotifyRequest(RequestMessageEvent_MsgAuditNotify requestMessage)
{
return DefaultResponseMessage(requestMessage);
}

#endregion //Event 下属分类
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

修改标识:Senparc - 20231026
修改描述:v3.17.0 成员对外联系 > 客户消息通知处理

修改标识:IcedMango - 20240229
修改描述:添加: 企业微信会话存档-产生会话回调事件(MSGAUDIT_NOTIFY)

----------------------------------------------------------------*/

Expand Down Expand Up @@ -134,6 +137,9 @@ public static IWorkRequestMessageBase GetRequestEntity<TMC>(TMC messageContext,
case "MSG_AUDIT_APPROVED":
requestMessage = new RequestMessageEvent_Change_ExternalContact_MsgAudit();
break;
case "MSGAUDIT_NOTIFY":
requestMessage = new RequestMessageEvent_MsgAuditNotify();
break;
case "CREATE":
requestMessage = new RequestMessageEvent_Change_ExternalContact_Create();
break;
Expand Down