This commit is contained in:
2026-06-14 21:42:21 +03:30
parent b84b2df01a
commit 0c4cbd7c12
9 changed files with 80 additions and 23 deletions
@@ -127,6 +127,8 @@ class CartController extends Controller
{
// return $request;
app(ConfigService::class)->assertTradingOpen();
$data = $request->json()->all();
$user= auth()->user();
if ($user->is_legal == 0 || !$user) {
@@ -10,6 +10,7 @@ use App\Models\Order;
use App\Models\Price;
use App\Models\Setting;
use App\Models\User;
use App\Services\ConfigService;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Rooyesh\Wallet\interfaces\TransactionInterface;
@@ -40,6 +41,7 @@ class OrderController extends Controller
if (!auth('customer')->user()->trade_active){
throw new UnprocessableEntityHttpException('امکان سفارش برای شما غیرفعال است.');
}
app(ConfigService::class)->assertTradingOpen();
$wallet = Wallet::where('owner',auth('customer')->id())->whereNull('fund_id')
->first();
$wallet_interface = new WalletInterface($data['customer_id'], 1);
@@ -53,9 +53,7 @@ class SingleOrderController extends Controller
}
if ($toBool($config->Config('close_price'))) {
if (Cnt::where('key', 'app_closed')->value('value') == "true") {
throw new UnprocessableEntityHttpException('عدم ارائه سرویس.');
}
$config->assertTradingOpen();
}
// throw new UnprocessableEntityHttpException('به دلیل نوسانات سفارشات بسته میباشد.');
+2 -16
View File
@@ -206,22 +206,8 @@ class ReportController extends Controller
|--------------------------------------------------------------------------
*/
if ($toBool($config->Config('close_price'))) {
$startDay = $config->Config('startDay') ?: '00:00';
[$startHour, $startMinute] = explode(':', $startDay);
$endDay = $config->Config('endDay') ?: '23:59';
[$endHour, $endMinute] = explode(':', $endDay);
$current = Carbon::now();
$start = Carbon::today()->setTime((int) $startHour, (int) $startMinute);
$end = Carbon::today()->setTime((int) $endHour, (int) $endMinute);
if (!$current->between($start, $end)) {
// عمومی: در Cnt بماند
Cnt::where('key', 'app_closed')->update(['value' => 'true']);
// مربوط به منتزر: settings
$config->UpdateConfig('montzar_closed', 'true');
if ($config->isOutsideTradingHours()) {
$config->syncAppClosedFlag();
return $zeroResponse();
}