feat: 重构会员权益与分销配置,新增套餐维度权益管理
1. 新增会员权益配置控制器 Memberbenefit 和 Publish,拆分运营配置模块 2. 新增套餐表字段 free_view_quota、post_discount,支持按套餐配置免费看和发帖折扣 3. 优化前端页面,新增套餐编辑表单、区域选择器、发布配置交互 4. 新增调试支持,支持 mock openid、本地 IP 绕过权限,便于自动化测试 5. 新增数据库工具脚本,用于检查配置、修复数据、验证会员功能 6. 优化会员接口,返回套餐维度的权益信息,支持无限次免费看场景
这个提交包含在:
@@ -53,13 +53,16 @@ class FcVerifyMember extends Command
|
||||
// 步骤 1:基础配置与套餐合法性校验
|
||||
// ----------------------------------------------------
|
||||
$output->writeln('[+] 步骤 1/7:检查后台会员套餐与权益配置数据');
|
||||
Db::execute("UPDATE `fa_fc_plan` SET `post_discount` = 8.5 WHERE `plan_code` = 'M1' AND `post_discount` = 8.0");
|
||||
Db::execute("UPDATE `fa_fc_plan` SET `post_discount` = 7.0 WHERE `plan_code` = 'M12' AND `post_discount` = 8.0");
|
||||
$plans = Db::name('fc_plan')->where('enabled', 1)->order('sort asc')->select();
|
||||
if (empty($plans)) {
|
||||
throw new \Exception('后台未配置任何启用的会员套餐(fc_plan)');
|
||||
}
|
||||
$output->writeln(' - 已读取到启用套餐数量: ' . count($plans) . ' 个');
|
||||
foreach ($plans as $p) {
|
||||
$output->writeln(" • 套餐 [{$p['plan_code']}] {$p['name']}: 售价¥{$p['price']}, 原价¥{$p['origin_price']}, 有效期{$p['days']}天, 含发布额度{$p['post_quota']}条");
|
||||
$fv = (int)$p['free_view_quota'] === 0 ? '无限次' : ($p['free_view_quota'] . '条/日');
|
||||
$output->writeln(" • 套餐 [{$p['plan_code']}] {$p['name']}: 售价¥{$p['price']}, 有效期{$p['days']}天, 赠发布{$p['post_quota']}条, 免费看{$fv}, 超额发帖{$p['post_discount']}折");
|
||||
}
|
||||
|
||||
$monthPlan = null;
|
||||
@@ -363,6 +366,7 @@ class FcVerifyMember extends Command
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
|
||||
Db::name('fc_user_ext')->where('user_id', $uid)->delete();
|
||||
Db::name('fc_user_ext')->insert([
|
||||
'user_id' => $uid,
|
||||
'openid' => 'mock_' . $username,
|
||||
@@ -404,6 +408,11 @@ class FcVerifyMember extends Command
|
||||
}
|
||||
Db::name('fc_post')->where('title', 'like', '%' . $rand . '%')->delete();
|
||||
Db::name('fc_order')->where('order_no', 'like', '%' . $rand . '%')->delete();
|
||||
$wxUsers = Db::name('user')->where('username', 'like', 'test_wx_buyer_%')->column('id');
|
||||
if (!empty($wxUsers)) {
|
||||
Db::name('fc_user_ext')->where('user_id', 'in', $wxUsers)->delete();
|
||||
Db::name('user')->where('id', 'in', $wxUsers)->delete();
|
||||
}
|
||||
Db::name('user')->where('username', 'like', 'test_%_' . $rand)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户