NASER close orders when hamkar is closed, fix tahesab issues, fix singleorder issues

This commit is contained in:
gholak tala
2026-03-15 09:30:06 +00:00
parent fe83dc661a
commit 5ec53f12e6
2 changed files with 34 additions and 22 deletions
@@ -29,6 +29,11 @@ class SingleOrderController extends Controller
{
public function store(Request $request)
{
$goldir = Cnt::where('key', 'goldir_closed')->first();
if(isset($goldir) && $goldir['value'] == "true"){
throw new UnprocessableEntityHttpException('عدم ارائه سرویس.');
}
// throw new UnprocessableEntityHttpException('به دلیل نوسانات سفارشات بسته میباشد.');
$data = $request->all();
$transactionType = $data['direction'] == 1 ? "خرید" : "فروش";
@@ -157,7 +162,7 @@ class SingleOrderController extends Controller
'start_at' => now(),
], 1, true, false);
$response['1'] = 2;
//send to liman
//send to Goldir
$this->sendGoldir($data);
return $response;
}
@@ -268,7 +273,7 @@ class SingleOrderController extends Controller
'order_id' => $order->id
], 2, false, true);
//send to liman
//send to Goldir
$this->sendGoldir($data);
}
@@ -441,8 +446,8 @@ class SingleOrderController extends Controller
{
if ($this->Config('send_to_goldir') == "true") {
$liman_diff = Cnt::where('key', 'goldir_diff')->value('value');
$liman_price = Cnt::where('key', 'goldir_price')->value('value');
// $liman_diff = Cnt::where('key', 'goldir_diff')->value('value');
// $liman_price = Cnt::where('key', 'goldir_price')->value('value');
$mazaneh = ($data['direction'] == 1) ? Cnt::where('key', 'goldir_truly_buy_mazaneh')->value('value') : Cnt::where('key', 'goldir_truly_sell_mazaneh')->value('value');
$cash = Cnt::where('key', 'goldir_price')->value('value') * $data['amount'];
@@ -476,11 +481,11 @@ class SingleOrderController extends Controller
throw new UnprocessableEntityHttpException('سفارشات توسط ارائه دهنده بسته شده است.');
}
$data['provider_id'] = $response[1]['id'];
return $response;
}
// $data['total_price_goldir'] = ($data['direction'] == 1) ? ($liman_price+$liman_diff) : ($liman_price-$liman_diff) ;
$data['provider_id'] = $response[1]['id'];
return $response;
}
public function storeBackUp(Request $request)