URL shorten api : ps

This commit is contained in:
sanjeev 2021-11-30 15:11:58 +05:30
parent 79dfc2315a
commit 79a8910f3d
3 changed files with 53 additions and 1 deletions

View File

@ -327,4 +327,5 @@ $route['getMasterForDataDump'] = 'Request_DataDump_Controller/getMasterForDataDu
$route['downloadDataDump'] = 'Request_DataDump_Controller/downloadDataDump2';
$route['getSMCVendorList'] = 'SMC_Credit_PD_Controller/getCityWiseAgency';
$route['getSMCVendorPDOfficersList'] = 'SMC_Credit_PD_Controller/getSMCVendorPDOfficersList';
$route['getSMCVendorPDOfficersList'] = 'SMC_Credit_PD_Controller/getSMCVendorPDOfficersList';
$route['getShortenURL'] = 'PD_Controller/getShortenURL';

View File

@ -11294,6 +11294,27 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
return $pd_details;
}
function getShortenURL_get(){
$id = $this->get('id');
$fk_lender_id = $this->get('lender_id');
$this->load->helper('video_grabber_helper');
$result_data = (new video_grabber_helper)->shortenVideoURL($id,$fk_lender_id);
$result_data = json_decode($result_data,true);
//print_r($result_data);die();
if($result_data->datastatus == 200)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['shorten_url'] = $result_data->data;
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Something Wrong. Try Later!';
}
$this->response($data,REST_Controller::HTTP_OK);
}
function saveSMCTempAddress($pd_id,$addresses)
{

View File

@ -70,6 +70,36 @@ class video_grabber_helper
$affectedRows = $CI->db->affected_rows();
return (($affectedRows > 0 ) ? "Deleted successfully" : "Fail to Delete");
}
public function shortenVideoURL($id,$fk_lender_id){
$CI =&get_instance();
$query = "SELECT * FROM ".VIDEO_ROOM_INFO." where video_room_info_id = $id and isactive = 1";
$video_info = $CI->db->query($query);
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$fk_lender_id;
if($video_info->num_rows())
{
$video_info = $video_info->result_array();
foreach ($video_info as $key => $value)
{
$video_name = $value['composition_id'].'.mp4';
if($value['is_uploaded']){$video_name = $value['composition_id'];}
$file_name = $video_name;
if($value['s3_copied'])
{
$final_key = 'pd'.$value['fk_pd_id'].'/video/'.$file_name;
$singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$final_key,'+7 days');
$py_response = "127.0.0.1:5000?sh_url?url=".$singed_uri;
}
else
{
$py_response = "";
}
}
}
return $py_response;
}
}