fix(ns): class_exists() must use FQCN after PSR-4

Bare class_exists('Balance') looks up global Balance, always false
under AKSRT\* namespaces → REST 403 on balance exchange and friends.
Rewrite string checks to AKSRT\{Domain}\{Class}.
This commit is contained in:
kate522 committed 2026-07-17 15:40:20 +08:00
1 parent d55d1c6b62
commit 68d2e78d77
40 files changed
+105 -105

No files matched your search

+3 -3
View File
@@ -32,7 +32,7 @@ trait BalanceServiceCharge {
// Points purchase fulfill (zibll order_type=9).
if ($type === \AKSRT\Core\DomainModel::ORDER_PRODUCT_POINTS_BUY) {
if (!class_exists('Credits')) {
if (!class_exists('AKSRT\\Credits\\Credits')) {
return;
}
$note = json_decode((string) ($order['note'] ?? ''), true);
@@ -78,7 +78,7 @@ trait BalanceServiceCharge {
if ($type !== \AKSRT\Core\DomainModel::ORDER_PRODUCT_RECHARGE) {
return;
}
if (!class_exists('Balance')) {
if (!class_exists('AKSRT\\Credits\\Balance')) {
return;
}
$note = json_decode((string) ($order['note'] ?? ''), true);
@@ -140,7 +140,7 @@ trait BalanceServiceCharge {
return [
'enabled' => !empty($cfg['enabled']),
'desc' => (string) ($cfg['desc'] ?? ''),
'wallet' => class_exists('Balance') ? Balance::balance($user_id) : 0.0,
'wallet' => class_exists('AKSRT\\Credits\\Balance') ? Balance::balance($user_id) : 0.0,
'packages' => $packages,
'custom_s' => $custom_s,
'custom_limit' => $custom_limit,