From 0116e61fb5d8c375cdb460c23187a98a3846979d Mon Sep 17 00:00:00 2001 From: zhx Date: Tue, 21 Jul 2026 11:03:30 +0800 Subject: [PATCH] fix(admin): restore migration 088 checksum --- .../088_fami_guild_revenue_policy.sql | 36 +++++-------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/server/admin/migrations/088_fami_guild_revenue_policy.sql b/server/admin/migrations/088_fami_guild_revenue_policy.sql index 72ae19a8..8937fe65 100644 --- a/server/admin/migrations/088_fami_guild_revenue_policy.sql +++ b/server/admin/migrations/088_fami_guild_revenue_policy.sql @@ -2,50 +2,30 @@ SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci; SET @now_ms = CAST(UNIX_TIMESTAMP(UTC_TIMESTAMP(3)) * 1000 AS UNSIGNED); --- 收益策略模板是 Lalu/Huwaa/Fami 共用的产品配置入口。默认文档放在 merge 左侧,既能创建 agency 对象, --- 又不会覆盖已存在的配置;旧实例重发仍保持 0 分成和 charge_amount 守恒口径。 +-- 收益策略模板是 Lalu/Huwaa/Fami 共用的产品配置入口。存量模板显式补 0,避免旧实例重发时产生新分成。 UPDATE admin_policy_templates -SET rule_json = JSON_MERGE_PATCH( - CAST('{"agency":{"point_ratio_percent":0,"share_base":"charge_amount"}}' AS JSON), - rule_json - ), +SET rule_json = JSON_SET(rule_json, '$.agency.point_ratio_percent', 0), updated_at_ms = @now_ms WHERE template_code = 'first_google70000_coin_seller_92000_100000_v1' AND template_version = 'v1' - AND (JSON_EXTRACT(rule_json, '$.agency.point_ratio_percent') IS NULL - OR JSON_EXTRACT(rule_json, '$.agency.share_base') IS NULL); + AND JSON_EXTRACT(rule_json, '$.agency.point_ratio_percent') IS NULL; UPDATE admin_policy_template_versions -SET rule_json = JSON_MERGE_PATCH( - CAST('{"agency":{"point_ratio_percent":0,"share_base":"charge_amount"}}' AS JSON), - rule_json - ), +SET rule_json = JSON_SET(rule_json, '$.agency.point_ratio_percent', 0), updated_at_ms = @now_ms WHERE template_code = 'first_google70000_coin_seller_92000_100000_v1' AND template_version = 'v1' - AND (JSON_EXTRACT(rule_json, '$.agency.point_ratio_percent') IS NULL - OR JSON_EXTRACT(rule_json, '$.agency.share_base') IS NULL); + AND JSON_EXTRACT(rule_json, '$.agency.point_ratio_percent') IS NULL; --- Fami 的礼物类型先决定主播实际 POINT 收益,再由平台按该收益额外给 Agency owner 20%。内层 JSON_SET --- 先确保 host/agency 父对象存在,外层再写嵌套字段,避免 MySQL 对不存在父路径静默忽略,同时保留其他规则。 +-- Fami 从同一份公共政策结构派生独立模板,默认 20%;运营可在 Admin 编辑并发布,不需要改代码。 INSERT INTO admin_policy_templates ( template_code, template_version, name, status, rule_json, description, created_by_admin_id, updated_by_admin_id, created_at_ms, updated_at_ms ) SELECT 'fami_guild_revenue_policy', 'v1', 'Fami 公会收益政策', 'active', - JSON_SET( - JSON_SET( - rule_json, - '$.host', COALESCE(JSON_EXTRACT(rule_json, '$.host'), JSON_OBJECT()), - '$.agency', COALESCE(JSON_EXTRACT(rule_json, '$.agency'), JSON_OBJECT()) - ), - '$.host.point_ratio_percent', 100, - '$.host.use_gift_type_ratio', JSON_EXTRACT('true', '$'), - '$.agency.point_ratio_percent', 20, - '$.agency.share_base', 'host_income' - ), - 'Fami 主播 POINT 收益政策;Agency 按主播实际 POINT 收益由平台额外发放 20%,以发布后的运行快照为准。', + JSON_SET(rule_json, '$.agency.point_ratio_percent', 20), + 'Fami 主播与 Agency POINT 收益政策;Agency 默认 20%,以发布后的运行快照为准。', 0, 0, @now_ms, @now_ms FROM admin_policy_templates WHERE template_code = 'first_google70000_coin_seller_92000_100000_v1' AND template_version = 'v1'