NASER fix upload file and create a row in const table for banner
This commit is contained in:
@@ -26,6 +26,9 @@ Route::middleware('auth:user')->group(function (){
|
|||||||
return Http::get('https://pricing.liman.gold/pricingApi', [])->json();
|
return Http::get('https://pricing.liman.gold/pricingApi', [])->json();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//upload file
|
||||||
|
Route::post('/file',[FileController::class, 'store']);
|
||||||
|
|
||||||
//settigs
|
//settigs
|
||||||
Route::get('get_settings',[SettingsController::class, 'index']);
|
Route::get('get_settings',[SettingsController::class, 'index']);
|
||||||
Route::post('get_settings',[SettingsController::class, 'edit']);
|
Route::post('get_settings',[SettingsController::class, 'edit']);
|
||||||
|
|||||||
+14
-13
@@ -15,31 +15,32 @@ use App\Http\Controllers\pay\PaymanController;
|
|||||||
Route::get('/refPricer', function () {
|
Route::get('/refPricer', function () {
|
||||||
// $RPrices = Http::get('https://pricing.liman.gold/pricingApi', [])->json();
|
// $RPrices = Http::get('https://pricing.liman.gold/pricingApi', [])->json();
|
||||||
$RPrices = Http::get('http://212.23.201.173:8381/price_list', [])->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();
|
$products = Product::with([])->whereNotNull('reading_method')->get();
|
||||||
foreach ($products as $product) {
|
foreach ($products as $product) {
|
||||||
foreach ($RPrices as $RPrice) {
|
foreach ($RPrices as $RPrice) {
|
||||||
if($product->reading_method == 'مس' && $CP){
|
if($RPrice['name'] == 'TGJU فلز مس'){
|
||||||
$p = Product::where('id', $product->id)->update([
|
$copper = $RPrice['price'] + $RPrice['profit'];
|
||||||
'price' => $CP,
|
}
|
||||||
]);
|
if($RPrice['name'] == 'TGJU دلار'){
|
||||||
|
$dollar = $RPrice['price'] + $RPrice['profit'];
|
||||||
}
|
}
|
||||||
if ($product->reading_method == $RPrice['name']) {
|
if ($product->reading_method == $RPrice['name']) {
|
||||||
$p = Product::where('id', $product->id)->update([
|
$p = Product::where('id', $product->id)->update([
|
||||||
'price' => $RPrice['price'],
|
'price' => $RPrice['price'],
|
||||||
'price_profit' => $RPrice['profit'],
|
'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);
|
return response()->json(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user