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

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

查看文件

@@ -96,29 +96,38 @@ class AdminSetting extends V1
/**
* AS3 费用配置
* GET → {singlePost,freePostPerDay,memberMonth,memberQuarter,memberYear}
* POST 入参同字段 → 合并后配置;同时同步 fc_plan 价格
* POST 入参同字段 → 合并后配置
* 真源对齐:singlePost → post.singlePrice;freePostPerDay → post.freeQuota(按日);
* 月/季/年卡价格 → fc_plan(与后台「运营推广 → 会员套餐」同源,改价即时生效)
*/
public function fee()
{
if ($this->request->isPost()) {
$singlePost = (float)$this->input('singlePost', $this->cfg('fee.singlePost', 5));
$singlePost = (float)$this->input('singlePost', $this->cfg('post.singlePrice', 5));
if ($singlePost < 0) {
$this->fail('单条发布价格不能为负');
}
$freePostPerDay = (int)$this->input('freePostPerDay', $this->cfg('fee.freePostPerDay', 2));
$memberMonth = (float)$this->input('memberMonth', $this->cfg('fee.memberMonth', 19.9));
$memberQuarter = (float)$this->input('memberQuarter', $this->cfg('fee.memberQuarter', 49.9));
$memberYear = (float)$this->input('memberYear', $this->cfg('fee.memberYear', 168));
$freePostPerDay = (int)$this->input('freePostPerDay', $this->cfg('post.freeQuota', 0));
if ($freePostPerDay < 0) {
$this->fail('免费发布条数不能为负');
}
$this->setCfg('fee.singlePost', $singlePost);
$this->setCfg('fee.freePostPerDay', $freePostPerDay);
$this->setCfg('fee.memberMonth', $memberMonth);
$this->setCfg('fee.memberQuarter', $memberQuarter);
$this->setCfg('fee.memberYear', $memberYear);
$this->setCfg('post.singlePrice', $singlePost);
$this->setCfg('post.freeQuota', $freePostPerDay);
$this->setCfg('post.freeQuotaCycle', 'day');
Db::name('fc_plan')->where('plan_code', 'M1')->update(['price' => $memberMonth]);
Db::name('fc_plan')->where('plan_code', 'M3')->update(['price' => $memberQuarter]);
Db::name('fc_plan')->where('plan_code', 'M12')->update(['price' => $memberYear]);
$now = time();
foreach (['M1' => 'memberMonth', 'M3' => 'memberQuarter', 'M12' => 'memberYear'] as $code => $field) {
$raw = $this->input($field, null);
if ($raw === null || $raw === '') {
continue;
}
$price = round((float)$raw, 2);
if ($price < 0) {
$this->fail('套餐价格不能为负');
}
Db::name('fc_plan')->where('plan_code', $code)->update(['price' => $price, 'updatetime' => $now]);
}
$this->adminLog('修改费用配置');
}
@@ -334,15 +343,20 @@ class AdminSetting extends V1
];
}
/** 费用配置结构 */
/** 费用配置结构(月/季/年卡价格真源=fc_plan;发布价格/免费条数真源=post.*) */
protected function feeConfig()
{
$plans = Db::name('fc_plan')->where('enabled', 1)->column('price', 'plan_code');
$planPrice = function ($code, $default) use ($plans) {
return isset($plans[$code]) && $plans[$code] !== null && $plans[$code] !== '' ? round((float)$plans[$code], 2) : $default;
};
return [
'singlePost' => (float)$this->cfg('fee.singlePost', 5),
'freePostPerDay' => (int)$this->cfg('fee.freePostPerDay', 2),
'memberMonth' => (float)$this->cfg('fee.memberMonth', 19.9),
'memberQuarter' => (float)$this->cfg('fee.memberQuarter', 49.9),
'memberYear' => (float)$this->cfg('fee.memberYear', 168),
'singlePost' => round((float)$this->cfg('post.singlePrice', 5), 2),
'freePostPerDay' => max(0, (int)$this->cfg('post.freeQuota', 0)),
'memberMonth' => $planPrice('M1', 19.9),
'memberQuarter' => $planPrice('M3', 49.9),
'memberYear' => $planPrice('M12', 168),
];
}