NASER fix upload file and create a row in const table for banner

This commit is contained in:
2026-02-21 13:35:27 +03:30
parent 07c5836048
commit 323ff1a2f7
2 changed files with 17 additions and 13 deletions
+3
View File
@@ -26,6 +26,9 @@ Route::middleware('auth:user')->group(function (){
return Http::get('https://pricing.liman.gold/pricingApi', [])->json();
});
//upload file
Route::post('/file',[FileController::class, 'store']);
//settigs
Route::get('get_settings',[SettingsController::class, 'index']);
Route::post('get_settings',[SettingsController::class, 'edit']);
+14 -13
View File
@@ -15,31 +15,32 @@ use App\Http\Controllers\pay\PaymanController;
Route::get('/refPricer', function () {
// $RPrices = Http::get('https://pricing.liman.gold/pricingApi', [])->json();
$RPrices = Http::get('http://212.23.201.173:8381/price_list', [])->json();
try{
$cooper =Http::timeout(40)->get('https://www.livedata.ir/main/static/p.json', [])->json();
if(isset($cooper['s_301006']) && isset($cooper['s_200103'])){
$CP = (($cooper['s_301006']/1000000)*$cooper['s_200103'])*10;
// Cnt::where('key', 'cu_price')
}
}catch (\Exception $e){}
$products = Product::with([])->whereNotNull('reading_method')->get();
foreach ($products as $product) {
foreach ($RPrices as $RPrice) {
if($product->reading_method == 'مس' && $CP){
$p = Product::where('id', $product->id)->update([
'price' => $CP,
]);
if($RPrice['name'] == 'TGJU فلز مس'){
$copper = $RPrice['price'] + $RPrice['profit'];
}
if($RPrice['name'] == 'TGJU دلار'){
$dollar = $RPrice['price'] + $RPrice['profit'];
}
if ($product->reading_method == $RPrice['name']) {
$p = Product::where('id', $product->id)->update([
'price' => $RPrice['price'],
'price_profit' => $RPrice['profit'],
]);
}
}
}
if(isset($copper)&& isset($dollar)){
$cp = ($copper/1000000)*$dollar;
$p = Product::where('id', 33)->update([
'price' => $cp,
'price_profit' => 0,
]);
}
return response()->json(true);
});