接入微信订阅消息并完善预约通知
自动发布开发环境 Nacos 配置 / publish (push) Successful in 20s

This commit is contained in:
2026-11-02 12:11:23 +08:00
parent 3e439543bc
commit 19ca9e2965
29 changed files with 721 additions and 18 deletions
@@ -0,0 +1,35 @@
SET @column_exists = (
SELECT COUNT(1) FROM information_schema.columns
WHERE table_schema = DATABASE() AND table_name = 't_order' AND column_name = 'cancel_reason'
);
SET @migration_sql = IF(
@column_exists = 0,
'ALTER TABLE t_order ADD COLUMN cancel_reason VARCHAR(255) NULL COMMENT ''预约取消原因'' AFTER customer_remark',
'SELECT 1'
);
PREPARE migration_statement FROM @migration_sql;
EXECUTE migration_statement;
DEALLOCATE PREPARE migration_statement;
CREATE TABLE IF NOT EXISTS t_wechat_subscribe_message_log (
id BIGINT UNSIGNED NOT NULL COMMENT '订阅消息记录ID',
event_key VARCHAR(200) NOT NULL COMMENT '业务事件幂等键',
template_code VARCHAR(100) NOT NULL COMMENT '固定微信模板ID',
user_id BIGINT UNSIGNED NULL COMMENT '美甲师用户ID',
order_id BIGINT UNSIGNED NULL COMMENT '订单ID',
order_item_id BIGINT UNSIGNED NULL COMMENT '订单项ID',
open_id_hash VARCHAR(128) NULL COMMENT '接收OpenID摘要,不保存明文',
status VARCHAR(20) NOT NULL DEFAULT 'PENDING' COMMENT 'PENDING/PROCESSING/RETRY/SENT/FAILED',
retry_count INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '重试次数',
err_code INT NULL COMMENT '微信错误码',
err_msg VARCHAR(500) NULL COMMENT '错误摘要',
next_retry_time DATETIME NULL COMMENT '下次处理时间',
sent_time DATETIME NULL COMMENT '发送成功时间',
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_delete TINYINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (id),
UNIQUE KEY uk_wechat_subscribe_event (event_key),
KEY idx_wechat_subscribe_due (status, next_retry_time, id),
KEY idx_wechat_subscribe_order (order_id, order_item_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='微信小程序订阅消息发送记录';