fix bugs
This commit is contained in:
@@ -512,29 +512,6 @@ class ProductController extends SuperController
|
||||
|
||||
}
|
||||
|
||||
/** فروشگاه — نمایش در اپ کاربر: فعال + ساعات + قیمت ذخیرهشده یا محصول وزنی */
|
||||
private function storeProductShowForCustomer(Product $product): bool
|
||||
{
|
||||
if (! $product->active) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! app(ConfigService::class)->isProductWithinTradingHours($product)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$storedPrice = (int) ($product->price ?? 0) + (int) ($product->price_profit ?? 0);
|
||||
if ($storedPrice > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((int) ($product->direct_price ?? 0) === 0 && (float) ($product->amount ?? 0) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function isCustomerApiRequest(): bool
|
||||
{
|
||||
$path = trim((string) request()->path(), '/');
|
||||
@@ -569,14 +546,7 @@ class ProductController extends SuperController
|
||||
return;
|
||||
}
|
||||
|
||||
if (app(ConfigService::class)->isStore()) {
|
||||
$products->each(function (Product $product) {
|
||||
$product->setAttribute('show', $this->storeProductShowForCustomer($product));
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// فروشگاه و خانگی: همان enrich قیمت لحظهای (آبشده/قیمت اپ/مرجع) — بدون UPDATE دیتابیس
|
||||
$displayPriceService = app(ProductDisplayPriceService::class);
|
||||
$displayPriceService->warmLivePriceCache();
|
||||
$displayPriceService->enrichForApi($products);
|
||||
@@ -592,7 +562,7 @@ class ProductController extends SuperController
|
||||
*/
|
||||
private function enrichAdminTablePrices($rows): void
|
||||
{
|
||||
if ($rows === null || app(ConfigService::class)->isStore()) {
|
||||
if ($rows === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class AuthController extends Controller
|
||||
throw new UnprocessableEntityHttpException('شماره موبایل یا پسوورد وارد شده اشتباه است');
|
||||
}
|
||||
if (!$user->active) {
|
||||
throw new UnprocessableEntityHttpException(trans('error.no_active'));
|
||||
throw new UnprocessableEntityHttpException('شما مجوز دسترسی به اکانت خود را ندارید');
|
||||
}
|
||||
if ($user->is_archive) {
|
||||
throw new UnprocessableEntityHttpException('شما اجازه ورود به سیستم را ندارید');
|
||||
@@ -70,7 +70,7 @@ class AuthController extends Controller
|
||||
}
|
||||
$user = auth($provider)->user();
|
||||
if (!$user->active) {
|
||||
throw new UnprocessableEntityHttpException(trans('error.no_active'));
|
||||
throw new UnprocessableEntityHttpException('شما مجوز دسترسی به اکانت خود را ندارید');
|
||||
}
|
||||
if ($provider == 'customer' && $user->is_archive) {
|
||||
throw new UnprocessableEntityHttpException('شما اجازه ورود به سیستم را ندارید');
|
||||
@@ -94,7 +94,7 @@ class AuthController extends Controller
|
||||
throw new UnprocessableEntityHttpException(trans('لطفا ابتدا ثبت نام بفرمایید'));
|
||||
}
|
||||
if (!$user->active) {
|
||||
throw new UnprocessableEntityHttpException(trans('اکانت شما باید توسط ادمین فعال شود'));
|
||||
throw new UnprocessableEntityHttpException('شما مجوز دسترسی به اکانت خود را ندارید');
|
||||
}
|
||||
if ($provider == 'customer' && $user->is_archive) {
|
||||
throw new UnprocessableEntityHttpException('شما اجازه ورود به سیستم را ندارید');
|
||||
@@ -124,7 +124,7 @@ class AuthController extends Controller
|
||||
$user->save();
|
||||
return $this->respondWithToken($token);
|
||||
}
|
||||
throw new UnprocessableEntityHttpException(trans('error.wrong_code'));
|
||||
throw new UnprocessableEntityHttpException('کد وارد شده اشتباه است');
|
||||
}
|
||||
|
||||
protected function respondWithToken($token)
|
||||
|
||||
@@ -20,7 +20,6 @@ use App\Http\Controllers\Admin\TahesabController;
|
||||
use App\Services\ConfigService;
|
||||
use App\Services\ReferralGiftService;
|
||||
use App\Services\WalletBalanceService;
|
||||
use App\Support\PersianDigits;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@@ -189,7 +188,6 @@ class CustomerController extends Controller
|
||||
$customer = Customer::findOrFail(auth('customer')->id());
|
||||
$wasLegal = (int) $customer->is_legal;
|
||||
$updateData = $request->except(['referral_id', 'referral_to_id', 'is_legal']);
|
||||
$updateData = PersianDigits::toEnglish($updateData);
|
||||
if (!empty($updateData['birth_date'])) {
|
||||
try {
|
||||
$updateData['birth_date'] = Carbon::parse($updateData['birth_date'])->format('Y-m-d');
|
||||
|
||||
@@ -23,9 +23,7 @@ class EnsureCustomerIsActive
|
||||
|
||||
if (!$customer->active) {
|
||||
return response()->json([
|
||||
'message' => trans('error.no_active') !== 'error.no_active'
|
||||
? trans('error.no_active')
|
||||
: 'اکانت شما توسط کارشناس سیستم غیر فعال شد',
|
||||
'message' => 'شما مجوز دسترسی به اکانت خود را ندارید',
|
||||
], 401);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user