正在显示
2 个修改的文件
包含
28 行增加
和
2 行删除
| @@ -280,11 +280,24 @@ class BlogLogic extends BaseLogic | @@ -280,11 +280,24 @@ class BlogLogic extends BaseLogic | ||
| 280 | $category_id = $blogCategoryLogic->importBlogCategory($project_id, $user_id, $data[2]); | 280 | $category_id = $blogCategoryLogic->importBlogCategory($project_id, $user_id, $data[2]); |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | + $text = ''; | ||
| 284 | + if($data[4]){ | ||
| 285 | + //处理内容中的图片 | ||
| 286 | + $pattern = '<img src="(.*?)">'; | ||
| 287 | + preg_match_all($pattern, $data[4], $result); | ||
| 288 | + if($result[1]){ | ||
| 289 | + foreach ($result[1] as $img){ | ||
| 290 | + $data[4] = str_replace($img,getImageUrl(CosService::uploadRemote($project_id,'image_news',$img)),$data[4]); | ||
| 291 | + } | ||
| 292 | + } | ||
| 293 | + $text = $data[4]; | ||
| 294 | + } | ||
| 295 | + | ||
| 283 | $id = $this->model->addReturnId( | 296 | $id = $this->model->addReturnId( |
| 284 | [ | 297 | [ |
| 285 | 'name' => $data[0], | 298 | 'name' => $data[0], |
| 286 | 'category_id' => $category_id, | 299 | 'category_id' => $category_id, |
| 287 | - 'text' => $data[4] ?? '', | 300 | + 'text' => $text, |
| 288 | 'remark' => $data[3] ?? '', | 301 | 'remark' => $data[3] ?? '', |
| 289 | 'image' => $data['5'] ? CosService::uploadRemote($project_id, 'image_blog', $data[5]) : '', | 302 | 'image' => $data['5'] ? CosService::uploadRemote($project_id, 'image_blog', $data[5]) : '', |
| 290 | 'seo_title' => $data[6] ?? '', | 303 | 'seo_title' => $data[6] ?? '', |
| @@ -279,11 +279,24 @@ class NewsLogic extends BaseLogic | @@ -279,11 +279,24 @@ class NewsLogic extends BaseLogic | ||
| 279 | $category_id = $newsCategoryLogic->importNewsCategory($project_id, $user_id, $data[2]); | 279 | $category_id = $newsCategoryLogic->importNewsCategory($project_id, $user_id, $data[2]); |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | + $text = ''; | ||
| 283 | + if($data[4]){ | ||
| 284 | + //处理内容中的图片 | ||
| 285 | + $pattern = '<img src="(.*?)">'; | ||
| 286 | + preg_match_all($pattern, $data[4], $result); | ||
| 287 | + if($result[1]){ | ||
| 288 | + foreach ($result[1] as $img){ | ||
| 289 | + $data[4] = str_replace($img,getImageUrl(CosService::uploadRemote($project_id,'image_news',$img)),$data[4]); | ||
| 290 | + } | ||
| 291 | + } | ||
| 292 | + $text = $data[4]; | ||
| 293 | + } | ||
| 294 | + | ||
| 282 | $id = $this->model->addReturnId( | 295 | $id = $this->model->addReturnId( |
| 283 | [ | 296 | [ |
| 284 | 'name' => $data[0], | 297 | 'name' => $data[0], |
| 285 | 'category_id' => $category_id, | 298 | 'category_id' => $category_id, |
| 286 | - 'text' => $data[4] ?? '', | 299 | + 'text' => $text, |
| 287 | 'remark' => $data[3] ?? '', | 300 | 'remark' => $data[3] ?? '', |
| 288 | 'image' => $data['5'] ? CosService::uploadRemote($project_id, 'image_news', $data[5]) : '', | 301 | 'image' => $data['5'] ? CosService::uploadRemote($project_id, 'image_news', $data[5]) : '', |
| 289 | 'seo_title' => $data[6] ?? '', | 302 | 'seo_title' => $data[6] ?? '', |
-
请 注册 或 登录 后发表评论