66 lines
2.1 KiB
PHP
66 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
class Employers extends BaseController
|
|
{
|
|
|
|
public function verifyEmployer()
|
|
{
|
|
$data = $this->request->getPost();
|
|
|
|
if ($data['application_uid'] != '') {
|
|
|
|
$findEmp ="SELECT c.firstname,c.lastname,a.uid AS application_uid, a.* from applications a LEFT JOIN customers c ON c.uid =a.customer_uid WHERE a.status =2 AND a.uid = '".trim($data['application_uid'])."'";
|
|
log_message('error', "findEmp---=>" . $findEmp);
|
|
|
|
$query = $this->db->query($findEmp);
|
|
$row = $query->getResult('array');
|
|
$employer_uid = $row[0]['employer_uid'];
|
|
if ($row[0]['uid']!='' ){
|
|
log_message('error', "Call API---=>");
|
|
$checkData = $this->APIcall("POST", "http://10.10.10.48:6332/api/verify/employer", json_encode($row[0]));
|
|
}else{
|
|
log_message('error', "Not found API---=>");
|
|
}
|
|
|
|
$udata = [
|
|
'employer_uid' => $employer_uid
|
|
];
|
|
|
|
$addedData = $this->insert_db('employer_checks',$udata);
|
|
//$addedData =[];
|
|
|
|
if( $addedData["uid"] ==''){
|
|
$response = [
|
|
'message' => 'Failure',
|
|
'call_return' => '100',
|
|
'token' => '',
|
|
'verify_data' => $checkData
|
|
];
|
|
return $this->fail($response, 500);
|
|
}
|
|
|
|
$response = [
|
|
'message' => 'Verification text sent to employer',
|
|
'call_return' => '100',
|
|
'verification_id' => $addedData["uid"],
|
|
'status' => $checkData["res"]["status"],
|
|
'verify_data' => $checkData["res"]["data"]
|
|
];
|
|
|
|
return $this->respond($response, 200);
|
|
} else {
|
|
$response = [
|
|
'message' => 'Failure',
|
|
'call_return' => '100',
|
|
'token' => ''
|
|
];
|
|
return $this->fail($response, 409);
|
|
}
|
|
|
|
|
|
//return json_encode( $response );
|
|
|
|
}
|
|
} |