From 33faad1a912db263dec2670d47357373ee6ea4c3 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Wed, 31 Jul 2024 01:20:19 -0400 Subject: [PATCH] new Api for blog data --- www-api/app/Config/RoutesV1.php | 7 +++++-- www-api/app/Controllers/WrenchBlog.php | 28 +++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/www-api/app/Config/RoutesV1.php b/www-api/app/Config/RoutesV1.php index dd931bcc..062f0704 100644 --- a/www-api/app/Config/RoutesV1.php +++ b/www-api/app/Config/RoutesV1.php @@ -209,10 +209,13 @@ $routes->post('/en/wrench/api/v1/recentactivities', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/reqdel', 'WrenchApi::apigate'); // request delete account -$routes->get('/en/wrench/api/v1/blogdata/', 'WrenchBlog::website'); $routes->get('/en/wrench/api/v1/blogdata/(:any)', 'WrenchBlog::blogLimitedData/$1'); -$routes->post('/en/wrench/api/v1/blogdata/', 'WrenchBlog::website'); +$routes->post('/en/wrench/api/v1/blogdata', 'WrenchBlog::website'); +$routes->get('/en/wrench/api/v1/blogdata', 'WrenchBlog::website'); + +$routes->post('/en/wrench/api/v1/mobileblogdata', 'WrenchBlog::mobileBlogData'); + //$routes->post('/en/wrench/api/v1/blogdata/(:any)', 'WrenchBlog::blogLimitedData/$1'); diff --git a/www-api/app/Controllers/WrenchBlog.php b/www-api/app/Controllers/WrenchBlog.php index d670ee2e..ede94589 100644 --- a/www-api/app/Controllers/WrenchBlog.php +++ b/www-api/app/Controllers/WrenchBlog.php @@ -4,9 +4,11 @@ namespace App\Controllers; //use CodeIgniter\API\ResponseTrait; +use CodeIgniter\API\ResponseTrait; + class WrenchBlog extends BaseController { - + use ResponseTrait; //use ResponseTrait; protected $db; @@ -50,6 +52,18 @@ class WrenchBlog extends BaseController return $data; } + public function mobileBlogData($endpoint,$raw_array) + { + $res1 = $this->getCache($endpoint); + if (count($res1)==0){ + $rawData = $this->apiData(0); + $res1= $rawData['payload']; //[0]['payload']; + $this->saveCache($endpoint,$res1); + } + $in =[]; + return $this->respond( $this->summaryReturnData($in,$res1), 200); + } + public function blogData($endpoint,$raw_array) { /* @@ -96,6 +110,18 @@ class WrenchBlog extends BaseController } } + /* + * + Column | Type | Collation | Nullable | Default +---------+-----------------------------+-----------+----------+--------------------------------------------- + id | integer | | not null | nextval('blog_selections_id_seq'::regclass) + uid | uuid | | | uuid_generate_v4() + blog_id | integer | | not null | + title | character varying(50) | | not null | + banner | character varying(250) | | not null | + status | integer | | | 1 + added | timestamp without time zone | | | now() + */ $limit = isset($in['limit']) ? $in['limit']: 0; if ($limit> 0){