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
@@ -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);
}
}
}