From 9050fd6727371df2cd76a8369270fd3a00f182e1 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 7 Jun 2025 11:42:26 -0400 Subject: [PATCH] Fix API response --- www-api/app/Controllers/WrenchBanners.php | 37 +++++------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/www-api/app/Controllers/WrenchBanners.php b/www-api/app/Controllers/WrenchBanners.php index 2df3104c..803e9f25 100644 --- a/www-api/app/Controllers/WrenchBanners.php +++ b/www-api/app/Controllers/WrenchBanners.php @@ -2,8 +2,11 @@ namespace App\Controllers; +use CodeIgniter\API\ResponseTrait; + class WrenchBanners extends BaseController { + use ResponseTrait; public function __construct() { $this->request = $request = \Config\Services::request(); @@ -12,34 +15,7 @@ class WrenchBanners extends BaseController { return []; } -/* - { - "action": 11200, - "member_id": "379", - "uid": "5c2f7660-2214-4c75-98b0-12e44c0d7e78", - "sessionid": "800EBCB2C336A6954BB4FA589988092434B6221CBCCF9E1D92F09D9E10CA77AC", - "limit": 30, - "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 ); -// } -//activetaskslist + private function bannerGetActiveTasks($in){ $in["action"] = WRENCHBOARD_JOB_USERACTIVE; $in["nocache"] = $in["nocache"] ?? false; @@ -83,6 +59,7 @@ class WrenchBanners extends BaseController $raw_json = file_get_contents('php://input'); $in = json_decode($raw_json, true); $out =[]; + $extra_out =[]; $in["action"] = WRENCHBOARD_ACCOUNT_HOMEBANNERS; try{ @@ -121,8 +98,8 @@ class WrenchBanners extends BaseController log_message('critical', $errMsg); } - - return $this->summaryReturnData($in,$out, $extra_out); //json_encode( $final_out ); + return $this->respond($this->summaryReturnData($in,$out, $extra_out), 200); + // return $this->summaryReturnData($in,$out, $extra_out); //json_encode( $final_out ); } public function apigate(){ log_message('critical', "0001");