|
...
|
...
|
@@ -60,14 +60,14 @@ class lyhDemo extends Command |
|
|
|
if(!empty($aiLists)){
|
|
|
|
foreach ($aiLists as $item){
|
|
|
|
if(!empty($item['seo_description'])){
|
|
|
|
$arr = explode('.',$item['seo_description']);
|
|
|
|
if($arr[0].'.' != $item['seo_description']){
|
|
|
|
echo '进入'.PHP_EOL;
|
|
|
|
//查看当前是否包含句号。
|
|
|
|
$result = $this->hasAnyPeriod($item['seo_description']);
|
|
|
|
if($result === false){
|
|
|
|
$text = $this->trimToLastFullWord($item['seo_description']);
|
|
|
|
}else{
|
|
|
|
$arr = explode('.',$item['seo_description']);
|
|
|
|
$text = $arr[0].'.';
|
|
|
|
}
|
|
|
|
dd($text);
|
|
|
|
$aiBlogModel->edit(['seo_description'=>$text],['id'=>$item['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -87,4 +87,8 @@ class lyhDemo extends Command |
|
|
|
}
|
|
|
|
return trim($text); // fallback
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasAnyPeriod($text) {
|
|
|
|
return strpos($text, '.') !== false || mb_strpos($text, '。') !== false;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|