From 6c48d7fb48e68aa06b2b822b5329b4620890217d Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 15 Jun 2023 12:50:43 -0400 Subject: [PATCH] Faq data --- www-api/app/Config/Routes.php | 1 + www-api/app/Controllers/WrenchFaq.php | 72 +++++++++++++++++++++++++++ www-api/public/svs/user/userve.php | 25 ++++++++++ 3 files changed, 98 insertions(+) create mode 100644 www-api/app/Controllers/WrenchFaq.php diff --git a/www-api/app/Config/Routes.php b/www-api/app/Config/Routes.php index 4bce09e5..728ecf2d 100644 --- a/www-api/app/Config/Routes.php +++ b/www-api/app/Config/Routes.php @@ -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'); diff --git a/www-api/app/Controllers/WrenchFaq.php b/www-api/app/Controllers/WrenchFaq.php new file mode 100644 index 00000000..549fa18f --- /dev/null +++ b/www-api/app/Controllers/WrenchFaq.php @@ -0,0 +1,72 @@ +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; + } + + + + +} \ No newline at end of file diff --git a/www-api/public/svs/user/userve.php b/www-api/public/svs/user/userve.php index 2e92bcf9..64af51f3 100755 --- a/www-api/public/svs/user/userve.php +++ b/www-api/public/svs/user/userve.php @@ -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;