作者 lyh

gx数据

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