Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
22d49c0fbb
@ -349,6 +349,9 @@ class EmployeeServiceController extends AdminController
|
||||
unset($excel_data[0]);
|
||||
$relationship = $this->general_relationships;
|
||||
|
||||
|
||||
if(in_array($file['action'],['inception','addition','dependent_addition']))// the below funcitons are only for I,DA,A
|
||||
{
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||
|
||||
$is_self_available_in_policy_terms = false;
|
||||
@ -452,7 +455,8 @@ class EmployeeServiceController extends AdminController
|
||||
$result['error_data'][$rowid]['name_of_emp_dep']['error'][] = "Record already exists";
|
||||
}
|
||||
}
|
||||
}
|
||||
}// end of foreach
|
||||
}// end of if current action I,DA,A
|
||||
|
||||
// s($result);
|
||||
// die();
|
||||
@ -857,9 +861,9 @@ class EmployeeServiceController extends AdminController
|
||||
if($slab_value['si'] == $row[3])
|
||||
{
|
||||
$group_key = rand(100000, 999999);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $row[3],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $row[3],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ use ReflectionClass;
|
||||
|
||||
require_once('../vendor/autoload.php');
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
|
||||
|
||||
class AuthJWT implements FilterInterface
|
||||
@ -19,27 +20,27 @@ class AuthJWT implements FilterInterface
|
||||
public function before(RequestInterface $request, $arguments = null)
|
||||
{
|
||||
$jwt = $request->getHeader('Authorization');
|
||||
$model = new EmployeeModel();
|
||||
|
||||
if ($jwt) {
|
||||
if (JWTToken::validateJWT($jwt)) {
|
||||
$data = JWTToken::validateJWT($jwt);
|
||||
$data = json_decode($data);
|
||||
|
||||
if ($data->status) {
|
||||
// $auth = $request->getHeader("Authorization");
|
||||
// $decodedToken = $data->decoded;
|
||||
$id = $data->decoded->id;
|
||||
$user_data = $model->where('id', $id)->first();
|
||||
|
||||
// $decodedToken->exp += 30;
|
||||
// $newJwt = JWTToken::encode((array)$decodedToken);
|
||||
|
||||
// Set the new JWT in the response headers
|
||||
// $response = service('response');
|
||||
// $response->setHeader('Authorization', $newJwt);
|
||||
if($user_data['token_time_out'] > time()){
|
||||
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
|
||||
$model->update($id, $data);
|
||||
return true;
|
||||
}else{
|
||||
$data =["token_time_out" => ''];
|
||||
$model->update($id, $data);
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(401);
|
||||
$error = json_encode(["status" => 401, "message" => $data->message]);
|
||||
// $error = json_encode(["status" => 401, "message" => $data->message]);
|
||||
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
|
||||
echo $error;
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ use Firebase\JWT\SignatureInvalidException;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use ReflectionClass;
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
|
||||
|
||||
class JWTToken
|
||||
@ -19,20 +20,20 @@ class JWTToken
|
||||
public static function encode($data =null)
|
||||
{
|
||||
$secret_Key ="secret";
|
||||
$iat = time();
|
||||
$exp = $iat + 180;
|
||||
$request_data = [
|
||||
"iat" => $iat,
|
||||
"exp" => $exp,
|
||||
];
|
||||
if ($data !== null) {
|
||||
$request_data = array_merge($request_data, (array)$data);
|
||||
}
|
||||
|
||||
$request_data = (array)$data;
|
||||
|
||||
try{
|
||||
$token = JWT::encode($request_data ,$secret_Key,'HS512');
|
||||
|
||||
$model = new EmployeeModel();
|
||||
$id = $request_data['id'];
|
||||
$data =[
|
||||
"token_time_out" => time() + getenv('TOKENTIMEOUT')
|
||||
];
|
||||
$model->update($id, $data);
|
||||
|
||||
return $token;
|
||||
// return ['status' => true,'token' => $token];
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return ['status' => false,'message' => $e->getMessage()];
|
||||
|
||||
@ -199,10 +199,13 @@ if(!function_exists('check_si'))
|
||||
|
||||
if(!$is_si_found && $slab_value['si'] == $received_si) //match si amount
|
||||
{
|
||||
// echo 'found';
|
||||
$is_si_found = true;
|
||||
}
|
||||
|
||||
// check age slab
|
||||
if(in_array(strtoupper($row['current_action']), ['I','A','DA']))
|
||||
{
|
||||
if($row[3] != null && DateTime::createFromFormat('d-M-Y', $row[3]) !== false)// dob
|
||||
{
|
||||
$dob = change_date_format($row[3],'d-M-Y','Y-m-d');
|
||||
@ -225,10 +228,15 @@ if(!function_exists('check_si'))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}//end of check age slab
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age conditin is not applicable
|
||||
}//end of check age slab
|
||||
}// end of for loop
|
||||
|
||||
}
|
||||
|
||||
if(!$is_si_found)
|
||||
|
||||
@ -38,7 +38,8 @@ class EmployeeModel extends Model
|
||||
"file_id",
|
||||
"is_addon_value",
|
||||
"is_createdby_hr",
|
||||
"client_branch_id"
|
||||
"client_branch_id",
|
||||
"token_time_out"
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
Loading…
Reference in New Issue
Block a user