VIDEO UPLAOD DONE

This commit is contained in:
Velz2020 2020-11-11 16:50:02 +05:30
parent a9b8d6e618
commit f297fdcf64
3 changed files with 85 additions and 4 deletions

View File

@ -265,6 +265,7 @@ $route['auditSmartPDImages'] = 'PD_Controller/auditSmartPDImages';
$route['getAuditedImages'] = 'PD_Controller/getAuditedImages';
$route['updateVendorFormStatus'] = 'PD_Controller/updateVendorFormStatus';
$route['getBusinessDocsToVendorForm'] = 'PD_Controller/getBusinessDocsToVendorForm';
$route['uploadVideoFile'] = 'PD_Controller/uploadVideoFile';
//$route['getTypeOfActivetyFromBusinessJSON'] = 'PD_Controller/getTypeOfActivetyFromBusinessJSON';
//Dashboard and Reports Related routes
@ -307,4 +308,5 @@ $route['getStakeHoldersInfo'] = 'SMC_Credit_PD_Controller/getStakeHoldersInfo';
$route['loadSMCPDTemplate'] = 'SMC_Credit_PD_Controller/loadSMCPDTemplate';
$route['loadDataFromExcel'] = 'SMC_Credit_PD_Controller/loadDataFromExcel';
$route['getSMCPDImgSectionData'] = 'SMC_Credit_PD_Controller/getSMCPDImgSectionData';
$route['smcCreditPDReport'] = 'SMC_Credit_PD_Controller/smcCreditPDReport';

View File

@ -9773,7 +9773,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$result_data = 0;
// $query = "SELECT * FROM ".VIDEO_ROOM_INFO." where fk_pd_id = $pd_id and twilo_status = 'enqueued' and composition_id is not null;";
$pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id,$random_string);
$query = "SELECT * FROM ".VIDEO_ROOM_INFO." where fk_pd_id = $pd_id and isactive = 1";// and twilo_status = 'enqueued' and composition_id is not null;";
$query = "SELECT * FROM ".VIDEO_ROOM_INFO." where fk_pd_id = $pd_id and isactive = 1 and is_uploaded = 0";// and twilo_status = 'enqueued' and composition_id is not null;";
if($room_id)
{
$query .=" and room_id = '$room_id'";
@ -10999,6 +10999,73 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
}
}
public function uploadVideoFile_post()
{
$records = json_decode($this->post('records'),true);
$pd_master_details = $this->PD_Model->getPDMasterDetails($records['fk_pd_id'],$records['random_string']);
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
// echo XLPATH;
// print_r($records);die();
// print_r($pd_master_details);die();
$is_bucket_upload_sucess = false;
$id = null;
//die();
if(!empty($_FILES['video_file']))
{
$folder_to_check = XLPATH.'/pd_reports/'.$records['fk_pd_id'].'/videos';
// $modified_fname = $records['rand_key'].'~'.str_replace(' ','_',($_FILES['pd_excel_data']['name']));
$modified_fname = str_replace(' ','_',($_FILES['video_file']['name']));
// echo file_exists($folder_to_check);die();
$config = array('upload_path' => $folder_to_check,'overwrite' => TRUE,'allowed_types' => '*','file_name' => $modified_fname);
$this->load->library('upload', $config);
if($this->upload->do_upload('video_file'))
{
$sourcefile = $folder_to_check.'/'.$modified_fname;
// echo $sourcefile;
$key = 'pd'.$records['fk_pd_id'].'/video/'.$modified_fname;
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$sourcefile);
// print_r($bucket_data);die();
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
//print_r($s3result);die();
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{
$is_bucket_upload_sucess = 1;
$id = $this->PD_Model->saveRecords(array('fk_pd_id' =>$records['fk_pd_id'],'room_id' => $modified_fname,'composition_id' => $modified_fname,'is_call_ended' => 1,'s3_copied' => 1,'is_uploaded' => 1),VIDEO_ROOM_INFO);
unlink($sourcefile);
}
}
if($is_bucket_upload_sucess && $id)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['msg'] = 'File Uploaded Successfully';
// $data['excel_file_id'] = $id;
// $data['records'] = $result_data;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Something Wrong. Try Later!';
$this->response($data,REST_Controller::HTTP_OK);
}
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'No Data File Found!';
$this->response($data,REST_Controller::HTTP_OK);
}
}

View File

@ -1366,7 +1366,7 @@ public function filterSalesPDList_post() {
else
{
$img_data[$key]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '');
// $img_data[$key]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? 'BLOB' : '');
// $img_data[$value['key_name']]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? 'BLOB' : '');
}
}
@ -1389,11 +1389,11 @@ public function filterSalesPDList_post() {
if(!$value['is_multiple'])
{
$img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => '','is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']);
$img_data[$key] = array('img_key' => $value['key_name'],'img_name' => $value['img_name'],'img_url' => '','is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']);
}
else
{
$img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_data' => array(),'is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']);
$img_data[$key] = array('img_key' => $value['key_name'],'img_name' => $value['img_name'],'img_data' => array(),'is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']);
}
}
}
@ -1425,6 +1425,18 @@ public function filterSalesPDList_post() {
$data['records'] = array('smc_credit_pd' => $pd_id,'img_data' => $img_data);
$this->response($data,REST_Controller::HTTP_OK);
}
public function smcCreditPDReport_post()
{
$records = $this->post('records');
print_r($records);
$pd_master_details = $this->PD_Model->getPDMasterDetails($records['pd_id']);
$pd_section_data = $this->SMC_Credit_PD_Model->selectCustomRecords(array('*'),array('isactive' => 1,'fk_pd_id' => $records['pd_id']),SMC_CREDIT_PD_SECTION_DATA);
echo count($pd_section_data);
}
}