|
@@ -312,4 +312,45 @@ class EsMobileService{
|
|
|
}
|
|
|
return $make;
|
|
|
}
|
|
|
+
|
|
|
+ public static function search_all($type=1){
|
|
|
+ $size = 200;
|
|
|
+ $all_page = 20;
|
|
|
+ $count = 0;
|
|
|
+ for($page = 1;$page<=10;$page++){
|
|
|
+ $limit = ($page-1)*$size;
|
|
|
+ $results=es()->search([
|
|
|
+ 'index'=>self::index(),
|
|
|
+ 'body'=>[
|
|
|
+ 'query'=>[
|
|
|
+ 'term'=>[
|
|
|
+ 'type'=>['value'=>$type]
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ 'size'=>$size,
|
|
|
+ 'from'=>$limit,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ //$all_page = ceil($results['hits']['total']['value']/$size);
|
|
|
+
|
|
|
+ $mobile_ids = [];
|
|
|
+ foreach ($results['hits']['hits'] as $k=>$v){
|
|
|
+ $mobile_ids[] = $v['_source']['id'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $mobile_db_ids=Mobile::whereIn('id',$mobile_ids)->column('id');
|
|
|
+
|
|
|
+ // es 需要删除的id
|
|
|
+ $mobile_ids_es_del = array_diff($mobile_ids,$mobile_db_ids);
|
|
|
+
|
|
|
+ if($mobile_ids_es_del){
|
|
|
+ EsMobileService::delMobiles($mobile_ids_es_del);
|
|
|
+
|
|
|
+ user_log("EsMobileService_search_all_delByMobile", $mobile_ids_es_del);
|
|
|
+ $count = $count + count($mobile_ids_es_del);
|
|
|
+ user_log("EsMobileService_search_all_delByMobile", $count);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|