diff --git a/www-api/app/Controllers/WrenchJobs.php b/www-api/app/Controllers/WrenchJobs.php index e32e0047..9f54f4e8 100644 --- a/www-api/app/Controllers/WrenchJobs.php +++ b/www-api/app/Controllers/WrenchJobs.php @@ -45,12 +45,23 @@ class WrenchJobs extends BaseController } return $ret; } + + private function refreshJobsData(){ + $endpoint = $endpoint = "MARKET_JOB_DATA"; + $local_url = "http://".$this->micro_service_net1.":3033/marketjobs"; + $out = $this->APIcall('GET', $local_url, $in); + // dont cache junk + if ( is_array($out) && is_array($out["result_list"]) && count($out["result_list"]) > 0){ + $this->saveCache($endpoint,$out,180); + } + } public function getJobsData() { $raw_json = file_get_contents('php://input'); $in = json_decode($raw_json, true); $in["action"] = -1; // bad number - we dont want formating WRENCHBOARD_ACCOUNT_JOBLIST; dont send this line , the formater will be confused $out=[]; - $endpoint = "JOB_DATA-". $in["uid"]; + //$endpoint = "JOB_DATA-". $in["uid"]; + $endpoint = "MARKET_JOB_DATA"; $out = $this->getCache($endpoint); $countItem = 0; @@ -163,6 +174,7 @@ class WrenchJobs extends BaseController $out['internal_return'] = $ret; log_message('critical', "***** ***** WrenchJobs::assignTask Ret = ".$ret ); if ( isset($out['internal_return']) && isset( $out['offer_code']) ){ + $this->refreshJobsData(); $endpoint = "NEW_OFFER_".$in["assign_mode"]."-". $out["offer_code"]; log_message('critical', "***** ***** WrenchJobs::assignTask NEW_OFFER_ = ".$endpoint ); $this->saveCache($endpoint,$out,25000);