作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-lyh-edit

... ... @@ -96,6 +96,7 @@ class FileManageController extends BaseController
$cosService = new CosService();
$cosService->uploadFile($file,$path,$fileName);
$data['project_id'] = $this->user['project_id'];
$data['en_name'] = $fileName;
$data['path'] = $path.'/'.$fileName;
$rs = $fileManage->add($data);
if ($rs === false) {
... ... @@ -113,14 +114,16 @@ class FileManageController extends BaseController
*/
public function getOnlyFilename($name,$project_id = 0){
$nameArr = explode('.',$name);
$enName = generateRoute(Translate::tran($nameArr[0], 'en'));
$suffix = array_pop($nameArr) ?? 'txt';
$nameStr = implode('-', $nameArr);
$enName = generateRoute(Translate::tran($nameStr, 'en'));
$fileName = $enName;
$i=1;
while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){
while($this->onlyName($enName.'.'.$suffix,$project_id)){
$enName = $fileName .'-'.$i;
$i++;
}
return $enName.'.'.$nameArr[1];
return $enName.'.'.$suffix;
}
/**
... ... @@ -154,7 +157,7 @@ class FileManageController extends BaseController
if(!in_array($extension, explode(',', $this->upload_config['allow_file_type']))){
$this->fail('不允许上传的文件类型');
}
$hash = hash_file('md5', $file->getPathname());
$hash = hash_file('sha256', $file->getPathname());
$info = FileManage::where('hash', $hash)->first();
if($info){
$this->fail('文件已上传,文件名称.'.$info['name']);
... ...
... ... @@ -195,7 +195,7 @@ class FileController
*/
public function api_upload_single(&$files)
{
$hash = hash_file('md5', $files->getPathname());
$hash = hash_file('sha256', $files->getPathname());
$name = $files->getFilename();
//查看文件是否存在
$fileModel = new File();
... ...
... ... @@ -9,6 +9,7 @@ use App\Models\Service\Service as ServiceSettingModel;
use App\Models\Template\BCustomTemplate;
use App\Models\Template\BTemplateCommon;
use App\Models\Template\BTemplateLog;
use App\Models\Template\BTemplateMain;
use App\Models\Template\Setting;
use App\Models\Template\BTemplate;
... ... @@ -83,6 +84,13 @@ class CustomTemplateLogic extends BaseLogic
if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
$this->fail('404页面已存在');
}
if($this->param['url'] == 'search'){
$bTemplateMainModel = new BTemplateMain();
$mainInfo = $bTemplateMainModel->read(['type'=>8]);
if($mainInfo !== false){
$this->param['html'] = $mainInfo['main_html'];
}
}
$this->param['project_id'] = $this->user['project_id'];
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
... ...