All status

This commit is contained in:
CHIEFSOFT\ameye
2024-10-27 17:28:30 -04:00
parent e4ea1c8564
commit 3df121ff25
2 changed files with 41 additions and 20 deletions
+22 -1
View File
@@ -49,7 +49,7 @@ abstract class BaseController extends Controller
public $wrenchboard=null; public $wrenchboard=null;
public $micro_service_net1; public $micro_service_net1;
public $user_server_name =''; public $user_server_name ='';
public $allSettings = [];
/** /**
* Constructor. * Constructor.
*/ */
@@ -69,6 +69,7 @@ abstract class BaseController extends Controller
$this->micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.1 $this->micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.1
$this->user_server_name = $this->getSiteConfigurations("system.server_name"); // 'https://dev-users.wrenchboard.com'; $this->user_server_name = $this->getSiteConfigurations("system.server_name"); // 'https://dev-users.wrenchboard.com';
$this->getSettings(''); // help create all settings data
// $appConfig = config('Cache'); // $appConfig = config('Cache');
// $appConfig->redis['host'] = $this->getSiteConfigurations("system.cache_host"); // $appConfig->redis['host'] = $this->getSiteConfigurations("system.cache_host");
// $this->cache_server = cache()->initialize($appConfig); // $this->cache_server = cache()->initialize($appConfig);
@@ -600,4 +601,24 @@ wrenchboard=#
} }
protected function getSettings($settingkey, $defaultVal=''){
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$out=[];
$endpoint = "SETTINGS";
$out = $this->getCache($endpoint);
if (!is_array($out) || count($out)==0 ) {
$local_url = "http://".$this->micro_service_net1.":3037/settings";
$out = $this->APIcall('GET', $local_url, $in);
if (count($out['result_list']) > 0 ){ // dont cache empty
$this->saveCache($endpoint,$out,55500);
}
}
if (is_array($out) && count($out['result_list']) > 0 ) {
$this->allSettings = $out['result_list'];
return (isset($out['result_list'][$settingkey])) ? $out['result_list'][$settingkey]: $defaultVal;
}
return $defaultVal;
}
} }
+19 -19
View File
@@ -178,25 +178,25 @@ class WrenchWallet extends BaseController
return json_encode( $final_out ); return json_encode( $final_out );
} }
private function getSettings($settingkey, $defaultVal=''){ // private function getSettings($settingkey, $defaultVal=''){
$raw_json = file_get_contents('php://input'); // $raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true); // $in = json_decode($raw_json, true);
$out=[]; // $out=[];
$endpoint = "SETTINGS"; // $endpoint = "SETTINGS";
$out = $this->getCache($endpoint); // $out = $this->getCache($endpoint);
if (!is_array($out) || count($out)==0 ) { // if (!is_array($out) || count($out)==0 ) {
$local_url = "http://".$this->micro_service_net1.":3037/settings"; // $local_url = "http://".$this->micro_service_net1.":3037/settings";
$out = $this->APIcall('GET', $local_url, $in); // $out = $this->APIcall('GET', $local_url, $in);
if (count($out['result_list']) > 0 ){ // dont cache empty // if (count($out['result_list']) > 0 ){ // dont cache empty
$this->saveCache($endpoint,$out,55500); // $this->saveCache($endpoint,$out,55500);
} // }
} // }
//
if (is_array($out) && count($out['result_list']) > 0 ) { // if (is_array($out) && count($out['result_list']) > 0 ) {
return (isset($out['result_list'][$settingkey])) ? $out['result_list'][$settingkey]: $defaultVal; // return (isset($out['result_list'][$settingkey])) ? $out['result_list'][$settingkey]: $defaultVal;
} // }
return $defaultVal; // return $defaultVal;
} // }
//getKidWallet from parent side //getKidWallet from parent side
public function getKidWallet(){ public function getKidWallet(){
log_message('critical', "0001"); log_message('critical', "0001");