diff --git a/www-api/app/Controllers/WrenchWallet.php b/www-api/app/Controllers/WrenchWallet.php index 3acfbd6b..6f39850f 100644 --- a/www-api/app/Controllers/WrenchWallet.php +++ b/www-api/app/Controllers/WrenchWallet.php @@ -232,12 +232,15 @@ class WrenchWallet extends BaseController $this->saveCache($endpoint,$out,1500); } - $wallet_country = $first_names = array_column($out['result_list'], 'country');; - $auxWallet = $this->auxiliaryWallets($wallet_country); + if ( count($out["result_list"][])> 0 ){ + $owner_country = $out["result_list"][0]['owner_country']; + $wallet_country = $first_names = array_column($owner_country , 'country');; + $auxWallet = $this->auxiliaryWallets($wallet_country); + foreach ($auxWallet as $item){ + $out["result_list"][] = $item; + } + } - foreach ($auxWallet as $item){ - $out["result_list"][] = $item; - } /* $out["result_list"][] = [ "wallet_country" => ['US'], @@ -305,8 +308,7 @@ class WrenchWallet extends BaseController return $this->respond( $this->summaryReturnData($in,$out), 200); } - private function auxiliaryWallets($wallet_country): array { - + private function auxiliaryWallets( $owner_country ): array { $auxWallet = [ [ "wallet_country" => ['US'], @@ -372,7 +374,7 @@ class WrenchWallet extends BaseController $retArr=[]; foreach ( $auxWallet as $item){ - if ( in_array( $item['owner_country'], $item['wallet_country']) ){ + if ( in_array( $owner_country, $item['wallet_country']) ){ log_message('critical', "***** ***** auxiliaryWallets::ITEM ". serialize($item)); $retArr[] =$item; }