作者 lyh

gx关闭项目理由

... ... @@ -121,20 +121,25 @@ class AiBlogAuthorTask extends Command
foreach ($data as $v){
//查询当前数据是否存在
$info = $aiBlogAuthorModel->read(['author_id'=>$v['id']]);
if($info === false){
$param = [
'author_id'=>$v['id'],
'title'=>$v['title'],
'image'=>str_replace_url($v['picture']),
'description'=>$v['description'],
];
try {
$param = [
'author_id'=>$v['id'],
'title'=>$v['title'],
'image'=>str_replace_url($v['picture']),
'description'=>$v['description'],
];
try {
if($info === false){
echo '执行新增'.PHP_EOL;
$id = $aiBlogAuthorModel->addReturnId($param);
$route = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id);
$aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]);
}catch (\Exception $e){
echo 'error:'.$e->getMessage();
}else{
$aiBlogAuthorModel->edit($param,['id'=>$info['id']]);
echo '执行更新'.PHP_EOL;
}
}catch (\Exception $e){
echo 'error:'.$e->getMessage();
continue;
}
}
return true;
... ...