From 51153a06bcef37f945dc0f33c17cbf2bded26bb5 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 9 Nov 2024 05:36:25 -0500 Subject: [PATCH] $previous_wallet --- www-api/app/Controllers/WrenchWallet.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/www-api/app/Controllers/WrenchWallet.php b/www-api/app/Controllers/WrenchWallet.php index 9be4afba..b02d6ab0 100644 --- a/www-api/app/Controllers/WrenchWallet.php +++ b/www-api/app/Controllers/WrenchWallet.php @@ -253,15 +253,22 @@ class WrenchWallet extends BaseController $endpoint = "WALLETS-USERS-". str_replace('-','_', $in["uid"]); $out = $this->getCache($endpoint); - // if (!is_array($out) || !is_array($out['result_list']) || count($out['result_list'])==0 ){ + $previous_wallet = false; + if (is_array($out) && is_array($out['result_list']) && count($out['result_list'])>0 ){ + $previous_wallet = true; + } + + + if (!$previous_wallet){ $local_url = "http://".$this->micro_service_net1.":3037/getwallets"; $out = $this->APIcall('GET', $local_url, $in); if ( is_array($out['result_list']) && count($out['result_list']) > 0 ){ // dont cache empty + $previous_wallet = true; $this->saveCache($endpoint,$out,60); } - // } + } - if ( is_array($out) && isset($out['result_list'])){ + if ($previous_wallet){ foreach ($out['result_list'] as $index=>$item){ if ($item['code']=='USD'){ $out['result_list'][$index]['extra_actions'] = @@ -281,7 +288,7 @@ class WrenchWallet extends BaseController } } - if ( is_array($out['result_list']) && count($out["result_list"])> 0 ){ + if ( $previous_wallet ){ $owner_country = $out["result_list"][0]['owner_country']; // $wallet_country = $first_names = array_column($owner_country , 'country');; $auxWallet = $this->auxiliaryWallets($owner_country);