product time changed 3

This commit is contained in:
2026-07-02 20:59:26 +03:30
parent 5a568f971d
commit 4b73860adc
2 changed files with 58 additions and 0 deletions
@@ -782,6 +782,9 @@ class WalletController extends Controller
$row['type_str'] = 'برداشت طلایی';
}
$this->normalizeApiRelationStsStr($row, 'order', Order::$STS);
$this->normalizeApiRelationStsStr($row, 'withdraw', Withdraw::$STS);
$out[] = $row;
}
@@ -868,4 +871,32 @@ class WalletController extends Controller
return $previousTx ? (int) $previousTx->balance_cash : null;
}
private function normalizeApiRelationStsStr(array &$row, string $key, array $stsMap): void
{
if (empty($row[$key]) || !is_array($row[$key])) {
return;
}
$relation = &$row[$key];
$sts = $relation['sts'] ?? null;
if ($sts === null && isset($relation['sts_str']) && is_numeric($relation['sts_str'])) {
$sts = (int) $relation['sts_str'];
}
if ($sts !== null && isset($stsMap[$sts])) {
$relation['sts_str'] = $stsMap[$sts];
return;
}
$current = trim((string) ($relation['sts_str'] ?? ''));
if ($current !== '' && $current !== 'بدون مقدار') {
return;
}
if ($key === 'order' && (int) ($relation['payment_sts'] ?? 0) === 4) {
$relation['sts_str'] = 'موفق';
}
}
}