作者 lyh

gx数据

@@ -119,14 +119,14 @@ class AiBlogAuthorTask extends Command @@ -119,14 +119,14 @@ class AiBlogAuthorTask extends Command
119 } 119 }
120 $aiBlogAuthorModel = new AiBlogAuthor(); 120 $aiBlogAuthorModel = new AiBlogAuthor();
121 foreach ($data as $v){ 121 foreach ($data as $v){
122 - //查询当前数据是否存在  
123 - $info = $aiBlogAuthorModel->read(['author_id'=>$v['id']]);  
124 $param = [ 122 $param = [
125 'author_id'=>$v['id'], 123 'author_id'=>$v['id'],
126 'title'=>$v['title'], 124 'title'=>$v['title'],
127 'image'=>str_replace_url($v['picture']), 125 'image'=>str_replace_url($v['picture']),
128 'description'=>$v['description'], 126 'description'=>$v['description'],
129 ]; 127 ];
  128 + //查询当前数据是否存在
  129 + $info = $aiBlogAuthorModel->read(['author_id'=>$v['id']]);
130 try { 130 try {
131 if($info === false){ 131 if($info === false){
132 echo '执行新增'.PHP_EOL; 132 echo '执行新增'.PHP_EOL;
@@ -134,7 +134,7 @@ class AiBlogAuthorTask extends Command @@ -134,7 +134,7 @@ class AiBlogAuthorTask extends Command
134 $param['route'] = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); 134 $param['route'] = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id);
135 $aiBlogAuthorModel->edit(['route'=>$param['route']],['id'=>$id]); 135 $aiBlogAuthorModel->edit(['route'=>$param['route']],['id'=>$id]);
136 }else{ 136 }else{
137 - $param['route'] = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); 137 + $param['route'] = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $info['id'], $project_id);
138 $aiBlogAuthorModel->edit($param,['id'=>$info['id']]); 138 $aiBlogAuthorModel->edit($param,['id'=>$info['id']]);
139 echo '执行更新'.PHP_EOL; 139 echo '执行更新'.PHP_EOL;
140 } 140 }
@@ -143,10 +143,10 @@ class AiBlogAuthorTask extends Command @@ -143,10 +143,10 @@ class AiBlogAuthorTask extends Command
143 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 143 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
144 $aiBlogService->key = $aiSettingInfo['key']; 144 $aiBlogService->key = $aiSettingInfo['key'];
145 $aiBlogService->updateAuthorInfo(['author_id'=>$param['author_id'],'route'=>$param['route'],'title'=>$param['title'],'picture'=>$param['image'],'description'=>$param['description']]); 145 $aiBlogService->updateAuthorInfo(['author_id'=>$param['author_id'],'route'=>$param['route'],'title'=>$param['title'],'picture'=>$param['image'],'description'=>$param['description']]);
146 - }catch (\Exception $e){  
147 - echo 'error:'.$e->getMessage();  
148 - continue;  
149 - } 146 +// }catch (\Exception $e){
  147 +// echo 'error:'.$e->getMessage();
  148 +// continue;
  149 +// }
150 } 150 }
151 return true; 151 return true;
152 } 152 }