|
...
|
...
|
@@ -118,19 +118,23 @@ class AiBlogAuthorTask extends Command |
|
|
|
return true;
|
|
|
|
}
|
|
|
|
$aiBlogAuthorModel = new AiBlogAuthor();
|
|
|
|
$info = $aiBlogAuthorModel->counts(['id'=>['!=',0]]);
|
|
|
|
if($info == 0){
|
|
|
|
echo '项目id:'.$project_id.'执行新增。'.$info;
|
|
|
|
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 {
|
|
|
|
$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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
...
|
...
|
|