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 $micro_service_net1;
public $user_server_name ='';
public $allSettings = [];
/**
* Constructor.
*/
@@ -69,6 +69,7 @@ abstract class BaseController extends Controller
$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->getSettings(''); // help create all settings data
// $appConfig = config('Cache');
// $appConfig->redis['host'] = $this->getSiteConfigurations("system.cache_host");
// $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;
}
}