new Api for blog data

This commit is contained in:
CHIEFSOFT\ameye
2024-07-31 01:20:19 -04:00
parent fdb6e28e0e
commit 33faad1a91
2 changed files with 32 additions and 3 deletions
+5 -2
View File
@@ -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');
+27 -1
View File
@@ -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){