fix table bug
This commit is contained in:
@@ -16,6 +16,7 @@ use \App\Http\Controllers\Customer\FundController;
|
||||
use App\Http\Controllers\Site\ReportController;
|
||||
use App\Services\ConfigService;
|
||||
use App\Services\ProductPriceService;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
|
||||
class ProductController extends SuperController
|
||||
@@ -46,11 +47,17 @@ class ProductController extends SuperController
|
||||
->initSearch($this->search)
|
||||
->select($this->select)
|
||||
->export($query_table);
|
||||
$query_table['auto_open_at'] = Product::selectRaw(
|
||||
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_open_at)))) as avg_time'
|
||||
)->value('avg_time'); $query_table['auto_close_at'] = Product::selectRaw(
|
||||
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_close_at)))) as avg_time'
|
||||
)->value('avg_time');
|
||||
|
||||
if (Schema::hasColumn((new Product)->getTable(), 'auto_open_at')) {
|
||||
$query_table['auto_open_at'] = Product::selectRaw(
|
||||
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_open_at)))) as avg_time'
|
||||
)->value('avg_time');
|
||||
}
|
||||
if (Schema::hasColumn((new Product)->getTable(), 'auto_close_at')) {
|
||||
$query_table['auto_close_at'] = Product::selectRaw(
|
||||
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_close_at)))) as avg_time'
|
||||
)->value('avg_time');
|
||||
}
|
||||
|
||||
// $query_table['11'] = $avgDuration;
|
||||
// $query_table['11'] = Product::avg('auto_open_at');
|
||||
|
||||
@@ -70,15 +70,13 @@ class SingleOrderController extends Controller
|
||||
$data['all_price'] = $latestPrice;
|
||||
$data['price'] = $latestPrice->price;
|
||||
$data['price_id'] = $latestPrice->id;
|
||||
// $data['difference'] = config('fee.cash');
|
||||
$feeCash = Setting::where('key', 'fee_cash')->first();
|
||||
$feeServiceCharge = Setting::where('key', 'fee_service_charge_percentage')->first();
|
||||
if (!$feeCash || !$feeServiceCharge) {
|
||||
throw new UnprocessableEntityHttpException('تنظیمات کارمزد یافت نشد.');
|
||||
}
|
||||
$data['difference'] = $feeCash->value;
|
||||
// $data['service_charge_percentage'] = config('fee.service_charge_percentage');
|
||||
$data['service_charge_percentage'] = $feeServiceCharge->value;
|
||||
$data['difference'] = (float) $feeCash->value;
|
||||
$data['service_charge_percentage'] = (float) $feeServiceCharge->value;
|
||||
|
||||
$fee_free = Setting::where('key', 'fee_free')->where('is_active', true)->value('value');
|
||||
|
||||
@@ -151,12 +149,20 @@ class SingleOrderController extends Controller
|
||||
} else {
|
||||
// Calculate total price and fee for non-product (gold) transaction
|
||||
$data['total_price_original'] = $data['amount'] * ($data['price_original'] ?? 0);
|
||||
$data['total_fee'] = $data['amount'] * $data['difference'];
|
||||
$mainProductId = Cnt::where('key', 'main_product')->value('value');
|
||||
$data['product'] = $mainProductId ? Product::find($mainProductId) : null;
|
||||
$productId = $data['abshode_id'] ?? $data['product_id'] ?? $mainProductId;
|
||||
$data['product'] = $productId ? Product::find($productId) : null;
|
||||
if (!$data['product']) {
|
||||
throw new UnprocessableEntityHttpException('محصول آبشده یافت نشد.');
|
||||
}
|
||||
if ($data['direction'] == 1) {
|
||||
$data['difference'] = $data['product']['cash_fee_buy'];
|
||||
$data['service_charge_percentage'] = $data['product']['percent_fee_buy'];
|
||||
} elseif ($data['direction'] == 2) {
|
||||
$data['difference'] = $data['product']['cash_fee_sell'];
|
||||
$data['service_charge_percentage'] = $data['product']['percent_fee_sell'];
|
||||
}
|
||||
$data['total_fee'] = $data['amount'] * $data['difference'];
|
||||
$data['product_id'] = $data['product']->id;
|
||||
// Check if the user wants to buy
|
||||
if ($data['direction'] == 1) {
|
||||
@@ -172,7 +178,7 @@ class SingleOrderController extends Controller
|
||||
$response['sell'] = $this->processSellTransaction($data, $wallet, $wallet_interface);
|
||||
}
|
||||
}
|
||||
if (Setting::where('key', 'send_to_tahesab')->first()->value == "true") {
|
||||
if ($config->getString('send_to_tahesab', 'false') === 'true') {
|
||||
try {
|
||||
$tahesab = new TahesabController();
|
||||
$data['tahesab'] = $tahesab->storeTrade($data);
|
||||
|
||||
@@ -232,9 +232,11 @@ class ReportController extends Controller
|
||||
| اتحادیه (گلد علی / refPricer) — فقط وقتی price_provider=etehadie
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
$etehadie_order_price = 0;
|
||||
if ($priceProvider === 'etehadie' && !$closed) {
|
||||
$etehadie = app(EtehadiePriceService::class)->fetchMainGramPrice();
|
||||
$etehadie_teh = (int) ($etehadie['price'] ?? 0);
|
||||
$etehadie_order_price = (int) ($etehadie['order_price'] ?? 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -422,15 +424,20 @@ class ReportController extends Controller
|
||||
| ذخیره قیمت
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
$priceToStore = $priceValue;
|
||||
if ($priceProvider === 'etehadie' && $etehadie_order_price > 0) {
|
||||
$priceToStore = $etehadie_order_price;
|
||||
}
|
||||
|
||||
$lastPrice = Price::latest()->first();
|
||||
|
||||
if (
|
||||
!$closed &&
|
||||
(!$lastPrice || (float) $lastPrice->price != (float) $priceValue) &&
|
||||
$priceValue > 30000000
|
||||
(!$lastPrice || (float) $lastPrice->price != (float) $priceToStore) &&
|
||||
$priceToStore > 30000000
|
||||
) {
|
||||
$price = new Price();
|
||||
$price->price = $priceValue;
|
||||
$price->price = $priceToStore;
|
||||
$price->time_at = Carbon::now()->toTimeString();
|
||||
$price->date_at = Carbon::now()->toDateString();
|
||||
$price->save();
|
||||
@@ -440,24 +447,26 @@ class ReportController extends Controller
|
||||
$candle = PriceCandle::whereDate('date_at', date("Y-m-d"))->first();
|
||||
|
||||
if (!is_null($candle)) {
|
||||
$candle->end = $priceValue;
|
||||
$candle->end = $priceToStore;
|
||||
|
||||
if ($priceValue < $candle->low) {
|
||||
$candle->low = $priceValue;
|
||||
} elseif ($priceValue > $candle->high) {
|
||||
$candle->high = $priceValue;
|
||||
if ($priceToStore < $candle->low) {
|
||||
$candle->low = $priceToStore;
|
||||
} elseif ($priceToStore > $candle->high) {
|
||||
$candle->high = $priceToStore;
|
||||
}
|
||||
|
||||
$candle->save();
|
||||
} else {
|
||||
PriceCandle::create([
|
||||
'start' => $priceValue,
|
||||
'end' => $priceValue,
|
||||
'high' => $priceValue,
|
||||
'low' => $priceValue,
|
||||
'start' => $priceToStore,
|
||||
'end' => $priceToStore,
|
||||
'high' => $priceToStore,
|
||||
'low' => $priceToStore,
|
||||
'date_at' => date('Y-m-d'),
|
||||
]);
|
||||
}
|
||||
|
||||
$lastPrice = $price;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -492,6 +501,21 @@ class ReportController extends Controller
|
||||
$priceLast = ceil($priceValue + $difference);
|
||||
}
|
||||
|
||||
/*
|
||||
| گلد علی (etehadie): سفارش از Price::latest() میخواند؛
|
||||
| buy/sell/price_last هم از همان ردیف (مثل goldAliii قبل از مرج).
|
||||
| etehadie_teh فقط در فیلد price / etehadie_teh میماند.
|
||||
*/
|
||||
if ($priceProvider === 'etehadie' && !$closed) {
|
||||
$storedPrice = $lastPrice ?? Price::latest()->first();
|
||||
if ($storedPrice && (float) $storedPrice->price > 0) {
|
||||
$base = (float) $storedPrice->price;
|
||||
$sell = $open_sell ? (int) ceil($base - $difference) : 0;
|
||||
$buy = $open_buy ? (int) ceil($base + $difference) : 0;
|
||||
$priceLast = (int) ceil($base + $difference);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$closed && $priceValue > 0) {
|
||||
$config->trackDailyPriceExtreme((float) $priceValue);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class EtehadiePriceService
|
||||
public function fetchMainGramPrice(): array
|
||||
{
|
||||
if (!$this->isEnabled() && $this->priceKey() === '') {
|
||||
return ['price' => 0, 'raw' => null];
|
||||
return ['price' => 0, 'order_price' => 0, 'raw' => null];
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -53,7 +53,7 @@ class EtehadiePriceService
|
||||
->json();
|
||||
|
||||
if (!is_array($prices)) {
|
||||
return ['price' => 0, 'raw' => null];
|
||||
return ['price' => 0, 'order_price' => 0, 'raw' => null];
|
||||
}
|
||||
|
||||
$key = $this->priceKey();
|
||||
@@ -63,18 +63,20 @@ class EtehadiePriceService
|
||||
: $collection->first();
|
||||
|
||||
if (empty($row)) {
|
||||
return ['price' => 0, 'raw' => null];
|
||||
return ['price' => 0, 'order_price' => 0, 'raw' => null];
|
||||
}
|
||||
|
||||
$base = (float) ($row['price'] ?? 0);
|
||||
$profit = (float) ($row['profit'] ?? 0);
|
||||
$gramPrice = (int) round($base / 10 + $profit);
|
||||
// همان مقیاسی که سفارش/جدول prices گلد علی استفاده میکند (base + profit)
|
||||
$orderPrice = (int) round($base + $profit);
|
||||
|
||||
return ['price' => $gramPrice, 'raw' => $row];
|
||||
return ['price' => $gramPrice, 'order_price' => $orderPrice, 'raw' => $row];
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('Etehadie price fetch failed', ['message' => $e->getMessage()]);
|
||||
|
||||
return ['price' => 0, 'raw' => null];
|
||||
return ['price' => 0, 'order_price' => 0, 'raw' => null];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,5 +4,5 @@ return [
|
||||
'service_charge_percentage' => 0.01,
|
||||
'gold' => 0.01,
|
||||
'single' => 500000,
|
||||
'major' => 500000
|
||||
'major' => 500000,
|
||||
];
|
||||
|
||||
@@ -72,4 +72,16 @@ INSERT INTO `const` (`key`, `value`, `title_fa`)
|
||||
SELECT 'app_closed', 'false', 'بسته بودن اپ'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'app_closed' LIMIT 1);
|
||||
|
||||
-- کارمزد سفارش (مثل config/fee.php برنچ goldAliii — نه fee_single نمایش قیمت)
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'fee_cash', '0', 'اختلاف ریالی هر گرم (سفارش)', 1, 1, 'گلد علی: 0'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'fee_cash' LIMIT 1);
|
||||
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'fee_service_charge_percentage', '0.02', 'درصد کارمزد سفارش', 1, 1, 'همتراز percent_fee_buy'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'fee_service_charge_percentage' LIMIT 1);
|
||||
|
||||
UPDATE `settings` SET `value` = '0' WHERE `key` = 'fee_cash';
|
||||
UPDATE `settings` SET `value` = '0.02' WHERE `key` = 'fee_service_charge_percentage';
|
||||
|
||||
COMMIT;
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
-- =============================================================================
|
||||
-- گلد علی — تنظیم دیتابیس برای سرور برنچ Abshode_Khanegi (بدون تغییر کد per-client)
|
||||
--
|
||||
-- یک بار بعد از deploy: بکاپ بگیرید، USE دیتابیس گلد علی، این فایل را اجرا کنید.
|
||||
-- جدول const اگر نامش cnt است، در پایین فایل جایگزین کنید.
|
||||
-- =============================================================================
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- ۱) قیمت — منبع اتحادیه (مثل goldAliii + price_method قبلی)
|
||||
-- -----------------------------------------------------------------------------
|
||||
UPDATE `settings` SET `value` = 'etehadie' WHERE `key` = 'price_provider';
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'price_provider', 'etehadie', 'منبع قیمت', 1, 1, 'montzar|etehadie|...'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'price_provider' LIMIT 1);
|
||||
-- price_method را عوض نکنید (همان estjt_... گلد علی)
|
||||
|
||||
-- نمایش buy/sell در /api/price/last (ریال — جدا از کارمزد سفارش)
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'fee_single', '500000', 'اختلاف قیمت نمایش', 1, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'fee_single' LIMIT 1);
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'buy_fee', '500000', 'اختلاف خرید نمایش', 1, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'buy_fee' LIMIT 1);
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'sell_fee', '500000', 'اختلاف فروش نمایش', 1, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'sell_fee' LIMIT 1);
|
||||
UPDATE `settings` SET `value` = '500000' WHERE `key` IN ('fee_single', 'buy_fee', 'sell_fee');
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- ۲) کارمزد سفارش — مثل config/fee.php برنچ goldAliii (اجباری برای /customer/single/order)
|
||||
-- -----------------------------------------------------------------------------
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'fee_cash', '0', 'اختلاف ریالی هر گرم (سفارش)', 1, 1, 'goldAliii: 0'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'fee_cash' LIMIT 1);
|
||||
-- مثل محصول ۱۳ (percent_fee_buy=0.02) — نه 0.07؛ سفارشهای قدیمی موفق هم 0.02 بودند
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'fee_service_charge_percentage', '0.02', 'درصد کارمزد سفارش', 1, 1, 'همتراز percent_fee_buy محصول'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'fee_service_charge_percentage' LIMIT 1);
|
||||
UPDATE `settings` SET `value` = '0' WHERE `key` = 'fee_cash';
|
||||
UPDATE `settings` SET `value` = '0.02' WHERE `key` = 'fee_service_charge_percentage';
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- ۳) ثبتنام / معرف / APIها
|
||||
-- -----------------------------------------------------------------------------
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'referral_id', 'required', 'الزام کد معرف', 0, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'referral_id' LIMIT 1);
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'open_register', '1', 'ثبتنام باز', 1, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'open_register' LIMIT 1);
|
||||
UPDATE `settings` SET `is_active` = 1 WHERE `key` = 'open_register';
|
||||
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'profit_gold_api_enabled', 'true', 'API سود طلا', 0, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'profit_gold_api_enabled' LIMIT 1);
|
||||
UPDATE `settings` SET `value` = 'true' WHERE `key` = 'profit_gold_api_enabled';
|
||||
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'balance_report_exclude_customer_id', '12', 'حذف مشتری از تراز ادمین', 0, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'balance_report_exclude_customer_id' LIMIT 1);
|
||||
UPDATE `settings` SET `value` = '12' WHERE `key` = 'balance_report_exclude_customer_id';
|
||||
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'send_to_tahesab', 'false', 'ارسال تهحساب', 0, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'send_to_tahesab' LIMIT 1);
|
||||
UPDATE `settings` SET `value` = 'false' WHERE `key` = 'send_to_tahesab';
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- ۴) درگاه payment.goldaliii.com
|
||||
-- -----------------------------------------------------------------------------
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'payping_start_url', 'https://payment.goldaliii.com/payment/start', 'شروع درگاه', 1, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_start_url' LIMIT 1);
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'payping_verify_url', 'https://payment.goldaliii.com/payment/verify', 'تأیید درگاه', 1, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_verify_url' LIMIT 1);
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'payping_gateway_name', 'sepal', 'gateway', 1, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_gateway_name' LIMIT 1);
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'payping_gateway_items', 'sDsB,gp1Q,GPH4,AMAX,TbQl,AAQl', 'item چرخشی', 1, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_gateway_items' LIMIT 1);
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'payping_round_toman', 'true', 'گرد تومان', 0, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_round_toman' LIMIT 1);
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'payping_strict_failed_withdraw', 'true', 'اولویت ناموفق', 0, 1, NULL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_strict_failed_withdraw' LIMIT 1);
|
||||
UPDATE `settings` SET `value` = 'https://payment.goldaliii.com/payment/start' WHERE `key` = 'payping_start_url';
|
||||
UPDATE `settings` SET `value` = 'https://payment.goldaliii.com/payment/verify' WHERE `key` = 'payping_verify_url';
|
||||
UPDATE `settings` SET `value` = 'sepal' WHERE `key` = 'payping_gateway_name';
|
||||
UPDATE `settings` SET `value` = 'sDsB,gp1Q,GPH4,AMAX,TbQl,AAQl' WHERE `key` = 'payping_gateway_items';
|
||||
UPDATE `settings` SET `value` = 'true' WHERE `key` IN ('payping_round_toman', 'payping_strict_failed_withdraw');
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- ۵) const — محصول آبشده پیشفرض (قبلاً abshode_id=13 در کد بود)
|
||||
-- -----------------------------------------------------------------------------
|
||||
INSERT INTO `const` (`key`, `value`, `title_fa`)
|
||||
SELECT 'main_product', '13', 'محصول آبشده پیشفرض'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'main_product' LIMIT 1);
|
||||
UPDATE `const` SET `value` = '13' WHERE `key` = 'main_product';
|
||||
|
||||
INSERT INTO `const` (`key`, `value`, `title_fa`)
|
||||
SELECT 'is_gateway_open', '1', 'باز بودن درگاه'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'is_gateway_open' LIMIT 1);
|
||||
INSERT INTO `const` (`key`, `value`, `title_fa`)
|
||||
SELECT 'app_closed', 'false', 'بسته بودن اپ'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'app_closed' LIMIT 1);
|
||||
INSERT INTO `const` (`key`, `value`, `title_fa`)
|
||||
SELECT 'limited_price', '0', 'سقف قیمت'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'limited_price' LIMIT 1);
|
||||
INSERT INTO `const` (`key`, `value`, `title_fa`)
|
||||
SELECT 'header_banner', '', 'بنر'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'header_banner' LIMIT 1);
|
||||
INSERT INTO `const` (`key`, `value`, `title_fa`)
|
||||
SELECT 'gram', '1', 'گرم ثبتنام'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'gram' LIMIT 1);
|
||||
INSERT INTO `const` (`key`, `value`, `title_fa`)
|
||||
SELECT 'first_customer_wallet_value', '0', 'حداقل اولین خرید'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'first_customer_wallet_value' LIMIT 1);
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- ۶) اختیاری — حذف کلیدهای legacy (بعد از تست)
|
||||
-- فایل جدا: goldali_cleanup_legacy_keys.sql
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
-- اگر مبلغ سفارش ~۱۰ برابر اپ است، آخرین قیمت جدول prices غلط/قدیمی است:
|
||||
-- SELECT id, price, created_at FROM prices ORDER BY id DESC LIMIT 5;
|
||||
-- بعد deploy: GET /api/price/last — buy/sell از prices (مثل سفارش)؛ API خام در prices ذخیره میشود.
|
||||
|
||||
-- بررسی:
|
||||
-- SELECT `key`, `value` FROM `settings` WHERE `key` IN (
|
||||
-- 'price_provider','price_method','fee_cash','fee_service_charge_percentage',
|
||||
-- 'fee_single','payping_start_url','profit_gold_api_enabled'
|
||||
-- );
|
||||
-- SELECT `key`, `value` FROM `const` WHERE `key` IN ('main_product','is_gateway_open');
|
||||
@@ -0,0 +1,16 @@
|
||||
-- کارمزد سفارش گلد علی (جدا از fee_single نمایش قیمت در /api/price/last)
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'fee_cash', '0', 'اختلاف ریالی هر گرم (سفارش)', 1, 1, 'مثل goldAliii config/fee.cash'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'fee_cash' LIMIT 1);
|
||||
|
||||
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
|
||||
SELECT 'fee_service_charge_percentage', '0.02', 'درصد کارمزد سفارش', 1, 1, 'همتراز percent_fee_buy محصول ۱۳'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'fee_service_charge_percentage' LIMIT 1);
|
||||
|
||||
UPDATE `settings` SET `value` = '0' WHERE `key` = 'fee_cash';
|
||||
UPDATE `settings` SET `value` = '0.02' WHERE `key` = 'fee_service_charge_percentage';
|
||||
|
||||
COMMIT;
|
||||
+1
-1
@@ -39,7 +39,7 @@ Route::middleware('auth:user')->group(function (){
|
||||
//------------PriceTrigger
|
||||
Route::post('price_triggers/table', [PriceTriggerController::class, 'table']);
|
||||
//-----------product
|
||||
Route::post('/product/table',[ProductController::class, 'tableProduct']);
|
||||
Route::post('/product/table', [ProductController::class, 'tableProduct']);
|
||||
Route::get('/product/active/{id}',[ProductController::class, 'active']);
|
||||
Route::get('/product/hide/{id}',[ProductController::class, 'hide']);
|
||||
Route::get('/product/credit',[ProductController::class, 'listProductCredit']);
|
||||
|
||||
Reference in New Issue
Block a user