fix(admin): replicate reference front-submit settings page 1:1
- Rewrite post_list/submit schema (PHP + JS) with the reference theme's field set, order, defaults and dependencies; topics fields excluded - Map PostDisplay::get_submit_settings() and the FrontSubmit runtime to the new keys without legacy fallback - Guest submission follows the capability matrix; category required on submit; pay limits read from the cash/points fieldset - Drop dead front_submit_* settings, template branches and JS config - Add submit settings reference contract test
This commit is contained in:
@@ -73,8 +73,8 @@ trait FrontSubmitPay {
|
||||
|
||||
if ($pay_modo === 'points') {
|
||||
$points = $this->parse_front_points($raw['points_price'] ?? $data['points_price'] ?? null);
|
||||
$min = $this->parse_front_points_limit($settings['pay_price_min'] ?? '0.00');
|
||||
$max = $this->parse_front_points_limit($settings['pay_price_max'] ?? '0.00');
|
||||
$min = max(0, (int) ($settings['pay_points_min'] ?? 0));
|
||||
$max = max(0, (int) ($settings['pay_points_max'] ?? 0));
|
||||
if ($points === null) {
|
||||
return ['success' => false, 'message' => __('请设置正确的积分价格', 'aksrt')];
|
||||
}
|
||||
@@ -119,8 +119,10 @@ trait FrontSubmitPay {
|
||||
$meta['vip2_price'] = '0.00';
|
||||
} else {
|
||||
$price_minor = $this->parse_front_cash_minor($raw['price'] ?? null);
|
||||
$min_minor = $this->parse_front_cash_minor($settings['pay_price_min'] ?? '0') ?? 0;
|
||||
$max_minor = $this->parse_front_cash_minor($settings['pay_price_max'] ?? '0') ?? 0;
|
||||
$min_yuan = max(0, (int) ($settings['pay_price_min'] ?? 0));
|
||||
$max_yuan = max(0, (int) ($settings['pay_price_max'] ?? 0));
|
||||
$min_minor = $min_yuan > 0 ? \AKSRT\Ledger\AssetAmount::balance((string) $min_yuan)->minor() : 0;
|
||||
$max_minor = $max_yuan > 0 ? \AKSRT\Ledger\AssetAmount::balance((string) $max_yuan)->minor() : 0;
|
||||
if ($price_minor === null) {
|
||||
return ['success' => false, 'message' => __('请设置正确的价格', 'aksrt')];
|
||||
}
|
||||
@@ -199,13 +201,6 @@ trait FrontSubmitPay {
|
||||
}
|
||||
}
|
||||
|
||||
private function parse_front_points_limit($value): int {
|
||||
if (!is_string($value) || !preg_match('/^(0|[1-9]\d*)(?:\.00)?$/', trim($value), $matches)) {
|
||||
return 0;
|
||||
}
|
||||
return $this->parse_front_points((string) $matches[1]) ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $meta
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user