fix kashkool
This commit is contained in:
@@ -494,17 +494,14 @@ class ReportController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* فروشگاه — منطق lastPrice: montzar_price / prices
|
* فروشگاه — منطق lastPrice بر اساس price_provider
|
||||||
*/
|
*/
|
||||||
protected function storeLastPrice(ConfigService $config): array
|
protected function storeLastPrice(ConfigService $config): array
|
||||||
{
|
{
|
||||||
$toBool = fn ($value) => filter_var($value, FILTER_VALIDATE_BOOLEAN);
|
|
||||||
|
|
||||||
$talaIr = 0;
|
$talaIr = 0;
|
||||||
$montzar = 0;
|
$montzar = 0;
|
||||||
|
|
||||||
$montzarExists = Setting::where('key', 'montzar_price')->exists();
|
$montzarEnabled = $config->priceProvider() === 'montzar';
|
||||||
$montzarEnabled = $montzarExists && $toBool($config->Config('montzar_price'));
|
|
||||||
|
|
||||||
if ($montzarEnabled) {
|
if ($montzarEnabled) {
|
||||||
try {
|
try {
|
||||||
@@ -588,7 +585,7 @@ class ReportController extends Controller
|
|||||||
'tala_ir' => $talaIr,
|
'tala_ir' => $talaIr,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($montzarExists) {
|
if ($montzarEnabled) {
|
||||||
$response['montzar'] = $montzar;
|
$response['montzar'] = $montzar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,9 +163,8 @@ class ConfigService
|
|||||||
*
|
*
|
||||||
* اولویت:
|
* اولویت:
|
||||||
* 1) price_provider (یا price_primary_source قدیمی) — فقط مقادیر معتبر
|
* 1) price_provider (یا price_primary_source قدیمی) — فقط مقادیر معتبر
|
||||||
* 2) montzar_price=true → montzar (ابشده خانگی و پروژههای فعلی)
|
* 2) main_product_price=true → main_product (legacy)
|
||||||
* 3) main_product_price=true → main_product (legacy)
|
* 3) پیشفرض فایل: montzar
|
||||||
* 4) پیشفرض فایل: montzar
|
|
||||||
*/
|
*/
|
||||||
public function priceProvider(): string
|
public function priceProvider(): string
|
||||||
{
|
{
|
||||||
@@ -176,10 +175,6 @@ class ConfigService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getBool('montzar_price', false)) {
|
|
||||||
return 'montzar';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->getBool('main_product_price', false)) {
|
if ($this->getBool('main_product_price', false)) {
|
||||||
return 'main_product';
|
return 'main_product';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,6 @@
|
|||||||
* منبع قیمت: یک کلید → price_provider
|
* منبع قیمت: یک کلید → price_provider
|
||||||
* montzar | main_product | zaarbox
|
* montzar | main_product | zaarbox
|
||||||
*
|
*
|
||||||
* سازگاری قدیمی (بدون price_provider):
|
|
||||||
* montzar_price=true → montzar
|
|
||||||
*
|
|
||||||
* main_product: شناسه محصول در settings (کلید main_product)، وگرنه const
|
* main_product: شناسه محصول در settings (کلید main_product)، وگرنه const
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
-- حذف تنظیمات legacy قیمت — منبع فعال فقط price_provider است.
|
||||||
|
-- montzar_price و price_from_nasiryan (نصیریان) دیگر در کد استفاده نمیشوند.
|
||||||
|
-- قبل از اجرا: mysqldump بکاپ
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
DELETE FROM `settings` WHERE `key` IN (
|
||||||
|
'montzar_price',
|
||||||
|
'price_from_nasiryan'
|
||||||
|
);
|
||||||
|
|
||||||
|
DELETE FROM `const` WHERE `key` IN (
|
||||||
|
'nasiryan',
|
||||||
|
'nasiryan_price',
|
||||||
|
'nasiryan_diff',
|
||||||
|
'nasiryan_mazaneh',
|
||||||
|
'nasiryan_truly_buy_mazaneh',
|
||||||
|
'nasiryan_truly_sell_mazaneh',
|
||||||
|
'nasiryan_closed'
|
||||||
|
);
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
Reference in New Issue
Block a user