-- 套餐示例数据(表 biz_plans,模型 biz_plan / api/model/biz_plan.js) -- 执行库须与项目 NODE_ENV 对应库一致;若表无 allowed_apis / api_call_quota 请先执行 alter_plan_api_permission.sql -- plan_code 唯一:重复执行会主键/唯一冲突,可先 DELETE WHERE plan_code IN (...) 或改用下面「按编码更新」段落 SET NAMES utf8mb4; -- ========== 1)插入三条示例套餐 ========== INSERT INTO `biz_plans` ( `plan_code`, `plan_name`, `monthly_price`, `auth_fee`, `account_limit`, `active_user_limit`, `msg_quota`, `mass_quota`, `friend_quota`, `sns_quota`, `enabled_features`, `allowed_apis`, `api_call_quota`, `status` ) VALUES ( 'plan_junior', '初级版', 299.00, 0.00, 3, 50, 3000, 100, 200, 100, JSON_ARRAY('登录', '好友', '消息', '管理'), JSON_ARRAY('/login/GetLoginStatus', '/login/DeviceLogin', '/message/SendText', '/friend/GetContactList'), 50000, 'active' ), ( 'plan_senior', '高级版', 899.00, 0.00, 20, 500, 50000, 2000, 5000, 2000, JSON_ARRAY( '登录', '好友', '消息', '群聊', '朋友圈', '小程序', '管理', '设备', '收藏', '视频号', '标签', '支付', '企业微信', '商店', '其他', 'Ws' ), NULL, 500000, 'active' ), ( 'plan_custom', '定制版', 0.00, 0.00, 9999, 9999, 0, 0, 0, 0, NULL, NULL, 0, 'active' ); -- ========== 2)仅当列已存在时:按 plan_code 幂等覆盖(无则 INSERT 需自行补全列)========== -- 若你已手工删过上面 INSERT,可用下面语句改已有编码的数据: -- UPDATE `biz_plans` SET -- `plan_name` = '初级版', -- `monthly_price` = 299.00, -- `msg_quota` = 3000, -- `api_call_quota` = 50000, -- `allowed_apis` = JSON_ARRAY('/login/GetLoginStatus', '/message/SendText'), -- `status` = 'active' -- WHERE `plan_code` = 'plan_junior'; -- ========== 3)常用维护语句 ========== -- 下架套餐 -- UPDATE `biz_plans` SET `status` = 'inactive' WHERE `plan_code` = 'plan_junior'; -- 某套餐改为「全接口 + 不限次数」(接口层 allowed_apis=null、api_call_quota=0 表示不限制) -- UPDATE `biz_plans` SET `allowed_apis` = NULL, `api_call_quota` = 0 WHERE `plan_code` = 'plan_senior'; -- 清空测试套餐(谨慎:有外键订阅时可能拦截) -- DELETE FROM `biz_plans` WHERE `plan_code` IN ('plan_junior', 'plan_senior', 'plan_custom');