fix(settings): read SuperAdmin overlay via ConfigService everywhere
This commit is contained in:
@@ -260,9 +260,9 @@ class AuthController extends Controller
|
||||
|
||||
$message = "{$data['name']} عزیز، اکانت شما در پلتفرم {$this->Config('name_fa')} ایجاد شد.";
|
||||
if ($cfg->getBool('register_referral_bonus_message', false)) {
|
||||
$bonus = Setting::where('is_active', 1)->where('key', 'referral_bonus_amount')->first();
|
||||
if ($bonus) {
|
||||
$bonusValues = json_decode($bonus->value, true);
|
||||
$bonusRaw = $cfg->getString('referral_bonus_amount');
|
||||
if ($bonusRaw !== '') {
|
||||
$bonusValues = json_decode($bonusRaw, true);
|
||||
$message .= "\nپس از اولین خرید مقدار، " . number_format((int) ($bonusValues[0]['customer'] ?? 0)) . ' ریال پاداش دریافت خواهید کرد.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,15 +202,10 @@ class Controller extends BaseController
|
||||
])->post('https://tele.ygram.ir/send-message', ["message" => $msg, "chatId" => $to, "botToken" => 'Paramisgold_bot']);
|
||||
return $response->json();
|
||||
}
|
||||
/** @deprecated alias — همان ConfigService::get؛ overlay سوپرادمین را هم میخواند */
|
||||
public static function Config($name)
|
||||
{
|
||||
$row = Setting::where('key', $name)->first();
|
||||
|
||||
if ($row && $row->is_active && $row->value !== null && $row->value !== '') {
|
||||
return $row->value;
|
||||
}
|
||||
|
||||
return false;
|
||||
return app(ConfigService::class)->Config($name);
|
||||
}
|
||||
|
||||
/** دامنهٔ عمومی سایت — فقط از درخواست HTTP فعلی */
|
||||
@@ -227,12 +222,7 @@ class Controller extends BaseController
|
||||
|
||||
protected static function metalTypeSettingValue(): ?string
|
||||
{
|
||||
$metalType = Setting::where('key', 'metal_type')->value('value');
|
||||
if ($metalType === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$metalType = trim((string) $metalType);
|
||||
$metalType = trim((string) app(ConfigService::class)->getString('metal_type'));
|
||||
|
||||
return $metalType !== '' ? $metalType : null;
|
||||
}
|
||||
@@ -495,7 +485,7 @@ class Controller extends BaseController
|
||||
public static function tradeWeightUnit(): string
|
||||
{
|
||||
return self::resolveTradeWeightUnit(
|
||||
Setting::where('key', 'unit')->value('value')
|
||||
app(ConfigService::class)->getString('unit')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1696,12 +1696,12 @@ class SingleOrderController extends Controller
|
||||
|
||||
private function bonusGift($customer, $referrer)
|
||||
{
|
||||
$bonus = Setting::where('key', 'referral_bonus_amount')->where('is_active', 1)->first();
|
||||
if ($bonus === null) {
|
||||
$bonusRaw = app(\App\Services\ConfigService::class)->getString('referral_bonus_amount');
|
||||
if ($bonusRaw === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$bonus = json_decode($bonus->value, true);
|
||||
$bonus = json_decode($bonusRaw, true);
|
||||
$customer_bonus = $bonus[0]['customer'] ?? 0;
|
||||
$referrer_bonus = $bonus[0]['referrer'] ?? 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user