77 lines
1.9 KiB
PHP
77 lines
1.9 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\controllers;
|
|
|
|
|
|
use app\models\FileCms;
|
|
use app\models\RegisterObjectFiles;
|
|
use app\services\IdServer;
|
|
use app\services\JWT;
|
|
|
|
class FileSystemController extends BaseController
|
|
{
|
|
|
|
public function actionFilePreviewDelivery($id)
|
|
{
|
|
if ($id) {
|
|
$decode = JWT::decode($id, JWT::SECRET_KEY);
|
|
/** @var RegisterObjectFiles $objectFile */
|
|
$objectFile = RegisterObjectFiles::findOne($decode->id);
|
|
if ($objectFile) {
|
|
if ($objectFile->file_content_type == 1 && $objectFile->extension == 'pdf') {
|
|
if(empty($_GET['preview'])) {
|
|
return $this->renderPartial('pdf-preview', ['objectFile' => $objectFile]);
|
|
} else {
|
|
return $this->renderPartial('viewer', ['objectFile' => $objectFile]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// die('You do not have permission to open this address');
|
|
|
|
}
|
|
|
|
public function actionFilePreviewDeliveryMobile($id)
|
|
{
|
|
|
|
return $this->renderPartial('pdf-preview-mobile', ['id' => $id]);
|
|
|
|
// die('You do not have permission to open this address');
|
|
|
|
}
|
|
|
|
public function actionPublic($id)
|
|
{
|
|
return $this->renderPartial('pdf-public-preview', ['file_name' => $id]);
|
|
}
|
|
|
|
public function actionDelivery($id)
|
|
{
|
|
$file = RegisterObjectFiles::findOne($id);
|
|
IdServer::url($file->file_url);
|
|
exit;
|
|
}
|
|
|
|
public function actionDeliveryImg($id)
|
|
{
|
|
$file = RegisterObjectFiles::findOne($id);
|
|
IdServer::url($file->file_url);
|
|
exit;
|
|
}
|
|
|
|
public function actionVideoThumb($id)
|
|
{
|
|
$file = RegisterObjectFiles::findOne($id);
|
|
IdServer::url($file->video_thumbnail);
|
|
exit;
|
|
}
|
|
|
|
public function actionStream($id)
|
|
{
|
|
$file = RegisterObjectFiles::findOne($id);
|
|
echo $file->streaming_url;
|
|
exit;
|
|
}
|
|
}
|