作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !181
@@ -253,14 +253,14 @@ class BlogLogic extends BaseLogic @@ -253,14 +253,14 @@ class BlogLogic extends BaseLogic
253 if (!$blog) { 253 if (!$blog) {
254 254
255 $category_id = ''; 255 $category_id = '';
256 - if ($data[2]) { 256 + if ($data[2]??'') {
257 //处理分类 257 //处理分类
258 $blogCategoryLogic = new BlogCategoryLogic(); 258 $blogCategoryLogic = new BlogCategoryLogic();
259 $category_id = $blogCategoryLogic->importBlogCategory($project_id, $user_id, $data[2]); 259 $category_id = $blogCategoryLogic->importBlogCategory($project_id, $user_id, $data[2]);
260 } 260 }
261 261
262 $text = ''; 262 $text = '';
263 - if($data[4]){ 263 + if($data[4]??''){
264 //处理内容中的图片 264 //处理内容中的图片
265 preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result); 265 preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result);
266 if($result[2]??[]){ 266 if($result[2]??[]){
@@ -286,7 +286,7 @@ class BlogLogic extends BaseLogic @@ -286,7 +286,7 @@ class BlogLogic extends BaseLogic
286 'category_id' => $category_id, 286 'category_id' => $category_id,
287 'text' => $text, 287 'text' => $text,
288 'remark' => $data[3] ?? '', 288 'remark' => $data[3] ?? '',
289 - 'image' => $data['5'] ? CosService::uploadRemote($project_id, 'image_blog', $data[5]) : '', 289 + 'image' => (isset($data[5]) && $data[5]) ? CosService::uploadRemote($project_id, 'image_blog', $data[5]) : '',
290 'seo_title' => $data[6] ?? '', 290 'seo_title' => $data[6] ?? '',
291 'seo_keywords' => $data[7] ?? '', 291 'seo_keywords' => $data[7] ?? '',
292 'seo_description' => $data[8] ?? '', 292 'seo_description' => $data[8] ?? '',
@@ -298,7 +298,7 @@ class BlogLogic extends BaseLogic @@ -298,7 +298,7 @@ class BlogLogic extends BaseLogic
298 ] 298 ]
299 ); 299 );
300 //更新路由 300 //更新路由
301 - $route = RouteMap::setRoute($data[1] ?: $data[0], RouteMap::SOURCE_BLOG, $id, $project_id); 301 + $route = RouteMap::setRoute((isset($data[1]) && $data[1]) ? $data[1] : $data[0], RouteMap::SOURCE_BLOG, $id, $project_id);
302 $this->edit(['url' => $route], ['id' => $id]); 302 $this->edit(['url' => $route], ['id' => $id]);
303 303
304 return true; 304 return true;
@@ -287,14 +287,14 @@ class NewsLogic extends BaseLogic @@ -287,14 +287,14 @@ class NewsLogic extends BaseLogic
287 if (!$news) { 287 if (!$news) {
288 288
289 $category_id = ''; 289 $category_id = '';
290 - if ($data[2]) { 290 + if ($data[2]??'') {
291 //处理分类 291 //处理分类
292 $newsCategoryLogic = new NewsCategoryLogic(); 292 $newsCategoryLogic = new NewsCategoryLogic();
293 $category_id = $newsCategoryLogic->importNewsCategory($project_id, $user_id, $data[2]); 293 $category_id = $newsCategoryLogic->importNewsCategory($project_id, $user_id, $data[2]);
294 } 294 }
295 295
296 $text = ''; 296 $text = '';
297 - if($data[4]){ 297 + if($data[4]??''){
298 //处理内容中的图片 298 //处理内容中的图片
299 preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result); 299 preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result);
300 if($result[2]??[]){ 300 if($result[2]??[]){
@@ -320,7 +320,7 @@ class NewsLogic extends BaseLogic @@ -320,7 +320,7 @@ class NewsLogic extends BaseLogic
320 'category_id' => $category_id, 320 'category_id' => $category_id,
321 'text' => $text, 321 'text' => $text,
322 'remark' => $data[3] ?? '', 322 'remark' => $data[3] ?? '',
323 - 'image' => $data['5'] ? CosService::uploadRemote($project_id, 'image_news', $data[5]) : '', 323 + 'image' => (isset($data[5]) && $data[5]) ? CosService::uploadRemote($project_id, 'image_news', $data[5]) : '',
324 'seo_title' => $data[6] ?? '', 324 'seo_title' => $data[6] ?? '',
325 'seo_keywords' => $data[7] ?? '', 325 'seo_keywords' => $data[7] ?? '',
326 'seo_description' => $data[8] ?? '', 326 'seo_description' => $data[8] ?? '',
@@ -332,7 +332,7 @@ class NewsLogic extends BaseLogic @@ -332,7 +332,7 @@ class NewsLogic extends BaseLogic
332 ] 332 ]
333 ); 333 );
334 //更新路由 334 //更新路由
335 - $route = RouteMap::setRoute($data[1] ?: $data[0], RouteMap::SOURCE_NEWS, $id, $project_id); 335 + $route = RouteMap::setRoute((isset($data[1]) && $data[1]) ? $data[1] : $data[0], RouteMap::SOURCE_NEWS, $id, $project_id);
336 $this->edit(['url' => $route], ['id' => $id]); 336 $this->edit(['url' => $route], ['id' => $id]);
337 337
338 return true; 338 return true;
@@ -600,14 +600,14 @@ class ProductLogic extends BaseLogic @@ -600,14 +600,14 @@ class ProductLogic extends BaseLogic
600 if (!$product) { 600 if (!$product) {
601 601
602 $category_id = ''; 602 $category_id = '';
603 - if ($data[2]) { 603 + if ($data[2]??'') {
604 //处理分类 604 //处理分类
605 $categoryLogic = new CategoryLogic(); 605 $categoryLogic = new CategoryLogic();
606 $category_id = $categoryLogic->importProductCategory($project_id, $data[2]); 606 $category_id = $categoryLogic->importProductCategory($project_id, $data[2]);
607 } 607 }
608 608
609 $keyword_id = ''; 609 $keyword_id = '';
610 - if($data[3]){ 610 + if($data[3]??''){
611 //处理关键词 611 //处理关键词
612 $keywordLogic = new KeywordLogic(); 612 $keywordLogic = new KeywordLogic();
613 $keyword_id = $keywordLogic->importProductKeyword($project_id, $data[3]); 613 $keyword_id = $keywordLogic->importProductKeyword($project_id, $data[3]);
@@ -615,7 +615,7 @@ class ProductLogic extends BaseLogic @@ -615,7 +615,7 @@ class ProductLogic extends BaseLogic
615 615
616 $gallery = []; 616 $gallery = [];
617 $thumb = ''; 617 $thumb = '';
618 - if($data[7]){ 618 + if($data[7]??''){
619 //处理图片 619 //处理图片
620 $img_arr = explode(',',$data[7]); 620 $img_arr = explode(',',$data[7]);
621 foreach ($img_arr as $v_img){ 621 foreach ($img_arr as $v_img){
@@ -638,7 +638,7 @@ class ProductLogic extends BaseLogic @@ -638,7 +638,7 @@ class ProductLogic extends BaseLogic
638 } 638 }
639 639
640 $intro = ''; 640 $intro = '';
641 - if($data[5]){ 641 + if($data[5]??''){
642 //处理短描述中的图片 642 //处理短描述中的图片
643 preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[5], $result_intro); 643 preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[5], $result_intro);
644 if($result_intro[2]??[]){ 644 if($result_intro[2]??[]){
@@ -659,7 +659,7 @@ class ProductLogic extends BaseLogic @@ -659,7 +659,7 @@ class ProductLogic extends BaseLogic
659 } 659 }
660 660
661 $content = ''; 661 $content = '';
662 - if($data[6]){ 662 + if($data[6]??''){
663 //处理内容中的图片 663 //处理内容中的图片
664 preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[6], $result_content); 664 preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[6], $result_content);
665 if($result_content[2]??[]){ 665 if($result_content[2]??[]){
@@ -688,7 +688,7 @@ class ProductLogic extends BaseLogic @@ -688,7 +688,7 @@ class ProductLogic extends BaseLogic
688 688
689 //处理描述切换栏 689 //处理描述切换栏
690 $describe = []; 690 $describe = [];
691 - if($data[11]){ 691 + if($data[11]??''){
692 //处理描述切换栏中的图片 692 //处理描述切换栏中的图片
693 $describe = json_decode($data[11],true); 693 $describe = json_decode($data[11],true);
694 694
@@ -730,7 +730,7 @@ class ProductLogic extends BaseLogic @@ -730,7 +730,7 @@ class ProductLogic extends BaseLogic
730 ] 730 ]
731 ); 731 );
732 //更新路由 732 //更新路由
733 - $route = RouteMap::setRoute($data[1] ?: $data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id); 733 + $route = RouteMap::setRoute((isset($data[1]) && $data[1]) ? $data[1] : $data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id);
734 $this->edit(['route' => $route], ['id' => $id]); 734 $this->edit(['route' => $route], ['id' => $id]);
735 735
736 return true; 736 return true;