blog data

This commit is contained in:
CHIEFSOFT\ameye
2024-10-30 08:49:12 -04:00
parent d1e7852158
commit d0a3699e37
3 changed files with 29 additions and 31 deletions
+13 -1
View File
@@ -537,10 +537,22 @@ wrenchboard=#
return json_encode( $final_out );
}
public function blogData($endpoint,$raw_array)
{
$res1 = $this->getCache($endpoint);
if (count($res1)==0){
$rawData = $this->apiData();
$res1= $rawData['payload']; //[0]['payload'];
$this->saveCache($endpoint,$res1);
}
return $res1;
}
protected $db;
public $con_name = 'wrench_dockerblog'; // 'wrench_blog';
protected function apiData($blog_id=0) {
protected function apiData($blog_id=0) :array {
$this->db = \Config\Database::connect($this->con_name);
$data = array();
$extra_filter = "";
-29
View File
@@ -23,24 +23,7 @@ class WrenchBlog extends BaseController
return $this->respond( $this->summaryReturnData($in,$res1), 200);
}
public function blogData($endpoint,$raw_array)
{
/*
$rawData = $this->apiData();
// $res1= $rawData[0]['payload'];
$res1= $rawData; //[0]['payload'];
$this->saveCache('blogdata',$res1['payload']);
*/
$res1 = $this->getCache($endpoint);
if (count($res1)==0){
$rawData = $this->apiData();
$res1= $rawData['payload']; //[0]['payload'];
$this->saveCache($endpoint,$res1);
}
//$resJson = $this->response->setJson($res1);
return $res1;
}
public function website(){
@@ -75,18 +58,6 @@ 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){
+16 -1
View File
@@ -112,7 +112,22 @@ class WrenchResources extends BaseController
private function getBlogData()
{
return (new \App\Models\BlogDataModel())->blogData(100);
$blog_id = 0;
$endpoint = "WRENCH_BLOG_DATA";
$res1 = $this->getCache($endpoint);
if (count($res1)==0){
$rawData = $this->apiData($blog_id);
$res1= $rawData['payload']; //[0]['payload'];
$this->saveCache($endpoint,$res1);
}
$res1['blogconfig'] = [
"media_url" => "https://blog.wrenchboard.com/wp-content/uploads",
"image_url" => "https://blog.wrenchboard.com/wp-content/uploads",
"site_url" => "https://blog.wrenchboard.com",
"other_config2" => "NONE",
];
return $res1;
//return (new \App\Models\BlogDataModel())->blogData(100);
}
//************************