AWS LINK SHORT IMPLEMENTED

This commit is contained in:
Velz2020 2020-10-16 00:11:14 +05:30
parent d4c7e12540
commit 5c19b79f16
7 changed files with 79 additions and 37 deletions

View File

@ -89,7 +89,7 @@ $autoload['drivers'] = array();
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myutil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform','sms_gupshup','assessedincome','rentalform','external_dir_check','applicantname_grabber','vendor_form');
$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myutil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform','sms_gupshup','assessedincome','rentalform','external_dir_check','applicantname_grabber','vendor_form','custom_encryption');
/*
| -------------------------------------------------------------------

View File

@ -158,7 +158,7 @@ $config['composer_autoload'] = TRUE;
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-=';
/*
|--------------------------------------------------------------------------

View File

@ -50,7 +50,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'welcome';
$route['(short/:any)'] = 'welcome/short';
$route['vdo'] = 'welcome/short';
$route['autenticadors'] = 'autenticador/index';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

View File

@ -9696,7 +9696,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
{
$pd_id = $this->post('pd_id');
$random_string = $this->post('random_string');
$this->load->library('twlio');
//$this->load->library('twlio');
$result_data = array();
$pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id,$random_string);
@ -9788,17 +9788,21 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
}
else
{
$composition_result_data = $this->twlio->startComposistion($value['room_id']);
// $composition_result_data = $this->twlio->startComposistion('RM23b8d502434e46e696d1fbd5d64c59c8');
// print_r($composition_result_data);
$composition_result_data_json = json_encode($composition_result_data);
// print_r($composition_result_data_json);
$records['res_json'] = $composition_result_data_json;
$records['twilo_status'] = $composition_result_data['status'];
$records['composition_id'] = $composition_result_data['compositionId'];
$records['is_call_ended'] = 1;
$where_condition_array = array('fk_pd_id' => $pd_id); if($room_id){ $where_condition_array['room_id'] = $room_id; }
$id = $this->PD_Model->updateRecords($records,VIDEO_ROOM_INFO,$where_condition_array);
$room_status = $this->twlio->getRoomDataByRoomID($value['room_id']);
if($room_status == 'completed')
{
$composition_result_data = $this->twlio->startComposistion($value['room_id']);
// $composition_result_data = $this->twlio->startComposistion('RM23b8d502434e46e696d1fbd5d64c59c8');
// print_r($composition_result_data);
$composition_result_data_json = json_encode($composition_result_data);
// print_r($composition_result_data_json);
$records['res_json'] = $composition_result_data_json;
$records['twilo_status'] = $composition_result_data['status'];
$records['composition_id'] = $composition_result_data['compositionId'];
$records['is_call_ended'] = 1;
$where_condition_array = array('fk_pd_id' => $pd_id); if($room_id){ $where_condition_array['room_id'] = $room_id; }
$id = $this->PD_Model->updateRecords($records,VIDEO_ROOM_INFO,$where_condition_array);
}
}
}

View File

@ -25,24 +25,44 @@ class Welcome extends CI_Controller {
public function short()
{
$uri = $this->uri->segment(2);
//echo $uri;
$this->load->model('PD_Model');
$this->load->library('AWS_S3');
$room_info = $this->PD_Model->selectCustomRecords(array('*'),array('composition_id' => $uri),VIDEO_ROOM_INFO);
if(count($room_info))
$data = $this->input->get('dat');
//echo $data;
$redirect_url = 'https://demo.pdgenie.com/error/404.html';
if($data)
{
$pd_master_details = $this->PD_Model->getPDMasterDetails($room_info[0]['fk_pd_id']);
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
$final_key = 'pd'.$pd_master_details[0]['pd_id'].'/video/'.$uri.'.mp4';
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$final_key,'+1 hour');
// echo 'sdj';
// die();
header("Location: $singed_uri");
}
else
{
header('Location: https://google.com');
// $uri = custom_encryption::encode($data);die();
$uri = custom_encryption::decode($data);
// echo $uri;
$uri = explode('/',$uri);
$video_name = $uri[0];
$date = $uri[1];
$is_expired = MYUTIL::isDateExpired($date,7);
if(!$is_expired)
{
$this->load->model('PD_Model');
$this->load->library('AWS_S3');
$room_info = $this->PD_Model->selectCustomRecords(array('*'),array('composition_id' => $video_name),VIDEO_ROOM_INFO);
//print_r($room_info);die();
if(count($room_info))
{
$pd_master_details = $this->PD_Model->getPDMasterDetails($room_info[0]['fk_pd_id']);
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
$final_key = 'pd'.$pd_master_details[0]['pd_id'].'/video/'.$video_name.'.mp4';
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$final_key,'+2 hour');
$redirect_url = $singed_uri;
}
}
else
{
$redirect_url = 'https://demo.pdgenie.com/error/exp.html';
}
//echo $redirect_url;
header("Location: $redirect_url");
}
}

View File

@ -259,6 +259,24 @@ class MYUTIL
}
return $ordered_fy_data;
}
public static function isDateExpired($received_date,$days_to_compare)
{
$converted_real_date = strtotime($received_date);
$converted_real_date = date('Y-m-d',$converted_real_date);
// $format = "Y-m-d";
// $received_date = DateTime::createFromFormat($format, $converted_real_date);
// $today = DateTime::createFromFormat($format, date('Y-m-d'));
$received_date=date_create($converted_real_date);
$today=date_create(date('Y-m-d'));
$diff=date_diff($received_date,$today);
// echo $diff->format("%R%a days");
$different = $diff->format("%a");
//echo $different;
return ($different >= $days_to_compare);
}
}

View File

@ -134,11 +134,11 @@ class Twlio
// print_r($rooms);
$room = $twilio->video->v1->rooms($roomID)
->fetch();
print($room->uniqueName);
print($room->accountSid);
print($room->type);
print($room->status);
print($room->status);
// print($room->uniqueName);
// print($room->accountSid);
//print($room->type);
// print($room->status);
return ($room->status);
// foreach ($rooms as $record) {
// print($record->sid);