fix some setting show

This commit is contained in:
2026-07-01 15:47:24 +03:30
parent 6aaadf5825
commit 235b835100
6 changed files with 87 additions and 256 deletions
@@ -80,12 +80,11 @@ class SingleOrderController extends Controller
$data['all_price'] = $latestPrice;
$data['price'] = $basePrice;
$data['price_id'] = $latestPrice?->id;
$feeCash = Setting::where('key', 'fee_cash')->first();
$feeServiceCharge = Setting::where('key', 'fee_service_charge_percentage')->first();
if (!$feeCash || !$feeServiceCharge) {
if (! $feeServiceCharge) {
throw new UnprocessableEntityHttpException('تنظیمات کارمزد یافت نشد.');
}
$data['difference'] = (float) $feeCash->value;
$data['difference'] = (float) (Setting::where('key', 'fee_single')->value('value') ?? config('fee.single', 0));
$data['service_charge_percentage'] = (float) $feeServiceCharge->value;
$fee_free = Setting::where('key', 'fee_free')->where('is_active', true)->value('value');
@@ -50,7 +50,7 @@ class paypingController extends Controller
{
$list = $this->cfg()->getString('payping_gateway_items', '');
if ($list === '') {
return $this->cfg()->getString('payping_gateway_item', (string) config('payment.payping_gateway_item', 'gp1Q'));
return (string) config('payment.payping_gateway_item', 'gp1Q');
}
$items = array_values(array_filter(array_map('trim', explode(',', $list))));
+5 -3
View File
@@ -188,13 +188,13 @@ class ConfigService
* محصولات متصل به کیف اصلی — setting `main_wallet_products`.
* مقدار: idها با کاما (مثل «13,25») یا آرایه JSON (مثل «[13,25]»).
* موجودی این محصولات = gold کیف اصلی (دارایی جدا ندارند).
* فقط opt-in: اگر ست نباشد آرایه خالی برمی‌گردد و رفتار قبلی حفظ می‌شود.
* اگر خالی باشد پیش‌فرض [13] است.
*/
public function mainWalletProductIds(): array
{
$raw = trim($this->getString('main_wallet_products', ''));
if ($raw === '') {
return [];
return [13];
}
$decoded = json_decode($raw, true);
@@ -208,7 +208,9 @@ class ConfigService
}
}
return array_values(array_unique($ids));
$ids = array_values(array_unique($ids));
return $ids !== [] ? $ids : [13];
}
public function isMainWalletProduct(int $productId): bool