added price_offset_percent

This commit is contained in:
2026-06-02 16:00:33 +03:30
parent 6cbbde9834
commit c40ac0a3fe
6 changed files with 215 additions and 36 deletions
+10 -10
View File
@@ -4,7 +4,8 @@ namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Product;
use Illuminate\Support\Facades\Http;
use App\Http\Controllers\Site\ReportController ;
use App\Http\Controllers\Site\ReportController;
use App\Services\ProductPriceService;
// مدل محصول خود را ایمپورت کنید
@@ -47,10 +48,11 @@ class UpdateProductStatus extends Command
$show = ($current_time >= $product->auto_open_at && $current_time <= $product->auto_close_at);
if ($product->reading_method == $RPrice['name']) {
$p = Product::where('id', $product->id)->update([
'price' => $RPrice['price'],
'price_profit' => $RPrice['profit'],
]);
ProductPriceService::syncFromReference(
$product,
(int) $RPrice['price'],
(int) ($RPrice['profit'] ?? 0)
);
if($product->bubble== 1){
$ReportController = new ReportController();
@@ -63,11 +65,9 @@ class UpdateProductStatus extends Command
}
}
if($product->reading_method == 'مس' && $CP){
$p = Product::where('id', $product->id)->update([
'price' => $CP,
'show' => $show,
]);
if ($product->reading_method == 'مس' && $CP) {
ProductPriceService::syncFromReference($product, (int) $CP, 0);
Product::where('id', $product->id)->update(['show' => $show]);
}
}
}