|
|
@@ -608,6 +608,14 @@ class NewsService implements NewsServiceInterface
|
|
|
'article_id' => $id,
|
|
|
'content' => $data['content'],
|
|
|
];
|
|
|
+ // 采集器中的文章内容,在添加时,去掉div标签
|
|
|
+ if($is_collect == 1){
|
|
|
+ // 采集来的文章,content中可能包含div标签,需要先移除
|
|
|
+ $pattern = '/<\/?div\b(?:[^"\'>]|"[^"]*"|\'[^\']*\')*>/is';
|
|
|
+ $article_data = preg_replace($pattern, '', $data['content']);
|
|
|
+ $$articleDataContent['content'] = ArticleData::where('article_id', $data['id'])->update(['content' => $article_data]);
|
|
|
+ }
|
|
|
+
|
|
|
$contentInsertId = ArticleData::insertGetId($articleDataContent);
|
|
|
if (!$contentInsertId) {
|
|
|
throw new \Exception('文章内容插入失败');
|