作者 邓超

优化 sync to es

... ... @@ -44,7 +44,14 @@ class SyncToEsCmd {
$code = 500;
if($id){
$doc_id = '';
$data = $db->first(\Model\listsSql::first('`id` = '.$id));
try {
$data = $db->throw()->first(\Model\listsSql::first('`id` = '.$id));
}catch (Throwable $e){
redis()->rPush('sync_to_es',$id);
_echo('sync to es '.$e->getMessage());
break;
}
if($data){
// 设置 进程 是否在运行
$data['is_auto']=$db->count('select count(*) from `lists_auto` where `list_id` = '.$data['id']) ? 1 : 0;
... ... @@ -88,6 +95,7 @@ class SyncToEsCmd {
$v['name'] = '';
return $v;
},$data['to_name']);
$data['to_name'] = array_slice($data['to_name'],0,100);
$data['to_name'] = json_encode($data['to_name']);
}else{
$data['to_name'] = '';
... ...