diff --git a/www-api/app/Config/RoutesV1.php b/www-api/app/Config/RoutesV1.php index 0ef2a24d..3a211190 100644 --- a/www-api/app/Config/RoutesV1.php +++ b/www-api/app/Config/RoutesV1.php @@ -109,7 +109,9 @@ $routes->post('/en/wrench/api/v1/familywallet', 'WrenchWal $routes->post('/en/wrench/api/v1/familyresources', 'WrenchResources::familyresources'); $routes->post('/en/wrench/api/v1/commonmedia', 'WrenchResources::commonmedia'); -$routes->post('/en/wrench/api/v1/familybanners', 'WrenchBanners::familyBanners'); // class WrenchBanners WrenchApi +$routes->post('/en/wrench/api/v1/familybanners', 'WrenchFamily::familyBanners'); +$routes->post('/en/wrench/api/v1/familysampletasks', 'WrenchFamily::familySampleTasks'); + $routes->post('/en/wrench/api/v1/familyrewardhx', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/familytransferstart', 'WrenchApi::apigate'); @@ -118,7 +120,7 @@ $routes->post('/en/wrench/api/v1/familytransfer', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/familyadd', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/familyupdate', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/familymanage', 'WrenchApi::apigate'); -$routes->post('/en/wrench/api/v1/familysampletasks', 'WrenchApi::apigate'); + $routes->post('/en/wrench/api/v1/familysuggesttasks', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/familysuggestlist', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/suggeststatus', 'WrenchApi::apigate'); diff --git a/www-api/app/Controllers/WrenchBanners.php b/www-api/app/Controllers/WrenchBanners.php index eed1c58e..73cf8a94 100644 --- a/www-api/app/Controllers/WrenchBanners.php +++ b/www-api/app/Controllers/WrenchBanners.php @@ -22,24 +22,23 @@ class WrenchBanners extends BaseController "offset": 0 } */ - public function familyBanners(){ - - $raw_json = file_get_contents('php://input'); - $in = json_decode($raw_json, true); - - $in["action"] = WRENCHBOARD_FAMILY_HOMEBANNERS; - $endpoint = "FAMILY_BANNERS-". $in["uid"]; // str_pad($in["uid"], 12, "0", STR_PAD_LEFT); - $out = $this->getCache($endpoint); // try find in cache - // if ( count($out) == 0 ){ - $local_url = "http://".$this->micro_service_net1.":3032/familybanners"; - $out = $this->APIcall('GET', $local_url, $in); - log_message('critical', "familyBanners ********* ALL ".serialize($out["result_list"]) ); - log_message('critical', "familyBanners ********* COUNT ".serialize(count($out["result_list"])) ); - - $this->saveCache($endpoint,$out,1500); - // } - return $this->summaryReturnData($in,$out); //json_encode( $final_out ); - } +// public function familyBanners(){ +// +// $raw_json = file_get_contents('php://input'); +// $in = json_decode($raw_json, true); +// +// $in["action"] = WRENCHBOARD_FAMILY_HOMEBANNERS; +// $endpoint = "FAMILY_BANNERS-". $in["uid"]; // str_pad($in["uid"], 12, "0", STR_PAD_LEFT); +// $out = $this->getCache($endpoint); // try find in cache +// if ( count($out) == 0 ){ +// $local_url = "http://".$this->micro_service_net1.":3032/familybanners"; +// $out = $this->APIcall('GET', $local_url, $in); +// log_message('critical', "familyBanners ********* ALL ".serialize($out["result_list"]) ); +// log_message('critical', "familyBanners ********* COUNT ".serialize(count($out["result_list"])) ); +// $this->saveCache($endpoint,$out,1500); +// } +// return $this->summaryReturnData($in,$out); //json_encode( $final_out ); +// } public function apigate(){ log_message('critical', "0001"); diff --git a/www-api/app/Controllers/WrenchFamily.php b/www-api/app/Controllers/WrenchFamily.php new file mode 100644 index 00000000..8d38b871 --- /dev/null +++ b/www-api/app/Controllers/WrenchFamily.php @@ -0,0 +1,52 @@ +request = $request = \Config\Services::request(); + } + public function index() + { + return []; + } + + public function familyBanners(){ + + $raw_json = file_get_contents('php://input'); + $in = json_decode($raw_json, true); + + $in["action"] = WRENCHBOARD_FAMILY_HOMEBANNERS; + $endpoint = "FAMILY_BANNERS-". $in["uid"]; // str_pad($in["uid"], 12, "0", STR_PAD_LEFT); + $out = $this->getCache($endpoint); // try find in cache + if ( count($out) == 0 ){ + $local_url = "http://".$this->micro_service_net1.":3032/familybanners"; + $out = $this->APIcall('GET', $local_url, $in); + log_message('critical', "familyBanners ********* ALL ".serialize($out["result_list"]) ); + log_message('critical', "familyBanners ********* COUNT ".serialize(count($out["result_list"])) ); + $this->saveCache($endpoint,$out,1500); + } + return $this->summaryReturnData($in,$out); //json_encode( $final_out ); + } + + public function familySampleTasks(){ + + $raw_json = file_get_contents('php://input'); + $in = json_decode($raw_json, true); + + $in["action"] = WRENCHBOARD_FAMILY_SAMPLETASKS; + $endpoint = "FAMILY_SAMPLE_TASKS"; + $out = $this->getCache($endpoint); + if ( count($out) == 0 ){ + $ret = $this->wrenchboard->wrenchboard_api($in, $out); + $out['internal_return'] = $ret; + if ($ret == 0) + $this->saveCache($endpoint,$out,65000); + } + return $this->summaryReturnData($in,$out); //json_encode( $final_out ); + } + //familysampletasks +} \ No newline at end of file