正在显示
1 个修改的文件
包含
13 行增加
和
10 行删除
| @@ -113,16 +113,19 @@ class AiBlogAuthorTask extends Command | @@ -113,16 +113,19 @@ class AiBlogAuthorTask extends Command | ||
| 113 | return true; | 113 | return true; |
| 114 | } | 114 | } |
| 115 | $aiBlogAuthorModel = new AiBlogAuthor(); | 115 | $aiBlogAuthorModel = new AiBlogAuthor(); |
| 116 | - foreach ($data as $v){ | ||
| 117 | - $param = [ | ||
| 118 | - 'author_id'=>$v['id'], | ||
| 119 | - 'title'=>$v['title'], | ||
| 120 | - 'image'=>str_replace_url($v['picture']), | ||
| 121 | - 'description'=>$v['description'], | ||
| 122 | - ]; | ||
| 123 | - $id = $aiBlogAuthorModel->addReturnId($param); | ||
| 124 | - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); | ||
| 125 | - $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]); | 116 | + $info = $aiBlogAuthorModel->count(['project_id'=>$project_id]); |
| 117 | + if($info === false){ | ||
| 118 | + foreach ($data as $v){ | ||
| 119 | + $param = [ | ||
| 120 | + 'author_id'=>$v['id'], | ||
| 121 | + 'title'=>$v['title'], | ||
| 122 | + 'image'=>str_replace_url($v['picture']), | ||
| 123 | + 'description'=>$v['description'], | ||
| 124 | + ]; | ||
| 125 | + $id = $aiBlogAuthorModel->addReturnId($param); | ||
| 126 | + $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); | ||
| 127 | + $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]); | ||
| 128 | + } | ||
| 126 | } | 129 | } |
| 127 | return true; | 130 | return true; |
| 128 | } | 131 | } |
-
请 注册 或 登录 后发表评论