diff --git a/www-api/app/Controllers/WrenchBanners.php b/www-api/app/Controllers/WrenchBanners.php index 8c36efe5..fa4dab4b 100644 --- a/www-api/app/Controllers/WrenchBanners.php +++ b/www-api/app/Controllers/WrenchBanners.php @@ -84,34 +84,43 @@ class WrenchBanners extends BaseController $in = json_decode($raw_json, true); $out =[]; $in["action"] = WRENCHBOARD_ACCOUNT_HOMEBANNERS; - if (isset($in["uuid"]) && $in["uuid"] !='' ){ - $in["uid"]=$in["uuid"]; - } - $in["nocache"] = $in["nocache"] ?? false; - $endpoint = "ACCOUNT-HOMEBANNERS-".str_replace("-", "_", $in["uid"]); - if ($in["nocache"]) $this->deleteCache($endpoint); + try{ - $out = $this->getCache($endpoint); // try find in cache - $previous_banners = false; - if (is_array($out) && count($out)> 0 /*&& is_array($out['result_list']) && count($out['result_list'])>0*/ ){ - $previous_banners = true; - } + if (isset($in["uuid"]) && $in["uuid"] !='' ){ + $in["uid"]=$in["uuid"]; + } + $in["nocache"] = $in["nocache"] ?? false; + $endpoint = "ACCOUNT-HOMEBANNERS-".str_replace("-", "_", $in["uid"]); + if ($in["nocache"]) $this->deleteCache($endpoint); - if ( !$previous_banners ){ - $ret = $this->wrenchboard->wrenchboard_api($in, $out); - $out['internal_return'] = $ret; - log_message('critical', "usersBanners ********* ALL ".serialize($out) ); - // dont cache junks - if (is_array($out) /* && is_array($out['result_list']) && count($out['result_list'])>0 */) { - $this->saveCache($endpoint, $out, 1500); + $out = $this->getCache($endpoint); // try find in cache + $previous_banners = false; + if (is_array($out) && count($out)> 0 /*&& is_array($out['result_list']) && count($out['result_list'])>0*/ ){ $previous_banners = true; } + + + if ( !$previous_banners ){ + $ret = $this->wrenchboard->wrenchboard_api($in, $out); + $out['internal_return'] = $ret; + log_message('critical', "usersBanners ********* ALL ".serialize($out) ); + // dont cache junks + if (is_array($out) /* && is_array($out['result_list']) && count($out['result_list'])>0 */) { + $this->saveCache($endpoint, $out, 1500); + $previous_banners = true; + } + } + + $extra_out["offers_list"] = $this->bannerGetOffers($in); + $extra_out["activetaskslist"] = $this->bannerGetActiveTasks($in); + + } catch (Exception $e) { + $errMsg = ' BANNER DATA ERROR **** Caught exception: '. $e->getMessage(); + log_message('critical', $errMsg); } - $extra_out["offers_list"] = $this->bannerGetOffers($in); - $extra_out["activetaskslist"] = $this->bannerGetActiveTasks($in); return $this->summaryReturnData($in,$out, $extra_out); //json_encode( $final_out ); } diff --git a/www-api/app/Controllers/WrenchJobs.php b/www-api/app/Controllers/WrenchJobs.php index a235c926..927ec946 100644 --- a/www-api/app/Controllers/WrenchJobs.php +++ b/www-api/app/Controllers/WrenchJobs.php @@ -116,7 +116,8 @@ class WrenchJobs extends BaseController $out["interest_list"] = ( isset($int_list) && is_array($int_list) ) ? $int_list : []; } catch (Exception $e) { - echo 'Caught exception: ', $e->getMessage(), "\n"; + $errMsg = ' JOB DATA ERROR **** Caught exception: '. $e->getMessage(); + log_message('critical', $errMsg); } log_message('critical', "END ***** ***** WrenchJobs::getJobsData Ret "); return $this->respond( $this->summaryReturnData($in,$out), 200);