Skip to content

Commit 763eef4

Browse files
committed
desc改为从content截取
1 parent 8d0e15a commit 763eef4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/Import/ArticleImport.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function rules(): array
1414
return [
1515
'*.title' => 'required|string|max:512',
1616
'*.content' => 'required|string',
17-
'*.description' => 'sometimes|string',
17+
// '*.description' => 'nullable|string',
1818
'*.category_id' => 'required|integer|exists:blog_categories,id',
1919
'*.seo_meta_title' => 'nullable|string|max:512',
2020
'*.seo_meta_keywords' => 'nullable|string|max:512',
@@ -27,6 +27,8 @@ public function model(array $row)
2727
{
2828
$blogController = new BlogController();
2929
$row['cover_image'] = $blogController->extractFirstImageFromContent($row['content']);
30+
// desc from content 截取200个字符
31+
$row['description'] = mb_substr($row['content'], 0, 200);
3032
$row['created_at'] = date('Y-m-d H:i:s');
3133
$row['updated_at'] = date('Y-m-d H:i:s');
3234

0 commit comments

Comments
 (0)