This commit is contained in:
CHIEFSOFT\ameye
2023-06-15 12:50:43 -04:00
parent 3f60f1ffde
commit 6c48d7fb48
3 changed files with 98 additions and 0 deletions
+1
View File
@@ -150,6 +150,7 @@ $routes->post('/en/wrench/api/v1/resources', 'WrenchResources::website');
$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/faq', 'WrenchFaq::apigate');
+72
View File
@@ -0,0 +1,72 @@
<?php
namespace App\Controllers;
//use CodeIgniter\API\ResponseTrait;
class WrenchFaq extends BaseController
{
//use ResponseTrait;
protected $db;
public $con_name = 'wrench_blog';
private function apiData() {
/*
$this->db = \Config\Database::connect($this->con_name);
$data = array();
try {
$mysql = "SELECT id, post_title, post_content,post_date,comment_count FROM wp_posts WHERE post_type='post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 9";
$mysql = "SELECT p1.id AS id, p1.*, wm2.meta_value FROM wp_posts p1 LEFT JOIN wp_postmeta wm1
ON (wm1.post_id = p1.id AND wm1.meta_value IS NOT NULL AND wm1.meta_key = '_thumbnail_id' )
LEFT JOIN
wp_postmeta wm2
ON (wm1.meta_value = wm2.post_id AND wm2.meta_key = '_wp_attached_file' AND wm2.meta_value IS NOT NULL )
WHERE
p1.post_status='publish'
AND p1.post_type='post'
ORDER BY p1.post_date DESC LIMIT 2000";
$query = $this->db->query($mysql);
$data['payload']['blogdata'] = $query->getResult('array');
$totalCount = count( $data['payload']['blogdata'] );
$randomIndex = rand(1, $totalCount);
$data['payload']['featured'] = $data['payload']['blogdata'][$randomIndex ];
$data['payload']['image_url'] = 'https://blog.float.sg/wp-content/uploads/';
$data['payload']['blog_url'] = 'https://blog.float.sg/';
$data['payload']['total'] = $totalCount;
} catch (Exception $ex) {
}
*/
$total = 8;
$data = array(
"status" => 100,
"total_record" => ($total - 1),
"internal_return" => 0,
"result_list" => array(),
);
for ($i = 0; $i < $total; $i++) {
$key = sprintf("%05d", $i);
$data["result_list"][] = array(
"title" => "This is faq title dummy text ".$key,
"msg" => "Random gibberish text to use in web pages, site templates and in typography demos. Get rid of Lorem Ipsum forever. A tool for web designers who want to save time. ".$key,
);
}
return $data;
}
}
+25
View File
@@ -87,6 +87,7 @@ $endpoints = array(
'activejobstatus'=> array('POST'),
'activetaskstatus'=> array('POST'),
'offersinterestlist' => array('POST'),
'faq' => array('POST'),
);
$call_backend = true; // sometimes we need to overwite the call to the extenstion API
@@ -178,6 +179,10 @@ if ($_SERVER["REQUEST_METHOD"] == "GET") {
}
$in["loc"] = $_SERVER["REMOTE_ADDR"];
switch ($endpoint) {
case 'faq':
$local_out = faqData();
$call_backend = false;
break;
case 'offersinterestlist':
$in["action"] = WRENCHBOARD_JOB_OFFER_INTLIST;
break;
@@ -502,6 +507,26 @@ function getSiteConfigurations($wrenchboard,$config_item){
return $wrenchboard->cfgReadChar($config_item);
}
function faqData(){
$total = 8;
$data = array(
"status" => 100,
"total_record" => ($total - 1),
"internal_return" => 0,
"result_list" => array(),
);
for ($i = 0; $i < $total; $i++) {
$key = sprintf("%05d", $i);
$data["result_list"][] = array(
"title" => "This is faq title dummy text ".$key,
"msg" => "Random gibberish text to use in web pages, site templates and in typography demos. Get rid of Lorem Ipsum forever. A tool for web designers who want to save time. ".$key,
);
}
return $data;
}
function processJobStatus($data) {
/*$data['member_id'] = $_SESSION['member_id']; // = $ret->email;