sparqapi/api/application/controllers/Welcome.php
2020-10-14 00:23:34 +05:30

52 lines
1.4 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');
}
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))
{
$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');
}
}
}