feat: 完善会员资金明细与退款转账逻辑,新增支付密码组件与资金流水界面

这个提交包含在:
2026-10-24 17:55:36 +08:00
父节点 6b86177b5f
当前提交 b6c53abb84
共有 30 个文件被更改,包括 1222 次插入 和 537 次删除

查看文件

@@ -81,23 +81,27 @@ class FcConfig
'total' => '累计',
]),
self::item('fc_post_singlePrice', '单条价格', 'number', $pick('post.singlePrice', '5'), '未开通套餐时的单条发布价格(元)', 'required;number'),
self::item('fc_post_monthPrice', '月卡价格', 'number', $pick('post.monthPrice', '19.9'), '会员月卡价格(元),保存后同步会员套餐', 'required;number'),
self::item('fc_post_monthQuota', '月卡条数', 'number', $pick('post.monthQuota', '30'), '月卡包含的发布条数', 'required;number'),
self::item('fc_post_yearPrice', '年卡价格', 'number', $pick('post.yearPrice', '168'), '会员年卡价格(元),保存后同步会员套餐', 'required;number'),
self::item('fc_post_yearQuota', '年卡条数', 'number', $pick('post.yearQuota', '500'), '年卡包含的发布条数', 'required;number'),
],
],
'fc_member' => [
'name' => 'fc_member',
'title' => '会员权益配置',
'title' => '会员配置',
'active' => false,
'list' => [
self::item('fc_member_freeView', '每日免费查看条数', 'number', $freeView, '会员每日可免费查看联系方式条数(默认 20 条)', 'required;number'),
self::item('fc_member_postDiscount', '单条发布折扣', 'string', $postDiscount, '付费发布时会员专享折扣,如「8折」或「8.5折」(默认 8 折)', 'required'),
self::item('fc_fee_payView', '非会员查看价格', 'number', $payViewPrice, '非会员单条解锁联系方式费用(元,默认 1 元)', 'required;number'),
self::item('fc_member_payView', '非会员查看价格', 'number', $payViewPrice, '非会员单条解锁联系方式费用(元,默认 1 元)', 'required;number'),
self::item('fc_member_benefits', '会员特权清单', 'text', $benefitsText, '小程序端展示的特权清单,每行一条(支持后台自由增删与修改)'),
],
],
'fc_pay' => [
'name' => 'fc_pay',
'title' => '支付配置',
'active' => false,
'list' => [
self::item('fc_pay_passwordEnabled', '余额支付密码', 'switch', $pick('pay.payPasswordEnabled', '0'), '开启后,用户使用余额支付(会员开通/付费发布/付费查看)时需验证 6 位支付密码;用户在「余额中心」自行设置,默认关闭'),
],
],
'fc_dist' => [
'name' => 'fc_dist',
'title' => '分销配置',
@@ -141,14 +145,29 @@ class FcConfig
if ($has('fc_post_')) {
self::savePublish($row);
}
if ($has('fc_member_') || $has('fc_fee_')) {
if ($has('fc_member_')) {
self::saveMember($row);
}
if ($has('fc_pay_')) {
self::savePay($row);
}
if ($has('fc_dist_')) {
self::saveDistribution($row);
}
}
/**
* 支付配置
*
* @param array $row
* @return void
*/
protected static function savePay(array $row)
{
$enabled = isset($row['fc_pay_passwordEnabled']) ? (int)$row['fc_pay_passwordEnabled'] : 0;
self::put('pay.payPasswordEnabled', $enabled ? 1 : 0, 'pay', '余额支付密码开关(开启后余额支付需验证 6 位支付密码)');
}
/**
* 小程序基础信息
*
@@ -207,7 +226,7 @@ class FcConfig
}
/**
* 发布模式与价格(同时同步会员套餐 M1/M12)
* 发布模式与价格(套餐定价在「运营推广 → 会员套餐」维护,本页不涉及)
*
* @param array $row
* @return void
@@ -239,19 +258,10 @@ class FcConfig
};
$single = $num('fc_post_singlePrice', 5);
$monthPrice = $num('fc_post_monthPrice', 19.9);
$yearPrice = $num('fc_post_yearPrice', 168);
$monthQuota = $int('fc_post_monthQuota', 30);
$yearQuota = $int('fc_post_yearQuota', 500);
$freeQuota = $int('fc_post_freeQuota', 0);
foreach (['单条发布价格' => $single, '月卡价格' => $monthPrice, '年卡价格' => $yearPrice] as $label => $value) {
if ($value < 0) {
throw new \Exception($label . '不能为负');
}
}
if ($monthQuota < 0 || $yearQuota < 0) {
throw new \Exception('含发布条数不能为负');
if ($single < 0) {
throw new \Exception('单条发布价格不能为负');
}
if ($freeQuota < 0) {
throw new \Exception('免费发布条数不能为负(0 表示不限制)');
@@ -262,27 +272,10 @@ class FcConfig
'post.singlePrice' => $single,
'post.freeQuota' => $freeQuota,
'post.freeQuotaCycle' => $cycle,
'post.monthPrice' => $monthPrice,
'post.monthQuota' => $monthQuota,
'post.yearPrice' => $yearPrice,
'post.yearQuota' => $yearQuota,
];
foreach ($values as $key => $value) {
self::put($key, $value, 'post', '发布配置');
}
// 与会员套餐保持一致(后台「运营推广 → 会员套餐」仍可单独维护,但价格/条数以本页为准)
$now = time();
Db::name('fc_plan')->where('plan_code', 'M1')->update([
'price' => $monthPrice,
'post_quota' => $monthQuota,
'updatetime' => $now,
]);
Db::name('fc_plan')->where('plan_code', 'M12')->update([
'price' => $yearPrice,
'post_quota' => $yearQuota,
'updatetime' => $now,
]);
}
/**
@@ -299,7 +292,7 @@ class FcConfig
if ($postDiscount === '') {
$postDiscount = '8 折';
}
$payView = isset($row['fc_fee_payView']) ? max(0, round((float)$row['fc_fee_payView'], 2)) : 1;
$payView = isset($row['fc_member_payView']) ? max(0, round((float)$row['fc_member_payView'], 2)) : 1;
$benefitsRaw = isset($row['fc_member_benefits']) ? trim((string)$row['fc_member_benefits']) : '';
$benefits = [];