product time changed
This commit is contained in:
@@ -696,12 +696,20 @@ class Controller extends BaseController
|
|||||||
$counter->save();
|
$counter->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Storage::exists('accessTokenGibit') || !Storage::exists('refreshTokenGibit')) {
|
||||||
|
Storage::put('accessTokenGibit', 'توکن اولیه');
|
||||||
|
Storage::put('refreshTokenGibit', 'توکن رفرش اولیه');
|
||||||
|
}
|
||||||
|
|
||||||
$apiData['refresh'] = Http::withoutVerifying()->withToken(Storage::get('refreshTokenGibit'))
|
$apiData['refresh'] = Http::withoutVerifying()->withToken(Storage::get('refreshTokenGibit'))
|
||||||
->post('https://napi.jibit.ir/ide/v1/tokens/generate', [
|
->post('https://napi.jibit.ir/ide/v1/tokens/generate', [
|
||||||
'apiKey' => 'J5WxrPxPOg',
|
'apiKey' => 'J5WxrPxPOg',
|
||||||
'secretKey' => '7dgeE70xQXsQL7r36j3wif6X9',
|
'secretKey' => '7dgeE70xQXsQL7r36j3wif6X9',
|
||||||
])->json();
|
])->json();
|
||||||
Storage::put('accessTokenGibit', $apiData['refresh']['accessToken']);
|
Storage::put('accessTokenGibit', $apiData['refresh']['accessToken'] ?? '');
|
||||||
|
if (!empty($apiData['refresh']['refreshToken'])) {
|
||||||
|
Storage::put('refreshTokenGibit', $apiData['refresh']['refreshToken']);
|
||||||
|
}
|
||||||
|
|
||||||
$response = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit'))
|
$response = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit'))
|
||||||
->get("https://napi.jibit.ir/ide/v1/services/matching?mobileNumber=$mobile&nationalCode=$nationalCode")
|
->get("https://napi.jibit.ir/ide/v1/services/matching?mobileNumber=$mobile&nationalCode=$nationalCode")
|
||||||
@@ -713,8 +721,10 @@ class Controller extends BaseController
|
|||||||
'apiKey' => 'J5WxrPxPOg',
|
'apiKey' => 'J5WxrPxPOg',
|
||||||
'secretKey' => '7dgeE70xQXsQL7r36j3wif6X9',
|
'secretKey' => '7dgeE70xQXsQL7r36j3wif6X9',
|
||||||
])->json();
|
])->json();
|
||||||
Storage::put('accessTokenGibit', $refreshToken['accessToken']);
|
Storage::put('accessTokenGibit', $refreshToken['accessToken'] ?? '');
|
||||||
Storage::put('refreshTokenGibit', $refreshToken['refreshToken']);
|
if (!empty($refreshToken['refreshToken'])) {
|
||||||
|
Storage::put('refreshTokenGibit', $refreshToken['refreshToken']);
|
||||||
|
}
|
||||||
$response = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit'))
|
$response = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit'))
|
||||||
->get("https://napi.jibit.ir/ide/v1/services/matching?mobileNumber=$mobile&nationalCode=$nationalCode")
|
->get("https://napi.jibit.ir/ide/v1/services/matching?mobileNumber=$mobile&nationalCode=$nationalCode")
|
||||||
->json();
|
->json();
|
||||||
|
|||||||
@@ -640,10 +640,8 @@ class ConfigService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ساعت معامله یک محصول:
|
* ساعت معامله یک محصول:
|
||||||
* - اگر سوییچ override محصول روشن باشد → فقط بازه اختصاصی خود محصول حاکم است (سراسری نادیده گرفته میشود).
|
* - override روشن + بازه معتبر → فقط بازه اختصاصی همان محصول
|
||||||
* - اگر خاموش باشد → لایهٔ بیرونیِ ساعت کاری محصول (auto_open_at/auto_close_at) همیشه اعمال میشود،
|
* - در غیر این صورت → فقط وقتی close_price روشن است، startDay/endDay سراسری
|
||||||
* مستقل از اینکه close_price روشن باشد یا نه.
|
|
||||||
* - فقط اگر محصول هیچ بازهٔ معتبری نداشته باشد → فیلتر سراسری close_price + startDay/endDay اعمال میشود.
|
|
||||||
*/
|
*/
|
||||||
public function isProductWithinTradingHours(Product $product, ?Carbon $now = null): bool
|
public function isProductWithinTradingHours(Product $product, ?Carbon $now = null): bool
|
||||||
{
|
{
|
||||||
@@ -651,10 +649,6 @@ class ConfigService
|
|||||||
return $this->isWithinTimeWindow($product->auto_open_at, $product->auto_close_at, $now);
|
return $this->isWithinTimeWindow($product->auto_open_at, $product->auto_close_at, $now);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->hasProductTradingWindow($product->auto_open_at, $product->auto_close_at)) {
|
|
||||||
return $this->isWithinTimeWindow($product->auto_open_at, $product->auto_close_at, $now);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->isClosePriceEnabled() && $this->isOutsideTradingHours($now)) {
|
if ($this->isClosePriceEnabled() && $this->isOutsideTradingHours($now)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -666,10 +660,7 @@ class ConfigService
|
|||||||
{
|
{
|
||||||
$title = trim((string) ($product->title ?? 'محصول'));
|
$title = trim((string) ($product->title ?? 'محصول'));
|
||||||
|
|
||||||
if (
|
if ($this->productOverridesTradingHours($product)) {
|
||||||
$this->productOverridesTradingHours($product)
|
|
||||||
|| $this->hasProductTradingWindow($product->auto_open_at, $product->auto_close_at)
|
|
||||||
) {
|
|
||||||
$open = $this->formatProductTime($product->auto_open_at);
|
$open = $this->formatProductTime($product->auto_open_at);
|
||||||
$close = $this->formatProductTime($product->auto_close_at);
|
$close = $this->formatProductTime($product->auto_close_at);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user