Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
40aadfe529
@ -272,9 +272,9 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
|
||||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||||
|
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
|
||||||
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
|
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
|
||||||
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||||
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
|
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
|
||||||
@ -305,6 +305,9 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
|||||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
118
app/Controllers/ChatBotController.php
Normal file
118
app/Controllers/ChatBotController.php
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Helpers\MailHelper;
|
||||||
|
use App\Helpers\sendMailNotification;
|
||||||
|
|
||||||
|
use App\Models\EmployeeModel;
|
||||||
|
use App\Models\EmployeePolicyModel;
|
||||||
|
use App\Models\ClientModel;
|
||||||
|
use App\Models\ClientRMModel;
|
||||||
|
use App\Models\PolicesModel;
|
||||||
|
use App\Models\RelationshipModel;
|
||||||
|
use App\Models\FileModel;
|
||||||
|
use App\Models\ClientPolicyModel;
|
||||||
|
use App\Models\PolicyPremium1Model;
|
||||||
|
use App\Models\PolicyPremium2Model;
|
||||||
|
use App\Models\PolicyTypeModel;
|
||||||
|
use App\Models\NotificationModel;
|
||||||
|
use App\Models\UserModel;
|
||||||
|
use App\Models\FEContentModel;
|
||||||
|
use App\Models\AddImgModel;
|
||||||
|
use App\Models\ChatBotModel;
|
||||||
|
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
class ChatBotController extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
use ResponseTrait;
|
||||||
|
|
||||||
|
protected $myLogger;
|
||||||
|
protected $employeeModel;
|
||||||
|
protected $employeePolicyModel;
|
||||||
|
protected $clientModel;
|
||||||
|
protected $clientRMModel;
|
||||||
|
protected $fileModel;
|
||||||
|
protected $policesModel;
|
||||||
|
protected $relationshipModel;
|
||||||
|
protected $clientPolicyModel;
|
||||||
|
protected $policyPremium1Model;
|
||||||
|
protected $policyPremium2Model;
|
||||||
|
protected $policyTypeModel;
|
||||||
|
protected $notificationModel;
|
||||||
|
protected $userModel;
|
||||||
|
protected $feContentModel;
|
||||||
|
protected $addImgModel;
|
||||||
|
protected $ChatBotModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
set_session_context('Employee');
|
||||||
|
$this->myLogger = \Config\Services::mylogger();
|
||||||
|
$this->employeeModel = new EmployeeModel();
|
||||||
|
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||||
|
$this->clientModel = new ClientModel();
|
||||||
|
$this->clientRMModel = new ClientRMModel();
|
||||||
|
$this->policesModel = new PolicesModel();
|
||||||
|
$this->relationshipModel = new RelationshipModel();
|
||||||
|
$this->fileModel= new FileModel();
|
||||||
|
$this->clientPolicyModel = new ClientPolicyModel();
|
||||||
|
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||||
|
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||||
|
$this->policyTypeModel = new PolicyTypeModel();
|
||||||
|
$this->notificationModel = new NotificationModel();
|
||||||
|
$this->userModel = new UserModel();
|
||||||
|
$this->feContentModel = new FEContentModel();
|
||||||
|
$this->addImgModel = new AddImgModel();
|
||||||
|
$this->ChatBotModel = new ChatBotModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getChatResponse()
|
||||||
|
{
|
||||||
|
// try {
|
||||||
|
$request_for = $this->request->getGet('request_for');
|
||||||
|
$option = $this->request->getGet('option');
|
||||||
|
|
||||||
|
$requestData = $this->ChatBotModel->where('request', $request_for)
|
||||||
|
->where('is_active', 1 )
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($requestData) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($option != 0){
|
||||||
|
|
||||||
|
$decodedData = json_decode($requestData['options'],true);
|
||||||
|
|
||||||
|
$requestFor = $decodedData[$request_for][$option];
|
||||||
|
|
||||||
|
$requestData = $this->ChatBotModel->where('request', $requestFor)
|
||||||
|
->where('is_active', 1 )
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$result = ['request_for'=>$requestData['request'],'options'=>json_decode($requestData['options'],true)];
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404);
|
||||||
|
}
|
||||||
|
// } catch (\Throwable $th) {
|
||||||
|
// return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
22
app/Models/ChatBotModel.php
Normal file
22
app/Models/ChatBotModel.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ChatBotModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'chat_bot';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $allowedFields = [
|
||||||
|
"id",
|
||||||
|
"request",
|
||||||
|
"options",
|
||||||
|
"created_by",
|
||||||
|
"updated_by",
|
||||||
|
"is_active",
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user