Merge remote-tracking branch 'origin/master' into akun
正在显示
12 个修改的文件
包含
122 行增加
和
36 行删除
| @@ -103,7 +103,7 @@ class DeleteCustomCategory extends Command | @@ -103,7 +103,7 @@ class DeleteCustomCategory extends Command | ||
| 103 | return false; | 103 | return false; |
| 104 | } | 104 | } |
| 105 | foreach ($customList['list'] as $v){ | 105 | foreach ($customList['list'] as $v){ |
| 106 | - $category_id_arr = Arr::setToArr(trim($v['category_id'],',')); | 106 | + $category_id_arr = $v['category_id']; |
| 107 | if(empty($category_id_arr)){ | 107 | if(empty($category_id_arr)){ |
| 108 | continue; | 108 | continue; |
| 109 | } | 109 | } |
| @@ -87,7 +87,7 @@ class VideoTask extends Command | @@ -87,7 +87,7 @@ class VideoTask extends Command | ||
| 87 | continue; | 87 | continue; |
| 88 | } | 88 | } |
| 89 | ProjectServer::useProject($task_project->project_id); | 89 | ProjectServer::useProject($task_project->project_id); |
| 90 | - $keyword = $this->getProjectKeyword($task_project->number); | 90 | + $keyword = $this->getProjectKeyword($task_project->num); |
| 91 | // 已经没有需要生成视频的关键词 | 91 | // 已经没有需要生成视频的关键词 |
| 92 | if (!$keyword) { | 92 | if (!$keyword) { |
| 93 | $task_project->status = KeywordVideoTask::STATUS_CLOSE; | 93 | $task_project->status = KeywordVideoTask::STATUS_CLOSE; |
| @@ -95,7 +95,13 @@ class VideoTask extends Command | @@ -95,7 +95,13 @@ class VideoTask extends Command | ||
| 95 | continue; | 95 | continue; |
| 96 | } | 96 | } |
| 97 | $logo_bg = $this->getImage($domainInfo); | 97 | $logo_bg = $this->getImage($domainInfo); |
| 98 | + $num = $task_project->num; | ||
| 98 | foreach ($keyword as $val) { | 99 | foreach ($keyword as $val) { |
| 100 | + if($sub_task_num == 0){ | ||
| 101 | + $task_project->num = $num; | ||
| 102 | + $task_project->save(); | ||
| 103 | + break; | ||
| 104 | + } | ||
| 99 | $log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first(); | 105 | $log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first(); |
| 100 | if ($log){ | 106 | if ($log){ |
| 101 | continue; | 107 | continue; |
| @@ -114,11 +120,15 @@ class VideoTask extends Command | @@ -114,11 +120,15 @@ class VideoTask extends Command | ||
| 114 | 'created_at' => date('Y-m-d H:i:s'), | 120 | 'created_at' => date('Y-m-d H:i:s'), |
| 115 | ]; | 121 | ]; |
| 116 | KeywordVideoTaskLog::insert($array); | 122 | KeywordVideoTaskLog::insert($array); |
| 123 | + $num--; | ||
| 117 | $sub_task_num--; | 124 | $sub_task_num--; |
| 118 | } | 125 | } |
| 119 | } | 126 | } |
| 120 | - $task_project->status = KeywordVideoTask::STATUS_CLOSE; | ||
| 121 | - $task_project->save(); | 127 | + if($sub_task_num != 0){ |
| 128 | + $task_project->num = 0; | ||
| 129 | + $task_project->status = KeywordVideoTask::STATUS_CLOSE; | ||
| 130 | + $task_project->save(); | ||
| 131 | + } | ||
| 122 | } | 132 | } |
| 123 | return true; | 133 | return true; |
| 124 | } | 134 | } |
| @@ -171,6 +181,12 @@ class VideoTask extends Command | @@ -171,6 +181,12 @@ class VideoTask extends Command | ||
| 171 | public function getProjectKeyword($number) | 181 | public function getProjectKeyword($number) |
| 172 | { | 182 | { |
| 173 | $keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')->pluck('id')->toArray(); | 183 | $keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')->pluck('id')->toArray(); |
| 184 | + if(count($keyword_arr_id) == 0){ | ||
| 185 | + return []; | ||
| 186 | + } | ||
| 187 | + if(count($keyword_arr_id) < $number){ | ||
| 188 | + $number = count($keyword_arr_id); | ||
| 189 | + } | ||
| 174 | $keyword_id = array_rand($keyword_arr_id, $number); | 190 | $keyword_id = array_rand($keyword_arr_id, $number); |
| 175 | $keyword = Keyword::whereIn("id", $keyword_id)->get(); | 191 | $keyword = Keyword::whereIn("id", $keyword_id)->get(); |
| 176 | return $keyword; | 192 | return $keyword; |
| @@ -125,22 +125,37 @@ class ReplaceHtml extends Command | @@ -125,22 +125,37 @@ class ReplaceHtml extends Command | ||
| 125 | * @time :2024/5/10 17:26 | 125 | * @time :2024/5/10 17:26 |
| 126 | */ | 126 | */ |
| 127 | public function createReplaceHtmlLog($info){ | 127 | public function createReplaceHtmlLog($info){ |
| 128 | - $bTemplateModel = new BTemplate(); | ||
| 129 | - $condition = ['is_custom'=>$info['is_custom'], 'is_list'=>$info['is_list'], 'template_id'=>$info['template_id']]; | ||
| 130 | - if($info['source'] != 0){ | ||
| 131 | - $condition['source'] = $info['source']; | ||
| 132 | - } | ||
| 133 | - if($info['template_id'] != 0){ | ||
| 134 | - $condition['main_html'] = ['like','%'.trim($info['old_html']).'%']; | 128 | + if($info['is_rollback'] != 0){ |
| 129 | + $saveData = []; | ||
| 130 | + $templateHtmlLogModel = new TemplateReplaceHtmlLog(); | ||
| 131 | + $list = $templateHtmlLogModel->list(['replace_id'=>$info['rollback_id']]); | ||
| 132 | + foreach ($list as $value){ | ||
| 133 | + $value['replace_id'] = $info['id']; | ||
| 134 | + $value['is_rollback'] = $info['is_rollback']; | ||
| 135 | + $value['old_html'] = $info['old_html']; | ||
| 136 | + $value['html'] = $info['html']; | ||
| 137 | + $value['created_at'] = date('Y-m-d H:i:s'); | ||
| 138 | + $value['updated_at'] = date('Y-m-d H:i:s'); | ||
| 139 | + $saveData[] = $value; | ||
| 140 | + } | ||
| 135 | }else{ | 141 | }else{ |
| 136 | - $condition['html'] = ['like','%'.trim($info['old_html']).'%']; | ||
| 137 | - } | ||
| 138 | - $bTemplateList = $bTemplateModel->list($condition); | ||
| 139 | - $saveData = []; | ||
| 140 | - foreach ($bTemplateList as $v){ | ||
| 141 | - $source_id = $v['source'] == 1 ? 0 : $v['source_id']; | ||
| 142 | - $name = $this->getSourceName($v['source'],$source_id,$v['is_list'],$v['is_custom']); | ||
| 143 | - $saveData[] = $this->saveData($info,$v,$source_id,$name); | 142 | + $bTemplateModel = new BTemplate(); |
| 143 | + $condition = ['is_custom'=>$info['is_custom'], 'is_list'=>$info['is_list'], 'template_id'=>$info['template_id']]; | ||
| 144 | + if($info['source'] != 0){ | ||
| 145 | + $condition['source'] = $info['source']; | ||
| 146 | + } | ||
| 147 | + if($info['template_id'] != 0){ | ||
| 148 | + $condition['main_html'] = ['like','%'.trim($info['old_html']).'%']; | ||
| 149 | + }else{ | ||
| 150 | + $condition['html'] = ['like','%'.trim($info['old_html']).'%']; | ||
| 151 | + } | ||
| 152 | + $bTemplateList = $bTemplateModel->list($condition); | ||
| 153 | + $saveData = []; | ||
| 154 | + foreach ($bTemplateList as $v){ | ||
| 155 | + $source_id = $v['source'] == 1 ? 0 : $v['source_id']; | ||
| 156 | + $name_route = $this->getSourceName($v['source'],$source_id,$v['is_list'],$v['is_custom']); | ||
| 157 | + $saveData[] = $this->saveData($info,$v,$source_id,$name_route); | ||
| 158 | + } | ||
| 144 | } | 159 | } |
| 145 | if(!empty($saveData)){ | 160 | if(!empty($saveData)){ |
| 146 | $templateHtmlLogModel = new TemplateReplaceHtmlLog(); | 161 | $templateHtmlLogModel = new TemplateReplaceHtmlLog(); |
| @@ -156,7 +171,7 @@ class ReplaceHtml extends Command | @@ -156,7 +171,7 @@ class ReplaceHtml extends Command | ||
| 156 | * @method :post | 171 | * @method :post |
| 157 | * @time :2024/5/13 11:29 | 172 | * @time :2024/5/13 11:29 |
| 158 | */ | 173 | */ |
| 159 | - public function saveData($info,$v,$source_id,$name){ | 174 | + public function saveData($info,$v,$source_id,$name_route){ |
| 160 | return [ | 175 | return [ |
| 161 | 'replace_id'=>$info['id'], | 176 | 'replace_id'=>$info['id'], |
| 162 | 'project_id'=>$info['project_id'], | 177 | 'project_id'=>$info['project_id'], |
| @@ -169,7 +184,8 @@ class ReplaceHtml extends Command | @@ -169,7 +184,8 @@ class ReplaceHtml extends Command | ||
| 169 | 'is_list'=>$v['is_list'], | 184 | 'is_list'=>$v['is_list'], |
| 170 | 'is_rollback'=>$info['is_rollback'], | 185 | 'is_rollback'=>$info['is_rollback'], |
| 171 | 'template_id'=>$info['template_id'], | 186 | 'template_id'=>$info['template_id'], |
| 172 | - 'source_name'=>$name, | 187 | + 'source_name'=>$name_route['name'], |
| 188 | + 'route'=>$name_route['route'], | ||
| 173 | 'created_at'=>date('Y-m-d H:i:s'), | 189 | 'created_at'=>date('Y-m-d H:i:s'), |
| 174 | 'updated_at'=>date('Y-m-d H:i:s') | 190 | 'updated_at'=>date('Y-m-d H:i:s') |
| 175 | ]; | 191 | ]; |
| @@ -231,6 +247,7 @@ class ReplaceHtml extends Command | @@ -231,6 +247,7 @@ class ReplaceHtml extends Command | ||
| 231 | return false; | 247 | return false; |
| 232 | } | 248 | } |
| 233 | $name = $cateInfo['name']; | 249 | $name = $cateInfo['name']; |
| 250 | + $route = $cateInfo['alias']; | ||
| 234 | }else{ | 251 | }else{ |
| 235 | $newsModel = new News(); | 252 | $newsModel = new News(); |
| 236 | $newsInfo = $newsModel->read(['id'=>$source_id]); | 253 | $newsInfo = $newsModel->read(['id'=>$source_id]); |
| @@ -238,8 +255,9 @@ class ReplaceHtml extends Command | @@ -238,8 +255,9 @@ class ReplaceHtml extends Command | ||
| 238 | return false; | 255 | return false; |
| 239 | } | 256 | } |
| 240 | $name = $newsInfo['name']; | 257 | $name = $newsInfo['name']; |
| 258 | + $route = $newsInfo['url']; | ||
| 241 | } | 259 | } |
| 242 | - return $name; | 260 | + return ['name'=>$name,'route'=>$route]; |
| 243 | } | 261 | } |
| 244 | 262 | ||
| 245 | /** | 263 | /** |
| @@ -257,6 +275,7 @@ class ReplaceHtml extends Command | @@ -257,6 +275,7 @@ class ReplaceHtml extends Command | ||
| 257 | return false; | 275 | return false; |
| 258 | } | 276 | } |
| 259 | $name = $cateInfo['name']; | 277 | $name = $cateInfo['name']; |
| 278 | + $route = $cateInfo['alias']; | ||
| 260 | }else{ | 279 | }else{ |
| 261 | $blogModel = new Blog(); | 280 | $blogModel = new Blog(); |
| 262 | $productInfo = $blogModel->read(['id'=>$source_id]); | 281 | $productInfo = $blogModel->read(['id'=>$source_id]); |
| @@ -264,8 +283,9 @@ class ReplaceHtml extends Command | @@ -264,8 +283,9 @@ class ReplaceHtml extends Command | ||
| 264 | return false; | 283 | return false; |
| 265 | } | 284 | } |
| 266 | $name = $productInfo['name']; | 285 | $name = $productInfo['name']; |
| 286 | + $route = $productInfo['url']; | ||
| 267 | } | 287 | } |
| 268 | - return $name; | 288 | + return ['name'=>$name,'route'=>$route]; |
| 269 | } | 289 | } |
| 270 | 290 | ||
| 271 | /** | 291 | /** |
| @@ -283,6 +303,7 @@ class ReplaceHtml extends Command | @@ -283,6 +303,7 @@ class ReplaceHtml extends Command | ||
| 283 | return false; | 303 | return false; |
| 284 | } | 304 | } |
| 285 | $name = $cateInfo['title']; | 305 | $name = $cateInfo['title']; |
| 306 | + $route = $cateInfo['route']; | ||
| 286 | }else{ | 307 | }else{ |
| 287 | $productModel = new Product(); | 308 | $productModel = new Product(); |
| 288 | $productInfo = $productModel->read(['id'=>$source_id]); | 309 | $productInfo = $productModel->read(['id'=>$source_id]); |
| @@ -290,8 +311,9 @@ class ReplaceHtml extends Command | @@ -290,8 +311,9 @@ class ReplaceHtml extends Command | ||
| 290 | return false; | 311 | return false; |
| 291 | } | 312 | } |
| 292 | $name = $productInfo['title']; | 313 | $name = $productInfo['title']; |
| 314 | + $route = $productInfo['route']; | ||
| 293 | } | 315 | } |
| 294 | - return $name; | 316 | + return ['name'=>$name,'route'=>$route]; |
| 295 | } | 317 | } |
| 296 | 318 | ||
| 297 | /** | 319 | /** |
| @@ -314,6 +336,7 @@ class ReplaceHtml extends Command | @@ -314,6 +336,7 @@ class ReplaceHtml extends Command | ||
| 314 | return false; | 336 | return false; |
| 315 | } | 337 | } |
| 316 | $name = $cateInfo['name']; | 338 | $name = $cateInfo['name']; |
| 339 | + $route = $cateInfo['route']; | ||
| 317 | }else{ | 340 | }else{ |
| 318 | $contentModel = new CustomModuleContent(); | 341 | $contentModel = new CustomModuleContent(); |
| 319 | $contentInfo = $contentModel->read(['id'=>$source_id],['id','name']); | 342 | $contentInfo = $contentModel->read(['id'=>$source_id],['id','name']); |
| @@ -321,7 +344,8 @@ class ReplaceHtml extends Command | @@ -321,7 +344,8 @@ class ReplaceHtml extends Command | ||
| 321 | return false; | 344 | return false; |
| 322 | } | 345 | } |
| 323 | $name = $contentInfo['name']; | 346 | $name = $contentInfo['name']; |
| 347 | + $route = $contentInfo['route']; | ||
| 324 | } | 348 | } |
| 325 | - return $name; | 349 | + return ['name'=>$name,'route'=>$route]; |
| 326 | } | 350 | } |
| 327 | } | 351 | } |
| @@ -80,7 +80,7 @@ class ReplaceHtmlLog extends Command | @@ -80,7 +80,7 @@ class ReplaceHtmlLog extends Command | ||
| 80 | public function replaceHtml($info){ | 80 | public function replaceHtml($info){ |
| 81 | $source_id = $info['source'] == 1 ? 0 : $info['source_id']; | 81 | $source_id = $info['source'] == 1 ? 0 : $info['source_id']; |
| 82 | $bTemplateModel = new BTemplate(); | 82 | $bTemplateModel = new BTemplate(); |
| 83 | - $condition = ['source'=>$info['source'],'source_id'=>$info['source_id'], | 83 | + $condition = ['source'=>$info['source'],'source_id'=>$source_id, |
| 84 | 'template_id'=>$info['template_id'],'is_custom'=>$info['is_custom'],'is_list'=>$info['is_list']]; | 84 | 'template_id'=>$info['template_id'],'is_custom'=>$info['is_custom'],'is_list'=>$info['is_list']]; |
| 85 | $old_html = $info['old_html']; | 85 | $old_html = $info['old_html']; |
| 86 | $html = $info['html']; | 86 | $html = $info['html']; |
| @@ -610,7 +610,6 @@ if (!function_exists('getFileUrl')) { | @@ -610,7 +610,6 @@ if (!function_exists('getFileUrl')) { | ||
| 610 | return $cdn2.$path; | 610 | return $cdn2.$path; |
| 611 | } | 611 | } |
| 612 | if($location == 0){ | 612 | if($location == 0){ |
| 613 | - //v6-file.globalso.com | ||
| 614 | $cos = config('filesystems.disks.cos'); | 613 | $cos = config('filesystems.disks.cos'); |
| 615 | $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; | 614 | $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; |
| 616 | return $cosCdn.$path; | 615 | return $cosCdn.$path; |
| @@ -108,7 +108,7 @@ class KeywordVideoController extends BaseController | @@ -108,7 +108,7 @@ class KeywordVideoController extends BaseController | ||
| 108 | if($info === false){ | 108 | if($info === false){ |
| 109 | $this->response('请先设置域名',Code::SYSTEM_ERROR); | 109 | $this->response('请先设置域名',Code::SYSTEM_ERROR); |
| 110 | } | 110 | } |
| 111 | - | 111 | + $this->param['num'] = $this->param['number']; |
| 112 | $rs = $keywordModel->add($this->param); | 112 | $rs = $keywordModel->add($this->param); |
| 113 | if($rs === false){ | 113 | if($rs === false){ |
| 114 | $this->response('添加失败',Code::SYSTEM_ERROR); | 114 | $this->response('添加失败',Code::SYSTEM_ERROR); |
| @@ -130,6 +130,9 @@ class KeywordVideoController extends BaseController | @@ -130,6 +130,9 @@ class KeywordVideoController extends BaseController | ||
| 130 | 'id.required' => '主键标识不为空', | 130 | 'id.required' => '主键标识不为空', |
| 131 | ]); | 131 | ]); |
| 132 | $keywordModel = new KeywordVideoTask(); | 132 | $keywordModel = new KeywordVideoTask(); |
| 133 | + if($this->param['status'] == 0){ | ||
| 134 | + $this->param['num'] = $this->param['number']; | ||
| 135 | + } | ||
| 133 | $rs = $keywordModel->edit($this->param,['id'=>$this->param['id']]); | 136 | $rs = $keywordModel->edit($this->param,['id'=>$this->param['id']]); |
| 134 | if($rs === false){ | 137 | if($rs === false){ |
| 135 | $this->response('编辑失败',Code::SYSTEM_ERROR); | 138 | $this->response('编辑失败',Code::SYSTEM_ERROR); |
| @@ -134,7 +134,7 @@ class FileController | @@ -134,7 +134,7 @@ class FileController | ||
| 134 | $amazonS3Service->uploadFiles($files,$this->path,$fileName); | 134 | $amazonS3Service->uploadFiles($files,$this->path,$fileName); |
| 135 | } | 135 | } |
| 136 | $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name); | 136 | $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name); |
| 137 | - $this->synchronizationFile($fileName,($this->upload_location == 0) ? 1 : 0); | 137 | + $this->synchronizationFile($fileName,$this->upload_location); |
| 138 | $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); | 138 | $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| @@ -303,7 +303,7 @@ class FileController | @@ -303,7 +303,7 @@ class FileController | ||
| 303 | $mime = $file->getMimeType(); | 303 | $mime = $file->getMimeType(); |
| 304 | $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name); | 304 | $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name); |
| 305 | $data[] = $this->responseData($this->path.'/'.$fileName, $name); | 305 | $data[] = $this->responseData($this->path.'/'.$fileName, $name); |
| 306 | - $this->synchronizationFile($fileName,($this->upload_location == 0) ? 1 : 0); | 306 | + $this->synchronizationFile($fileName,$this->upload_location); |
| 307 | } | 307 | } |
| 308 | $this->response('资源',Code::SUCCESS,$data); | 308 | $this->response('资源',Code::SUCCESS,$data); |
| 309 | } | 309 | } |
| @@ -215,7 +215,7 @@ class ImageController extends Controller | @@ -215,7 +215,7 @@ class ImageController extends Controller | ||
| 215 | $amazonS3Service->uploadFiles($files,$this->path,$fileName); | 215 | $amazonS3Service->uploadFiles($files,$this->path,$fileName); |
| 216 | } | 216 | } |
| 217 | $this->saveMysql($imageModel,$files->getSize(),$image_type,$fileName,$hash,$this->upload_location,$files->getMimeType(), $name); | 217 | $this->saveMysql($imageModel,$files->getSize(),$image_type,$fileName,$hash,$this->upload_location,$files->getMimeType(), $name); |
| 218 | - $this->synchronizationImage($fileName,($this->upload_location == 0) ? 1 : 0); | 218 | + $this->synchronizationImage($fileName,$this->upload_location); |
| 219 | return $this->response('图片资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); | 219 | return $this->response('图片资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); |
| 220 | } | 220 | } |
| 221 | 221 | ||
| @@ -347,7 +347,7 @@ class ImageController extends Controller | @@ -347,7 +347,7 @@ class ImageController extends Controller | ||
| 347 | } | 347 | } |
| 348 | //批量存储 | 348 | //批量存储 |
| 349 | $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); | 349 | $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); |
| 350 | - $this->synchronizationImage($fileName,($this->upload_location == 0) ? 1 : 0); | 350 | + $this->synchronizationImage($fileName,$this->upload_location); |
| 351 | $data[] = $this->responseData($this->path.'/'.$fileName,$name); | 351 | $data[] = $this->responseData($this->path.'/'.$fileName,$name); |
| 352 | } | 352 | } |
| 353 | $this->response('图片资源',Code::SUCCESS,$data); | 353 | $this->response('图片资源',Code::SUCCESS,$data); |
| @@ -97,7 +97,8 @@ class InitHtmlLogic extends BaseLogic | @@ -97,7 +97,8 @@ class InitHtmlLogic extends BaseLogic | ||
| 97 | $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]); | 97 | $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]); |
| 98 | if($mainInfo === false){ | 98 | if($mainInfo === false){ |
| 99 | $data = [ | 99 | $data = [ |
| 100 | - 'main_html'=>characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'), | 100 | + 'html'=>$this->param['html'], |
| 101 | + 'main_html'=>characterTruncationStr($this->param['html'],"<main","</main>"), | ||
| 101 | 'main_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'), | 102 | 'main_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'), |
| 102 | 'section_list_id'=>$this->param['section_list_id'] ?? '', | 103 | 'section_list_id'=>$this->param['section_list_id'] ?? '', |
| 103 | 'project_id'=>$this->user['project_id'], | 104 | 'project_id'=>$this->user['project_id'], |
| @@ -108,7 +109,8 @@ class InitHtmlLogic extends BaseLogic | @@ -108,7 +109,8 @@ class InitHtmlLogic extends BaseLogic | ||
| 108 | $bTemplateMainModel->add($data); | 109 | $bTemplateMainModel->add($data); |
| 109 | }else{ | 110 | }else{ |
| 110 | $data = [ | 111 | $data = [ |
| 111 | - 'main_html'=>characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'), | 112 | + 'html'=>$this->param['html'], |
| 113 | + 'main_html'=>characterTruncationStr($this->param['html'],"<main","</main>"), | ||
| 112 | 'main_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'), | 114 | 'main_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'), |
| 113 | 'section_list_id'=>$this->param['section_list_id'] ?? '', | 115 | 'section_list_id'=>$this->param['section_list_id'] ?? '', |
| 114 | ]; | 116 | ]; |
| @@ -359,6 +359,11 @@ class TranslateLogic extends BaseLogic | @@ -359,6 +359,11 @@ class TranslateLogic extends BaseLogic | ||
| 359 | $data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0]; | 359 | $data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0]; |
| 360 | } | 360 | } |
| 361 | } | 361 | } |
| 362 | + if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT_KEYWORD){ | ||
| 363 | + if($routeInfo['source_id']){ | ||
| 364 | + $data = ['source'=>8,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0]; | ||
| 365 | + } | ||
| 366 | + } | ||
| 362 | if($routeInfo['source'] == RouteMap::SOURCE_MODULE){ | 367 | if($routeInfo['source'] == RouteMap::SOURCE_MODULE){ |
| 363 | if($routeInfo['source_id']){ | 368 | if($routeInfo['source_id']){ |
| 364 | $data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>1]; | 369 | $data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>1]; |
| @@ -38,8 +38,9 @@ class SyncImageFileJob implements ShouldQueue | @@ -38,8 +38,9 @@ class SyncImageFileJob implements ShouldQueue | ||
| 38 | */ | 38 | */ |
| 39 | public function handle() | 39 | public function handle() |
| 40 | { | 40 | { |
| 41 | - $file_path = getImageUrl($this->param['path'].'/'.$this->param['name'], 0,$this->param['location']); | 41 | + $file_path = $this->getUrl($this->param['path'].'/'.$this->param['name'], 0,$this->param['location']); |
| 42 | $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php'; | 42 | $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php'; |
| 43 | + echo date('Y-m-d H:i:s') . ' | ' . $cmd . PHP_EOL; | ||
| 43 | $code = shell_exec($cmd); | 44 | $code = shell_exec($cmd); |
| 44 | if(200 != (int)$code){ | 45 | if(200 != (int)$code){ |
| 45 | $errorFileModel = new ErrorFile(); | 46 | $errorFileModel = new ErrorFile(); |
| @@ -47,4 +48,40 @@ class SyncImageFileJob implements ShouldQueue | @@ -47,4 +48,40 @@ class SyncImageFileJob implements ShouldQueue | ||
| 47 | } | 48 | } |
| 48 | return true; | 49 | return true; |
| 49 | } | 50 | } |
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * @remark :获取图片文件链接 | ||
| 54 | + * @name :getUrl | ||
| 55 | + * @author :lyh | ||
| 56 | + * @method :post | ||
| 57 | + * @time :2024/5/22 11:53 | ||
| 58 | + */ | ||
| 59 | + public function getUrl($path,$storage_type,$location){ | ||
| 60 | + if(is_array($path)){ | ||
| 61 | + $url =[]; | ||
| 62 | + foreach ($path as $v){ | ||
| 63 | + $url[] = $this->getUrl($v,$storage_type,$location); | ||
| 64 | + } | ||
| 65 | + }else{ | ||
| 66 | + if(empty($path)){ | ||
| 67 | + return ''; | ||
| 68 | + } | ||
| 69 | + if((strpos($path,'https://')!== false) || (strpos($path,'http://') !== false)){ | ||
| 70 | + return $path; | ||
| 71 | + } | ||
| 72 | + if(substr($path,0,2) == '//'){ | ||
| 73 | + return 'https:'.$path; | ||
| 74 | + } | ||
| 75 | + if($location == 0){ | ||
| 76 | + $cos = config('filesystems.disks.cos'); | ||
| 77 | + $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; | ||
| 78 | + $url = $cosCdn.$path; | ||
| 79 | + }else{ | ||
| 80 | + $s3 = config('filesystems.disks.s3'); | ||
| 81 | + $cdn = $s3['cdn']; | ||
| 82 | + $url = $cdn.$path; | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + return $url; | ||
| 86 | + } | ||
| 50 | } | 87 | } |
| @@ -36,7 +36,7 @@ class TemplateReplaceHtml extends Base | @@ -36,7 +36,7 @@ class TemplateReplaceHtml extends Base | ||
| 36 | '新闻列表'=>['source'=>4,'is_list'=>1,'is_custom'=>0], | 36 | '新闻列表'=>['source'=>4,'is_list'=>1,'is_custom'=>0], |
| 37 | '博客详情'=>['source'=>3,'is_list'=>0,'is_custom'=>0], | 37 | '博客详情'=>['source'=>3,'is_list'=>0,'is_custom'=>0], |
| 38 | '博客列表'=>['source'=>3,'is_list'=>1,'is_custom'=>0], | 38 | '博客列表'=>['source'=>3,'is_list'=>1,'is_custom'=>0], |
| 39 | -// '单页面'=>['source'=>9,'is_list'=>0,'is_custom'=>0], | 39 | + '单页面'=>['source'=>9,'is_list'=>0,'is_custom'=>0], |
| 40 | ]; | 40 | ]; |
| 41 | } | 41 | } |
| 42 | } | 42 | } |
-
请 注册 或 登录 后发表评论