diff --git a/api/application/config/routes.php b/api/application/config/routes.php index f0b5b8d3..5cc42ed0 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -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'; \ No newline at end of file +$route['getSMCVendorPDOfficersList'] = 'SMC_Credit_PD_Controller/getSMCVendorPDOfficersList'; +$route['getShortenURL'] = 'PD_Controller/getShortenURL'; \ No newline at end of file diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index e0261225..cb8dbac1 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -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) { diff --git a/api/application/helpers/video_grabber_helper.php b/api/application/helpers/video_grabber_helper.php index de1fb39d..78232734 100644 --- a/api/application/helpers/video_grabber_helper.php +++ b/api/application/helpers/video_grabber_helper.php @@ -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; + } + + }