feat: 添加消息卡片更新功能,支持或签/单人审批场景
新增功能: 1. 创建 feishu_message 表,存储消息与审批订单/节点/用户的映射关系 2. 发送审批通知时保存 message_id 3. 审批完成后自动更新其他审批人的消息卡片 使用场景: - 或签(or_approve):一人通过后,更新其他审批人的消息卡片 - 单人审批(approver):一人通过后,更新其他审批人的消息卡片 - 拒绝(reject):拒绝后更新所有其他审批人的消息卡片 技术细节: - FeishuMessage 模型:管理消息映射 - FeishuNotificationService::updateMessageCards():更新消息卡片 - ApprovalService:审批完成后调用消息更新逻辑 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use support\Db;
|
||||
|
||||
return new class
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Db::statement('
|
||||
CREATE TABLE IF NOT EXISTS `feishu_message` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`order_id` bigint unsigned NOT NULL COMMENT \'审批订单ID\',
|
||||
`node_id` bigint unsigned NOT NULL COMMENT \'审批节点ID\',
|
||||
`user_id` bigint unsigned NOT NULL COMMENT \'审批人ID\',
|
||||
`message_id` varchar(64) NOT NULL COMMENT \'飞书消息ID\',
|
||||
`msg_token` varchar(128) DEFAULT NULL COMMENT \'消息Token(用于更新卡片)\',
|
||||
`status` varchar(20) NOT NULL DEFAULT \'active\' COMMENT \'active: 有效, updated: 已更新, deleted: 已删除\',
|
||||
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_order_node_user` (`order_id`, `node_id`, `user_id`),
|
||||
KEY `idx_message_id` (`message_id`),
|
||||
KEY `idx_user_id` (`user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT=\'飞书审批消息映射表\'
|
||||
');
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Db::statement('DROP TABLE IF EXISTS `feishu_message`');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user