fix(wechat): defer 45047/45015 delivery and control customer message budget
Memind CI / Test, build, and release guards (push) Failing after 10s

Persist formal replies when WeChat customer-service quota is exhausted,
claim them once on the next passive response, skip progress notices for
page generation, and suppress failure notices while a formal reply is pending.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-02 09:21:43 +08:00
parent db53090ba1
commit 3e8cdfdda3
5 changed files with 508 additions and 103 deletions
+14
View File
@@ -1010,6 +1010,20 @@ CREATE TABLE IF NOT EXISTS h5_wechat_mp_message_details (
CONSTRAINT fk_wechat_mp_message_details_user FOREIGN KEY (user_id) REFERENCES h5_users(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS h5_wechat_mp_deferred_delivery (
app_id VARCHAR(32) NOT NULL,
openid VARCHAR(64) NOT NULL,
priority TINYINT NOT NULL DEFAULT 10,
kind VARCHAR(32) NOT NULL DEFAULT 'text',
content MEDIUMTEXT NOT NULL,
metadata JSON NULL,
source_msg_id VARCHAR(128) NULL,
created_at BIGINT NOT NULL,
updated_at BIGINT NOT NULL,
PRIMARY KEY (app_id, openid),
KEY idx_wechat_deferred_updated (updated_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS h5_schedule_items (
id CHAR(36) PRIMARY KEY,
user_id CHAR(36) NOT NULL,