From be7cd8f62ec7eb3924771ec4256b937926d925c7 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Wed, 18 Sep 2024 09:48:32 -0400 Subject: [PATCH] promot jobs --- www-api/app/Controllers/Promo.php | 33 ++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/www-api/app/Controllers/Promo.php b/www-api/app/Controllers/Promo.php index f51d8490..298844b9 100644 --- a/www-api/app/Controllers/Promo.php +++ b/www-api/app/Controllers/Promo.php @@ -37,14 +37,33 @@ class Promo extends BaseController $raw_json = file_get_contents('php://input'); $in = json_decode($raw_json, true); - $out =[]; + $in["action"] = -1; // bad number - we dont want formating WRENCHBOARD_ACCOUNT_JOBLIST; dont send this line , the formater will be confused + $out=[]; + $endpoint = "PROMO_JOBS-". $in["promo"]; - log_message('critical', "promoTask::promoStart ********* ALL ".serialize($in) ); - $in["loc"] = $_SERVER["REMOTE_ADDR"]; - // $in['action'] = WRENCHBOARD_MARKET_PLAN01_START; - $in['limit'] = 10; - // $ret['WRENCHBOARD_MARKET_PLAN01_START'] = (new \App\Models\BackendModel())->wrenchboard_api($in, $out); - return []; //json_encode( $final_out ); + $out = $this->getCache($endpoint); + $countItem = 0; + if( is_array($out)){ + $countItem = count($out); + } + + if ( $countItem == 0 ){ + $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,3000); + } + $out['internal_return'] = 0; // just backwad comaptobility + log_message('critical', "***** ***** WrenchJobs::getJobsData Cache Done:::Ret "); + } + + $endpoint = "WRENCH_JOB_INTEREST_COUNT"; + $int_list = $this->getCache($endpoint)["result_list"]; + $out["interest_list"] = ( isset($int_list) && is_array($int_list) ) ? $int_list : []; + + log_message('critical', "***** ***** WrenchJobs::getJobsData Ret "); + return $this->respond( $this->summaryReturnData($in,$out), 200); } } \ No newline at end of file