作者 lyh
... ... @@ -253,14 +253,14 @@ class BlogLogic extends BaseLogic
if (!$blog) {
$category_id = '';
if ($data[2]) {
if ($data[2]??'') {
//处理分类
$blogCategoryLogic = new BlogCategoryLogic();
$category_id = $blogCategoryLogic->importBlogCategory($project_id, $user_id, $data[2]);
}
$text = '';
if($data[4]){
if($data[4]??''){
//处理内容中的图片
preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result);
if($result[2]??[]){
... ... @@ -286,7 +286,7 @@ class BlogLogic extends BaseLogic
'category_id' => $category_id,
'text' => $text,
'remark' => $data[3] ?? '',
'image' => $data['5'] ? CosService::uploadRemote($project_id, 'image_blog', $data[5]) : '',
'image' => (isset($data[5]) && $data[5]) ? CosService::uploadRemote($project_id, 'image_blog', $data[5]) : '',
'seo_title' => $data[6] ?? '',
'seo_keywords' => $data[7] ?? '',
'seo_description' => $data[8] ?? '',
... ... @@ -298,7 +298,7 @@ class BlogLogic extends BaseLogic
]
);
//更新路由
$route = RouteMap::setRoute($data[1] ?: $data[0], RouteMap::SOURCE_BLOG, $id, $project_id);
$route = RouteMap::setRoute((isset($data[1]) && $data[1]) ? $data[1] : $data[0], RouteMap::SOURCE_BLOG, $id, $project_id);
$this->edit(['url' => $route], ['id' => $id]);
return true;
... ...
... ... @@ -287,14 +287,14 @@ class NewsLogic extends BaseLogic
if (!$news) {
$category_id = '';
if ($data[2]) {
if ($data[2]??'') {
//处理分类
$newsCategoryLogic = new NewsCategoryLogic();
$category_id = $newsCategoryLogic->importNewsCategory($project_id, $user_id, $data[2]);
}
$text = '';
if($data[4]){
if($data[4]??''){
//处理内容中的图片
preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result);
if($result[2]??[]){
... ... @@ -320,7 +320,7 @@ class NewsLogic extends BaseLogic
'category_id' => $category_id,
'text' => $text,
'remark' => $data[3] ?? '',
'image' => $data['5'] ? CosService::uploadRemote($project_id, 'image_news', $data[5]) : '',
'image' => (isset($data[5]) && $data[5]) ? CosService::uploadRemote($project_id, 'image_news', $data[5]) : '',
'seo_title' => $data[6] ?? '',
'seo_keywords' => $data[7] ?? '',
'seo_description' => $data[8] ?? '',
... ... @@ -332,7 +332,7 @@ class NewsLogic extends BaseLogic
]
);
//更新路由
$route = RouteMap::setRoute($data[1] ?: $data[0], RouteMap::SOURCE_NEWS, $id, $project_id);
$route = RouteMap::setRoute((isset($data[1]) && $data[1]) ? $data[1] : $data[0], RouteMap::SOURCE_NEWS, $id, $project_id);
$this->edit(['url' => $route], ['id' => $id]);
return true;
... ...
... ... @@ -600,14 +600,14 @@ class ProductLogic extends BaseLogic
if (!$product) {
$category_id = '';
if ($data[2]) {
if ($data[2]??'') {
//处理分类
$categoryLogic = new CategoryLogic();
$category_id = $categoryLogic->importProductCategory($project_id, $data[2]);
}
$keyword_id = '';
if($data[3]){
if($data[3]??''){
//处理关键词
$keywordLogic = new KeywordLogic();
$keyword_id = $keywordLogic->importProductKeyword($project_id, $data[3]);
... ... @@ -615,7 +615,7 @@ class ProductLogic extends BaseLogic
$gallery = [];
$thumb = '';
if($data[7]){
if($data[7]??''){
//处理图片
$img_arr = explode(',',$data[7]);
foreach ($img_arr as $v_img){
... ... @@ -638,7 +638,7 @@ class ProductLogic extends BaseLogic
}
$intro = '';
if($data[5]){
if($data[5]??''){
//处理短描述中的图片
preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[5], $result_intro);
if($result_intro[2]??[]){
... ... @@ -659,7 +659,7 @@ class ProductLogic extends BaseLogic
}
$content = '';
if($data[6]){
if($data[6]??''){
//处理内容中的图片
preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[6], $result_content);
if($result_content[2]??[]){
... ... @@ -688,7 +688,7 @@ class ProductLogic extends BaseLogic
//处理描述切换栏
$describe = [];
if($data[11]){
if($data[11]??''){
//处理描述切换栏中的图片
$describe = json_decode($data[11],true);
... ... @@ -730,7 +730,7 @@ class ProductLogic extends BaseLogic
]
);
//更新路由
$route = RouteMap::setRoute($data[1] ?: $data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id);
$route = RouteMap::setRoute((isset($data[1]) && $data[1]) ? $data[1] : $data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id);
$this->edit(['route' => $route], ['id' => $id]);
return true;
... ...