fAQ dATA
This commit is contained in:
@@ -8,16 +8,15 @@ class WrenchFaq extends BaseController
|
||||
{
|
||||
|
||||
//use ResponseTrait;
|
||||
|
||||
protected $db;
|
||||
public $con_name = 'wrench_blog';
|
||||
// protected $db;
|
||||
// public $con_name = 'wrench_blog';
|
||||
|
||||
public function learnMoreUser(){
|
||||
$total = 4;
|
||||
$data=[];
|
||||
$raw_json = file_get_contents('php://input');
|
||||
$in = json_decode($raw_json, true);
|
||||
|
||||
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
|
||||
$msg='';
|
||||
@@ -40,40 +39,9 @@ class WrenchFaq extends BaseController
|
||||
}
|
||||
|
||||
public function apigate(){
|
||||
return json_encode( $this->apiData() );
|
||||
return json_encode( $this->apiFaqData() );
|
||||
}
|
||||
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) {
|
||||
|
||||
}
|
||||
*/
|
||||
private function apiFaqData() {
|
||||
|
||||
$total = 1;
|
||||
|
||||
@@ -144,26 +112,6 @@ class WrenchFaq extends BaseController
|
||||
);
|
||||
|
||||
|
||||
// for ($i = 0; $i < $total; $i++) {
|
||||
// $key = sprintf("%05d", $i);
|
||||
// $data["result_list"][] = array(
|
||||
// "public" => "1",
|
||||
// "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,
|
||||
// );
|
||||
// }
|
||||
|
||||
/*
|
||||
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$data["result_list"][] = array(
|
||||
"public" => "0",
|
||||
"title" => "Do not show to the website 55".$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;
|
||||
}
|
||||
|
||||
@@ -211,41 +159,6 @@ class WrenchFaq extends BaseController
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $res;
|
||||
//
|
||||
// $total = 20;
|
||||
//
|
||||
// $data = array(
|
||||
// "status" => 100,
|
||||
// "total_record" => ($total - 1),
|
||||
// "internal_return" => 0,
|
||||
// "result_list" => array(),
|
||||
// );
|
||||
//
|
||||
//
|
||||
// for ($i = 0; $i < $total; $i++) {
|
||||
// $key = sprintf("%05d", $i);
|
||||
// $msg='';
|
||||
// $msgS = "<p> 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. </p>";
|
||||
// $txL = rand(1,5);
|
||||
// for($ii=1; $ii<$txL; $ii++){
|
||||
// $msg = $msg.$msgS;
|
||||
// }
|
||||
//
|
||||
// $data["result_list"][] = array(
|
||||
// "uid" => $key,
|
||||
// "public" => "1",
|
||||
// "title" => "This is faq title dummy text ".$key,
|
||||
// "vid" => (rand(0,1)> 0) ? "https://www.youtube.com/embed/xZ4o180KFNk?si=zGuIgpfTb-Tc0o3H":'',
|
||||
// "msg" => $msg
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user