作者 lyh

gxAiblog自动发布

... ... @@ -147,7 +147,7 @@ class AiVideoTask extends Command
if($route != $result['data']['url']){
$aiVideoService->updateDetail(['url'=>$route,'task_id'=>$item['task_id']]);
}
$description = explode(",",$result['data']['content']);
$description = explode(".",$result['data']['content']);
$saveData = [
'title'=>$result['data']['title'],
'image'=>$result['data']['thumb'],
... ...
... ... @@ -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;
}
}
... ...