NASER optimize last api & dynamic price & fix orders with 0 price & test all changes
This commit is contained in:
+17
-15
@@ -16,31 +16,33 @@ use Illuminate\Http\Request;
|
||||
|
||||
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();
|
||||
$RPrices = Http::get('http://37.32.11.142:4949/api/free', [])->json();
|
||||
|
||||
$products = Product::with([])->whereNotNull('reading_method')->get();
|
||||
foreach ($products as $product) {
|
||||
foreach ($RPrices as $RPrice) {
|
||||
if($RPrice['name'] == 'TGJU فلز مس'){
|
||||
$collection = collect($RPrices);
|
||||
$RPrice = $collection->firstWhere('key', $product->reading_method);
|
||||
if (!empty($RPrice)) {
|
||||
// foreach ($RPrices as $RPrice) {
|
||||
if ($RPrice['name'] == 'TGJU فلز مس') {
|
||||
$copper = $RPrice['price'] + $RPrice['profit'];
|
||||
}
|
||||
if($RPrice['name'] == 'TGJU دلار'){
|
||||
if ($RPrice['name'] == 'TGJU دلار') {
|
||||
$dollar = $RPrice['price'] + $RPrice['profit'];
|
||||
}
|
||||
if($RPrice['name'] == 'گلد دات ای از آبشده - رسمی - نقد فردا'){
|
||||
$RPrice['price'] = $RPrice['price']/4.3318;
|
||||
}
|
||||
if ($product->reading_method == $RPrice['name']) {
|
||||
$p = Product::where('id', $product->id)->update([
|
||||
'price' => $RPrice['price'],
|
||||
'price_profit' => $RPrice['profit'],
|
||||
]);
|
||||
if ($RPrice['name'] == 'گلد دات ای از آبشده - رسمی - نقد فردا') {
|
||||
$RPrice['price'] = $RPrice['price'] / 4.3318;
|
||||
}
|
||||
$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([
|
||||
if (isset($copper) && isset($dollar)) {
|
||||
$cp = ($copper / 1000000) * $dollar;
|
||||
$p = Product::where('id', 33)->update([
|
||||
'price' => $cp,
|
||||
'price_profit' => 0,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user