handled some bugs and adde some feature for banner

This commit is contained in:
2026-07-19 15:53:05 +03:30
parent fc9de5198c
commit 160d6bd923
10 changed files with 158 additions and 36 deletions
@@ -62,6 +62,22 @@ class CustomerController extends SuperController
Customer::assertMobileUnique($data['mobile'], (int) $id);
}
if (array_key_exists('pargar_account_id', $data)) {
$data['pargar_account_id'] = $this->normalizeAndAssertUniqueAccountingCode(
$data['pargar_account_id'],
'pargar_account_id',
(int) $id
);
}
if (array_key_exists('moshtari_code', $data)) {
$data['moshtari_code'] = $this->normalizeAndAssertUniqueAccountingCode(
$data['moshtari_code'],
'moshtari_code',
(int) $id
);
}
if (isset($data['gold'])){
$user = Customer::find($id);
if ($user) {
@@ -74,6 +90,32 @@ class CustomerController extends SuperController
return response()->json($user);
}
/**
* خالی / 0 / -1 → null؛ در غیر این صورت یکتا بودن کد بین مشتریان فعال.
*/
private function normalizeAndAssertUniqueAccountingCode(mixed $value, string $column, int $customerId): ?string
{
if ($value === null) {
return null;
}
$code = trim((string) $value);
if ($code === '' || in_array($code, ['0', '-1'], true)) {
return null;
}
$exists = Customer::whereNull('deleted_at')
->where($column, $code)
->where('id', '!=', $customerId)
->exists();
if ($exists) {
throw new UnprocessableEntityHttpException('این کد حسابداری قبلاً برای مشتری دیگری ثبت شده است');
}
return $code;
}
public function referrals(Request $request,$customer_id)
{
$customer_referral_id = Customer::where("id",$customer_id)->first()->referral_id;
@@ -13,6 +13,16 @@ class SettingsController extends Controller
private const NEW_SETTING_NOTIFY_MOBILE = '09134469985';
/**
* کلیدهایی که پنل ادمین باید بتواند ویرایش کند حتی اگر در DB هنوز can_edit=0 باشد
* (بنرها / سایت‌های ری‌گیری).
*/
private const PANEL_MANAGED_KEYS = [
'tracking_systems',
'tracking_systems_enabled',
'banner_enabled',
];
public function index(Request $request)
{
$query = Setting::query()
@@ -56,7 +66,7 @@ class SettingsController extends Controller
$setting = new Setting();
$setting->key = $request->key;
$setting->can_edit = $isSystemDeploy ? 0 : 1;
} elseif (!$setting->can_edit && !$isDeployAdmin) {
} elseif (!$setting->can_edit && !$isDeployAdmin && !$this->isPanelManagedKey((string) $request->key)) {
return response()->json(['message' => 'Forbidden'], 403);
}
@@ -119,4 +129,9 @@ class SettingsController extends Controller
return $this->normalizeAdminMobile($user->mobile ?? '') === self::DEPLOY_ADMIN_MOBILE_SUFFIX;
}
private function isPanelManagedKey(string $key): bool
{
return in_array($key, self::PANEL_MANAGED_KEYS, true);
}
}
@@ -173,7 +173,7 @@ class WalletController extends Controller
$record->unit = "گرم";
if ((int) ($record->type ?? 0) === 22) {
$record->title = 'تعدیل مانده پرگار';
$record->title = 'تعدیل حسابداری پرگار';
$record->unit = 'گرم';
} elseif ((int) ($record->type ?? 0) === 12) {
$record->title = 'برداشت وجه نقد';
@@ -802,7 +802,7 @@ class WalletController extends Controller
}
if ((int) $record->type === 22) {
return 'تعدیل مانده پرگار';
return 'تعدیل حسابداری پرگار';
}
return $record->type_str;
@@ -284,7 +284,7 @@ class PargarInboundController extends Controller
new TransactionInterface($walletInterface, [
'cash' => $rialDiff,
'gold' => $goldDiff,
'title' => 'تعدیل مانده پرگار',
'title' => 'تعدیل حسابداری پرگار',
'expire_at' => now(),
'active' => true,
'start_at' => now(),
@@ -312,7 +312,12 @@ class PargarInboundController extends Controller
{
$customers = Customer::query()
->whereNull('deleted_at')
->whereNull('pargar_account_id')
->where(function ($q) {
$q->whereNull('pargar_account_id')
->orWhere('pargar_account_id', '')
->orWhere('pargar_account_id', '0')
->orWhere('pargar_account_id', '-1');
})
->limit(100)
->get(['id', 'fname', 'lname', 'name', 'mobile']);
@@ -372,9 +377,14 @@ class PargarInboundController extends Controller
continue;
}
$normalizedAccountId = trim((string) $accountId);
if ($normalizedAccountId === '' || in_array($normalizedAccountId, ['0', '-1'], true)) {
continue;
}
$customer = Customer::find($customerId);
if ($customer) {
$customer->pargar_account_id = (string) $accountId;
$customer->pargar_account_id = $normalizedAccountId;
$customer->save();
$log = PargarSyncLog::query()
@@ -385,7 +395,7 @@ class PargarInboundController extends Controller
->first();
if ($log) {
$this->sync()->markSuccess($log, (string) $accountId);
$this->sync()->markSuccess($log, $normalizedAccountId);
}
}
}
@@ -11,6 +11,7 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Rooyesh\Wallet\interfaces\TransactionInterface;
use Rooyesh\Wallet\interfaces\WalletInterface;
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
class paypingController extends Controller
{
@@ -80,6 +81,16 @@ class paypingController extends Controller
$finalPriseP = (int) (ceil($finalPriseP / 10) * 10);
}
// شارژ کیف (بدون سفارش): حداقل واریز از تنظیمات
if (!isset($request->order_id)) {
$minDeposit = $this->cfg()->getInt('min_deposit', 0);
if ($minDeposit > 0 && (int) $finalPriseP < $minDeposit) {
throw new UnprocessableEntityHttpException(
'حداقل مقدار واریز ' . number_format($minDeposit) . ' ریال است'
);
}
}
$Withdraw = Withdraw::create([
'customer_id' => auth('customer')->id(),
'cash' => $finalPriseP,
+17
View File
@@ -254,4 +254,21 @@ class Customer extends Authenticatable implements JWTSubject
}
}
/** کد معتبر حسابداری (پرگار/ته‌حساب) — خالی و 0 و -1 نامعتبرند */
public static function isValidAccountingCode(mixed $value): bool
{
if ($value === null) {
return false;
}
$code = trim((string) $value);
return $code !== '' && ! in_array($code, ['0', '-1'], true);
}
public function hasValidPargarAccountId(): bool
{
return self::isValidAccountingCode($this->pargar_account_id);
}
}
+3 -3
View File
@@ -61,7 +61,7 @@ class PargarSyncService
public function registerOnCreate(Customer $customer): void
{
if (! empty($customer->pargar_account_id) || ! $this->isSyncEnabled()) {
if ($customer->hasValidPargarAccountId() || ! $this->isSyncEnabled()) {
return;
}
@@ -74,7 +74,7 @@ class PargarSyncService
}
$customer = Customer::find($customerId);
if ($customer === null || ! empty($customer->pargar_account_id)) {
if ($customer === null || $customer->hasValidPargarAccountId()) {
return;
}
@@ -115,7 +115,7 @@ class PargarSyncService
{
$customer->refresh();
if (! empty($customer->pargar_account_id)) {
if ($customer->hasValidPargarAccountId()) {
return [
'ok' => true,
'message' => 'مشتری قبلاً در پرگار ثبت شده است',
+31 -18
View File
@@ -295,13 +295,13 @@ SELECT 'sse_path', '/api/price/stream', 'مسیر SSE قیمت', 0, 1, 'GET لا
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'sse_path' LIMIT 1);
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
SELECT 'tracking_systems', '[]', 'سامانه‌های ردیابی', 0, 1,
'JSON لیست آنالیتیکس — type: gtag|gtm|clarity|custom؛ id شناسه/کد؛ enabled روشن/خاموش', 'longtext'
SELECT 'tracking_systems', '[]', 'سایت‌های ری‌گیری', 1, 1,
'JSON لیست سایت‌های ری‌گیری — هر مورد: id، name، url. از منوی «سایت‌های ری‌گیری» ویرایش می‌شود.', 'longtext'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'tracking_systems' LIMIT 1);
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
SELECT 'tracking_systems_enabled', 'false', 'نمایش سامانه‌های ردیابی', 0, 1,
'روشن: اسکریپت‌های tracking_systems در اپ مشتری بارگذاری می‌شوند؛ خاموش: هیچ ردیابی فعال نیست', 'switch'
SELECT 'tracking_systems_enabled', 'false', 'نمایش سایت‌های ری‌گیری', 1, 1,
'روشن: منوی «سایت‌های ری‌گیری» در ادمین و اپ مشتری نمایش داده می‌شود. خاموش: مخفی است.', 'switch'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'tracking_systems_enabled' LIMIT 1);
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
@@ -707,6 +707,12 @@ INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `de
SELECT 'min_withdraw', '', 'حداقل برداشت (ریال)', 1, 1, NULL, 'price'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'min_withdraw' LIMIT 1);
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
SELECT 'min_deposit', '1000000', 'حداقل واریز کیف پول (ریال)', 1, 1,
'حداقل مبلغ واریز به کیف پول (ریال). مبالغ کمتر در اپ و درگاه پذیرفته نمی‌شوند.',
'price'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'min_deposit' LIMIT 1);
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
SELECT 'min_first_buy', '', 'حداقل اولین خرید (ریال)', 1, 1, NULL, 'price'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'min_first_buy' LIMIT 1);
@@ -757,7 +763,9 @@ UPDATE `settings` SET `title_fa` = 'کلید داخلی اپ' WHERE `key` = 'key
UPDATE `settings` SET `title_fa` = 'تعداد معرف برای هدیه' WHERE `key` = 'referral_count_for_gift' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `title_fa` = 'مقدار پاداش معرف' WHERE `key` = 'referral_bonus_amount' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '' OR `title_fa` = 'مبلغ پاداش معرف');
UPDATE `settings` SET `title_fa` = 'حداقل برداشت (ریال)' WHERE `key` = 'min_withdraw' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `title_fa` = 'حداقل واریز کیف پول (ریال)' WHERE `key` = 'min_deposit' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `title_fa` = 'حداقل اولین خرید (ریال)' WHERE `key` = 'min_first_buy' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `value` = '1000000' WHERE `key` = 'min_deposit' AND (`value` IS NULL OR TRIM(`value`) = '');
UPDATE `settings` SET `title_fa` = 'حداقل فروش' WHERE `key` = 'minimum_sell' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `title_fa` = 'ثبت‌نام باز' WHERE `key` = 'open_register' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `title_fa` = 'ارسال به ته‌حساب' WHERE `key` = 'send_to_tahesab' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
@@ -897,7 +905,7 @@ UPDATE `settings` SET `type` = 'switch' WHERE `key` IN (
-- price (مبالغ ریالی)
UPDATE `settings` SET `type` = 'price' WHERE `key` IN (
'fee_single', 'buy_fee', 'sell_fee',
'min_withdraw', 'min_first_buy', 'minimum_sell',
'min_withdraw', 'min_deposit', 'min_first_buy', 'minimum_sell',
'up_price', 'down_price'
);
@@ -994,8 +1002,8 @@ SELECT 'apk_download_link', '', 'لینک دانلود اپ اندروید', 0,
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'apk_download_link' LIMIT 1);
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
SELECT 'banner_enabled', 'true', 'نمایش بنرها', 0, 1,
'روشن: اسلایدر بنر صفحه اصلی در اپ کاربر نمایش داده می‌شود. خاموش: بنرها مخفی می‌مانند (محتوای بنر از پنل «بنرها» مدیریت می‌شود).', 'switch'
SELECT 'banner_enabled', 'true', 'نمایش بنرها', 1, 1,
'روشن: منوی «بنرها» در ادمین و اسلایدر صفحه اصلی اپ مشتری نمایش داده می‌شود. خاموش: مخفی است (محتوای بنر از همان منو مدیریت می‌شود).', 'switch'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'banner_enabled' LIMIT 1);
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
@@ -1225,6 +1233,7 @@ UPDATE `settings` SET
WHERE `key` = 'fee_deduct_from_gold';
UPDATE `settings` SET `description` = 'تعداد اولین سفارش‌های هر کاربر که از کارمزد معاف می‌شوند. ۰ = غیرفعال.' WHERE `key` = 'fee_free';
UPDATE `settings` SET `description` = 'حداقل مبلغ درخواست برداشت وجه (ریال). درخواست‌های کمتر رد می‌شوند.' WHERE `key` = 'min_withdraw';
UPDATE `settings` SET `description` = 'حداقل مبلغ واریز به کیف پول (ریال). مبالغ کمتر در اپ و درگاه پذیرفته نمی‌شوند.' WHERE `key` = 'min_deposit';
UPDATE `settings` SET `description` = 'حداقل مبلغ اولین خرید هر کاربر (ریال). برای فعال‌سازی کیف یا احراز سطح اول استفاده می‌شود.' WHERE `key` = 'min_first_buy';
UPDATE `settings` SET `description` = 'حداقل مقدار/مبلغ مجاز برای ثبت سفارش فروش. بسته به نوع محصول می‌تواند وزن یا ریال باشد.' WHERE `key` = 'minimum_sell';
UPDATE `settings` SET `description` = 'بیشترین قیمت ثبت‌شده در روز جاری (ریال). توسط سیستم به‌روز می‌شود؛ دستی تغییر ندهید.' WHERE `key` = 'up_price';
@@ -1265,7 +1274,7 @@ UPDATE `settings` SET `description` = 'روشن: سرویس همکار در حا
UPDATE `settings` SET `description` = 'پاسخ JSON آخرین سفارش ارسالی به همکار. برای عیب‌یابی؛ توسط سیستم پر می‌شود.' WHERE `key` = 'montzar_order_response';
UPDATE `settings` SET `description` = 'لاگ JSON آخرین محصول دریافت‌شده از API همکار. توسط سیستم پر می‌شود.' WHERE `key` = 'montzar_last_product_log';
UPDATE `settings` SET `description` = 'آدرس کامل فایل APK اندروید (https). اگر خالی باشد لینک دانلود در اپ نمایش داده نمی‌شود.' WHERE `key` = 'apk_download_link';
UPDATE `settings` SET `description` = 'روشن: اسلایدر بنر صفحه اصلی در اپ کاربر نمایش داده می‌شود. خاموش: بنرها مخفی می‌مانند (محتوای بنر از پنل «بنرها» مدیریت می‌شود).' WHERE `key` = 'banner_enabled';
UPDATE `settings` SET `description` = 'روشن: منوی «بنرها» در ادمین و اسلایدر صفحه اصلی اپ مشتری نمایش داده می‌شود. خاموش: مخفی است (محتوای بنر از همان منو مدیریت می‌شود).' WHERE `key` = 'banner_enabled';
UPDATE `settings` SET `description` = 'روشن: آیتم «مجوز ها» در منوی تنظیمات اپ خانگی (تم جدید) نمایش داده می‌شود. خاموش: مخفی است.' WHERE `key` = 'permision__enabled';
UPDATE `settings` SET `description` = 'شناسه کلاینت برای API سفارش خارجی (هدر X-Client-Id). باید با مقدار تنظیم‌شده در سرویس مقصد یکسان باشد.' WHERE `key` = 'node_client_id';
@@ -1273,8 +1282,8 @@ UPDATE `settings` SET `description` = 'کلید مشترک امضای HMAC بر
UPDATE `settings` SET `description` = 'روشن: API دریافت کیف پول و ثبت سفارش از سرویس فروشگاه خارجی فعال است. نیاز به node_client_id و node_shared_secret دارد.' WHERE `key` = 'external_order_api_enabled';
UPDATE `settings` SET `description` = 'روشن: اپ به SSE (sse_path) وصل می‌شود و last/list با payload می‌آید؛ خاموش: polling.' WHERE `key` = 'wss_enabled';
UPDATE `settings` SET `description` = 'مسیر GET لاراول برای استریم قیمت — پیش‌فرض /api/price/stream' WHERE `key` = 'sse_path';
UPDATE `settings` SET `description` = 'JSON لیست سامانه‌های آنالیتیکس — هر مورد: type (gtag|gtm|clarity|custom)، id، enabled. فقط دیپلوی.' WHERE `key` = 'tracking_systems';
UPDATE `settings` SET `description` = 'روشن: اسکریپت‌های JSON در tracking_systems در اپ مشتری بارگذاری می‌شوند؛ خاموش: هیچ سامانه ردیابی فعال نیست.' WHERE `key` = 'tracking_systems_enabled';
UPDATE `settings` SET `description` = 'JSON لیست سایت‌های ری‌گیری — هر مورد: id، name، url. از منوی «سایت‌های ری‌گیری» ویرایش می‌شود.' WHERE `key` = 'tracking_systems';
UPDATE `settings` SET `description` = 'روشن: منوی «سایت‌های ری‌گیری» در ادمین و اپ مشتری نمایش داده می‌شود. خاموش: مخفی است.' WHERE `key` = 'tracking_systems_enabled';
UPDATE `settings` SET `description` = 'نام فروشگاه که در درگاه پرداخت و رسید بانکی به کاربر نمایش داده می‌شود.' WHERE `key` = 'montify_name';
UPDATE `settings` SET `description` = 'روشن: پس از واریز/برداشت، تراکنش به سامانه حسابداری fin همگام‌سازی می‌شود.' WHERE `key` = 'payping_fin_sync_enabled';
@@ -1446,6 +1455,8 @@ UPDATE `settings` SET `title_fa` = 'محصولات متصل به کیف اصلی
UPDATE `settings` SET `title_fa` = 'عنوان فلز در UI' WHERE `key` = 'metal_type';
UPDATE `settings` SET `title_fa` = 'حداقل اولین خرید (ریال)' WHERE `key` = 'min_first_buy';
UPDATE `settings` SET `title_fa` = 'حداقل برداشت (ریال)' WHERE `key` = 'min_withdraw';
UPDATE `settings` SET `title_fa` = 'حداقل واریز کیف پول (ریال)' WHERE `key` = 'min_deposit';
UPDATE `settings` SET `can_edit` = 1 WHERE `key` = 'min_deposit';
UPDATE `settings` SET `title_fa` = 'حداقل فروش' WHERE `key` = 'minimum_sell';
UPDATE `settings` SET `title_fa` = 'نام فروشگاه در درگاه' WHERE `key` = 'montify_name';
UPDATE `settings` SET `title_fa` = 'آدرس سرور همکار' WHERE `key` = 'montzar_base_url';
@@ -1519,8 +1530,8 @@ UPDATE `settings` SET `title_fa` = 'عنوان PWA' WHERE `key` = 'title_pwa';
UPDATE `settings` SET `title_fa` = 'واحد وزن دارایی و معاملات' WHERE `key` = 'unit';
UPDATE `settings` SET `title_fa` = 'بیشترین قیمت امروز' WHERE `key` = 'up_price';
UPDATE `settings` SET `title_fa` = 'قیمت لحظه‌ای (SSE)' WHERE `key` = 'wss_enabled';
UPDATE `settings` SET `title_fa` = 'سامانه‌های ردیابی' WHERE `key` = 'tracking_systems';
UPDATE `settings` SET `title_fa` = 'نمایش سامانه‌های ردیابی' WHERE `key` = 'tracking_systems_enabled';
UPDATE `settings` SET `title_fa` = 'سایت‌های ری‌گیری' WHERE `key` = 'tracking_systems';
UPDATE `settings` SET `title_fa` = 'نمایش سایت‌های ری‌گیری' WHERE `key` = 'tracking_systems_enabled';
UPDATE `settings` SET `title_fa` = 'نمایش منوی مجوزها' WHERE `key` = 'permision__enabled';
UPDATE `settings` SET `title_fa` = 'آدرس API تابلو Zaarbox' WHERE `key` = 'zaarbox_api_url';
UPDATE `settings` SET `title_fa` = 'شناسه ردیف تابلو (key یا UUID)' WHERE `key` = 'zaarbox_price_key';
@@ -1532,7 +1543,7 @@ UPDATE `settings` SET `title_fa` = 'شناسه ردیف تابلو (key یا UUI
-- غیرقابل ویرایش در پنل (can_edit = 0)
UPDATE `settings` SET `can_edit` = 0 WHERE `key` IN (
'admin_url', 'apk_download_link', 'app_url',
'bale_bot_token', 'banner_enabled',
'bale_bot_token',
'chart_id', 'chart_use_local_data',
'external_order_api_enabled',
'fee_deduct_from_gold',
@@ -1556,14 +1567,13 @@ UPDATE `settings` SET `can_edit` = 0 WHERE `key` IN (
'price_extreme_date', 'price_provider', 'profit_gold_api_enabled',
'send_to_tahesab', 'service_charge_percentage',
'sse_path',
'tracking_systems', 'tracking_systems_enabled',
'tahesab_bank_account', 'tahesab_db', 'tahesab_host', 'tahesab_port', 'tahesab_token',
'telegram_bot_token', 'rubika_bot_token',
'price_channel_bale_to', 'price_channel_telegram_to', 'price_channel_rubika_to',
'unit',
'up_price', 'down_price',
'wss_enabled',
'zaarbox_api_url', 'zaarbox_price_key'
'zaarbox_api_url'
);
-- قابل ویرایش در پنل (can_edit = 1)
@@ -1585,7 +1595,7 @@ UPDATE `settings` SET `can_edit` = 1 WHERE `key` IN (
'invite_link_text',
'jibit_verification',
'main_product_price',
'min_first_buy', 'min_withdraw', 'minimum_sell',
'min_first_buy', 'min_withdraw', 'min_deposit', 'minimum_sell',
'montzar_mobile', 'montzar_open_buy', 'montzar_open_sell',
'montzar_password', 'montzar_price', 'montzar_product_id',
'open_register',
@@ -1598,13 +1608,16 @@ UPDATE `settings` SET `can_edit` = 1 WHERE `key` IN (
'price_channel_enabled', 'price_channel_messengers', 'price_channel_diff',
'price_channel_min_seconds', 'price_channel_message_text',
'price_channel_footer_id', 'price_channel_footer_phone',
'price_channel_footer_link', 'change_mesghal'
'price_channel_footer_link', 'change_mesghal',
'tracking_systems', 'tracking_systems_enabled',
'banner_enabled',
'zaarbox_price_key'
);
-- تفکیک نهایی type (بعد از همه batchها — override روی دیتابیس موجود)
UPDATE `settings` SET `type` = 'price' WHERE `key` IN (
'fee_single', 'buy_fee', 'sell_fee',
'min_withdraw', 'min_first_buy', 'minimum_sell',
'min_withdraw', 'min_deposit', 'min_first_buy', 'minimum_sell',
'up_price', 'down_price'
);
UPDATE `settings` SET `type` = 'number' WHERE `key` IN (
@@ -590,6 +590,12 @@ INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `de
SELECT 'min_withdraw', '', 'حداقل برداشت (ریال)', 1, 1, NULL, 'price'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'min_withdraw' LIMIT 1);
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
SELECT 'min_deposit', '1000000', 'حداقل واریز کیف پول (ریال)', 1, 1,
'حداقل مبلغ واریز به کیف پول (ریال). مبالغ کمتر در اپ و درگاه پذیرفته نمی‌شوند.',
'price'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'min_deposit' LIMIT 1);
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
SELECT 'min_first_buy', '', 'حداقل اولین خرید (ریال)', 1, 1, NULL, 'price'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'min_first_buy' LIMIT 1);
@@ -640,7 +646,9 @@ UPDATE `settings` SET `title_fa` = 'کلید داخلی اپ' WHERE `key` = 'key
UPDATE `settings` SET `title_fa` = 'تعداد معرف برای هدیه' WHERE `key` = 'referral_count_for_gift' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `title_fa` = 'مقدار پاداش معرف' WHERE `key` = 'referral_bonus_amount' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '' OR `title_fa` = 'مبلغ پاداش معرف');
UPDATE `settings` SET `title_fa` = 'حداقل برداشت (ریال)' WHERE `key` = 'min_withdraw' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `title_fa` = 'حداقل واریز کیف پول (ریال)' WHERE `key` = 'min_deposit' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `title_fa` = 'حداقل اولین خرید (ریال)' WHERE `key` = 'min_first_buy' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `value` = '1000000' WHERE `key` = 'min_deposit' AND (`value` IS NULL OR TRIM(`value`) = '');
UPDATE `settings` SET `title_fa` = 'حداقل فروش' WHERE `key` = 'minimum_sell' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `title_fa` = 'ثبت‌نام باز' WHERE `key` = 'open_register' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
UPDATE `settings` SET `title_fa` = 'ارسال به ته‌حساب' WHERE `key` = 'send_to_tahesab' AND (`title_fa` IS NULL OR TRIM(`title_fa`) = '');
@@ -778,7 +786,7 @@ UPDATE `settings` SET `type` = 'switch' WHERE `key` IN (
-- price (مبالغ ریالی)
UPDATE `settings` SET `type` = 'price' WHERE `key` IN (
'fee_single', 'buy_fee', 'sell_fee',
'min_withdraw', 'min_first_buy', 'minimum_sell',
'min_withdraw', 'min_deposit', 'min_first_buy', 'minimum_sell',
'up_price', 'down_price'
);
@@ -1129,6 +1137,7 @@ UPDATE `settings` SET
WHERE `key` = 'fee_deduct_from_gold';
UPDATE `settings` SET `description` = 'تعداد اولین سفارش‌های هر کاربر که از کارمزد معاف می‌شوند. ۰ = غیرفعال.' WHERE `key` = 'fee_free';
UPDATE `settings` SET `description` = 'حداقل مبلغ درخواست برداشت وجه (ریال). درخواست‌های کمتر رد می‌شوند.' WHERE `key` = 'min_withdraw';
UPDATE `settings` SET `description` = 'حداقل مبلغ واریز به کیف پول (ریال). مبالغ کمتر در اپ و درگاه پذیرفته نمی‌شوند.' WHERE `key` = 'min_deposit';
UPDATE `settings` SET `description` = 'حداقل مبلغ اولین خرید هر کاربر (ریال). برای فعال‌سازی کیف یا احراز سطح اول استفاده می‌شود.' WHERE `key` = 'min_first_buy';
UPDATE `settings` SET `description` = 'حداقل مقدار/مبلغ مجاز برای ثبت سفارش فروش. بسته به نوع محصول می‌تواند وزن یا ریال باشد.' WHERE `key` = 'minimum_sell';
UPDATE `settings` SET `description` = 'بیشترین قیمت ثبت‌شده در روز جاری (ریال). توسط سیستم به‌روز می‌شود؛ دستی تغییر ندهید.' WHERE `key` = 'up_price';
@@ -1269,7 +1278,7 @@ WHERE `key` IN ('text_rule', 'text_about', 'support_messenger_text', 'invite_lin
UPDATE `settings` SET `can_edit` = 0 WHERE `key` IN (
'admin_url', 'apk_download_link', 'app_url',
'bale_bot_token', 'banner_enabled',
'bale_bot_token',
'chart_id', 'chart_use_local_data',
'external_order_api_enabled',
'group_sms',
@@ -1292,13 +1301,12 @@ UPDATE `settings` SET `can_edit` = 0 WHERE `key` IN (
'price_extreme_date', 'price_provider', 'profit_gold_api_enabled',
'send_to_tahesab', 'service_charge_percentage',
'sse_path',
'tracking_systems', 'tracking_systems_enabled',
'tahesab_bank_account', 'tahesab_db', 'tahesab_host', 'tahesab_port', 'tahesab_token',
'telegram_bot_token',
'unit',
'up_price', 'down_price',
'wss_enabled',
'zaarbox_api_url', 'zaarbox_price_key'
'zaarbox_api_url'
);
UPDATE `settings` SET `can_edit` = 1 WHERE `key` IN (
@@ -1319,7 +1327,7 @@ UPDATE `settings` SET `can_edit` = 1 WHERE `key` IN (
'invite_link_text',
'jibit_verification',
'main_product_price',
'min_first_buy', 'min_withdraw', 'minimum_sell',
'min_first_buy', 'min_withdraw', 'min_deposit', 'minimum_sell',
'montzar_mobile', 'montzar_open_buy', 'montzar_open_sell',
'montzar_password', 'montzar_price', 'montzar_product_id',
'open_register',
@@ -1328,13 +1336,19 @@ UPDATE `settings` SET `can_edit` = 1 WHERE `key` IN (
'sell_fee', 'show_last_price', 'startDay',
'support_messenger', 'support_messenger_id', 'support_messenger_text',
'deposit_support_message_text', 'deposit_account_holder', 'deposit_card_number', 'deposit_sheba',
'text_about', 'text_rule'
'text_about', 'text_rule',
'tracking_systems', 'tracking_systems_enabled',
'banner_enabled',
'zaarbox_price_key'
);
UPDATE `settings` SET `can_edit` = 1 WHERE `key` = 'min_deposit';
UPDATE `settings` SET `title_fa` = 'حداقل واریز کیف پول (ریال)' WHERE `key` = 'min_deposit';
-- تفکیک نهایی type (بعد از همه batchها — override روی دیتابیس موجود)
UPDATE `settings` SET `type` = 'price' WHERE `key` IN (
'fee_single', 'buy_fee', 'sell_fee',
'min_withdraw', 'min_first_buy', 'minimum_sell',
'min_withdraw', 'min_deposit', 'min_first_buy', 'minimum_sell',
'up_price', 'down_price'
);
UPDATE `settings` SET `type` = 'number' WHERE `key` IN (
@@ -28,7 +28,7 @@ class Transaction extends Model
9 => 'سود زیر مجموعه',
10 => 'برداشت طلایی',
12 => 'برداشت وجه نقد',
22 => 'تعدیل مانده پرگار',
22 => 'تعدیل حسابداری پرگار',
];
/**