作者 lyh

更新产品

... ... @@ -644,11 +644,11 @@ if (!function_exists('getFileUrl')) {
* @method :post
* @time :2023/7/20 16:46
*/
function getFileUrl($path,$storage_type = 0,$location = 0){
function getFileUrl($path,$storage_type = 0,$location = 0,$file_cdn = 0){
if(is_array($path)){
$url =[];
foreach ($path as $v){
$url[] = getFileUrl($v,$storage_type,$location);
$url[] = getFileUrl($v,$storage_type,$location,$file_cdn);
}
}else{
if(empty($path)){
... ... @@ -662,7 +662,7 @@ if (!function_exists('getFileUrl')) {
}
$file_type = pathinfo($path, PATHINFO_EXTENSION);
$fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx'];
if(in_array(strtolower($file_type),$fileTypeArr)){
if(in_array(strtolower($file_type),$fileTypeArr) && ($file_cdn == 0)){
$cdn2 = config('filesystems.disks.cos')['cdn2'];
return $cdn2.$path;
}
... ...
... ... @@ -85,7 +85,7 @@ class CustomModuleContentController extends BaseController
$v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
if(!empty($v['video'])){
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn']);
$v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
return $this->success($v);
... ...
... ... @@ -133,11 +133,11 @@ class ProductController extends BaseController
}
}
if(!empty($v['video'])){
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn']);
$v['video']['video_image'] = getImageUrl($v['video']['video_image'] ?? '',$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
if(!empty($v['files']) && !empty($v['files']['url'])){
$v['files']['url'] = getFileUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
$v['files']['url'] = getFileUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn']);
}
return $this->success($v);
}
... ... @@ -379,9 +379,9 @@ class ProductController extends BaseController
foreach ($arr1 as $k1=>$v1){
$v1 = (array)$v1;
if(isset($v1['url'])){
$v1['url'] = getFileUrl($v1['url'],$this->user['storage_type'],$this->user['project_location']);
$v1['url'] = getFileUrl($v1['url'],$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn']);
}else{
$v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location']);
$v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn']);
}
$arr1[$k1] = $v1;
}
... ...
... ... @@ -342,7 +342,7 @@ class FileController
if ($info === false) {
$this->response('指定文件不存在!', Code::USER_ERROR);
}
$fileUrl = getFileUrl($info['path'],$info['is_cos']);
$fileUrl = getFileUrl($info['path'],$this->cache['storage_type'] ?? 0,$this->cache['project_location'] ?? 0,$this->cache['file_cdn'] ?? 0);
// 设置响应头
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
... ... @@ -392,7 +392,7 @@ class FileController
$fileModel = new File();
$lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at','name']);
foreach ($lists as $k => $v){
$v['file_link'] = getFileUrl($v['path'],$this->cache['storage_type'] ?? 0);
$v['file_link'] = getFileUrl($v['path'],$this->cache['storage_type'] ?? 0,$this->cache['project_location'] ?? 0,$this->cache['file_cdn'] ?? 0);
$lists[$k] = $v;
}
$this->response('success',Code::SUCCESS,$lists);
... ... @@ -408,7 +408,7 @@ class FileController
public function responseData($path, $name){
$data = [
'file'=>$path,
'file_link'=>getFileUrl($path,$this->cache['storage_type'] ?? 0),
'file_link'=>getFileUrl($path,$this->cache['storage_type'] ?? 0,$this->cache['project_location'] ?? 0,$this->cache['file_cdn'] ?? 0),
'name'=>$name,
'file_download'=>url('a/download_files?path='.$path)
];
... ...
... ... @@ -66,7 +66,7 @@ class AyrReleaseLogic extends BaseLogic
$arr[] = getImageUrl($v1);
}
}else{
$arr[] = getFileUrl($v);
$arr[] = getFileUrl($v,$this->user['storage_type'] ?? 0,$this->user['project_location'] ?? 0,$this->user['file_cdn'] ?? 0);
}
}
}
... ...
... ... @@ -94,7 +94,7 @@ class CustomModuleContentLogic extends BaseLogic
}elseif($v['type'] == 4){
$arr1 = json_decode($info['values']);
foreach ($arr1 as $k1=>$v1){
$v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location']);
$v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn']);
$arr1[$k1] = $v1;
}
$v['values'] = $arr1;
... ...
... ... @@ -80,6 +80,9 @@ class TranslateLogic extends BaseLogic
if(!empty($arr2)){
$i = 0;
TranslateText:
if($languageInfo['short'] == 'zh-ct'){
$languageInfo['short'] = 'zh-TW';
}
$translate_list = Translate::tran($arr2, $languageInfo['short']);
if(empty($translate_list)){
if ($i < 3) {
... ...
... ... @@ -279,6 +279,7 @@ class UserLoginLogic
$info['project_type'] = $project['type'];
$info['storage_type'] = $project['storage_type'];
$info['project_location'] = $project['project_location'];
$info['file_cnd'] = $project['deploy_build']['file_cnd'];
$info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0;
$info['remain_day'] = $project['remain_day'] ?? 0;
if($info['is_customized'] == 1){
... ...