Files
WrenchBoradWeb/www-api/app/Controllers/Home.php
T
CHIEFSOFT\ameye 569d3e7907 Email test
2025-07-05 17:58:00 -04:00

51 lines
1.7 KiB
PHP

<?php
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
class Home extends BaseController
{
use ResponseTrait;
public function index()
{
// $this->mongoDbTest();
$data['envID'] = getenv('ENV_ID');
$data['home_background'] = getenv('HOME_PAGE_BACKGROUND');
return view('welcome_message',$data);
}
public function test()
{
//const WRENCHBOARD_TEST_PATH = 9999099;
//echo "hello world, from home controller";
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$out =[];
$in["action"] = WRENCHBOARD_TEST_PATH;
$in["dummy"] ="This is a dummy message for test";
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
$out['internal_return'] = $ret;
return $this->respond($this->summaryReturnData($in, $out), 200);
}
public function mongoDbTest(){
$client = new \MongoDB("mongodb://chiefsoft:may12002@10.0.0.32:27017/","mongoClient");
try {
// Send a ping to confirm a successful connection
$client->selectDatabase('admin')->command(['ping' => 1]);
//echo "Pinged your deployment. You successfully connected to MongoDB!\n";
log_message('critical', "Pinged your deployment. You successfully connected to MongoDB!");
} catch (Exception $e) {
log_message('critical', "Pinged your deployment. You failed connected to MongoDB! :: ".$e->getMessage());
// printf($e->getMessage());
}
//$client->createDBRef()
// $currDb = $client->createCollection("traffic");
//$currDb->insert()
}
}