作者 lyh

gx关闭项目理由

@@ -121,7 +121,6 @@ class AiBlogAuthorTask extends Command @@ -121,7 +121,6 @@ class AiBlogAuthorTask extends Command
121 foreach ($data as $v){ 121 foreach ($data as $v){
122 //查询当前数据是否存在 122 //查询当前数据是否存在
123 $info = $aiBlogAuthorModel->read(['author_id'=>$v['id']]); 123 $info = $aiBlogAuthorModel->read(['author_id'=>$v['id']]);
124 - if($info === false){  
125 $param = [ 124 $param = [
126 'author_id'=>$v['id'], 125 'author_id'=>$v['id'],
127 'title'=>$v['title'], 126 'title'=>$v['title'],
@@ -129,12 +128,18 @@ class AiBlogAuthorTask extends Command @@ -129,12 +128,18 @@ class AiBlogAuthorTask extends Command
129 'description'=>$v['description'], 128 'description'=>$v['description'],
130 ]; 129 ];
131 try { 130 try {
  131 + if($info === false){
  132 + echo '执行新增'.PHP_EOL;
132 $id = $aiBlogAuthorModel->addReturnId($param); 133 $id = $aiBlogAuthorModel->addReturnId($param);
133 $route = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); 134 $route = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id);
134 $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]); 135 $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]);
  136 + }else{
  137 + $aiBlogAuthorModel->edit($param,['id'=>$info['id']]);
  138 + echo '执行更新'.PHP_EOL;
  139 + }
135 }catch (\Exception $e){ 140 }catch (\Exception $e){
136 echo 'error:'.$e->getMessage(); 141 echo 'error:'.$e->getMessage();
137 - } 142 + continue;
138 } 143 }
139 } 144 }
140 return true; 145 return true;