|
@@ -361,6 +361,14 @@ class Usercenter extends Api
|
|
|
|
|
|
$lists = Db::name('user')->field('id,cityname,status,gender,real_status,tag_ids')->where($map)->order('logintime desc')->page($this->page,100)->select();
|
|
|
$lists = $this->fliter_user($lists);
|
|
|
+
|
|
|
+ $result = [];
|
|
|
+ if(!empty($lists)){
|
|
|
+ foreach($lists as $key => $val){
|
|
|
+ $result[] = ['id'=>$val];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$this->success('success',$lists);
|
|
|
}
|
|
|
|
|
@@ -411,7 +419,14 @@ class Usercenter extends Api
|
|
|
|
|
|
$lists = Db::name('user')->field('id,cityname,status,gender,real_status,tag_ids')->where($map)->order('logintime desc')->page($this->page,100)->select();
|
|
|
$lists = $this->fliter_user($lists);
|
|
|
- $this->success('success',$lists);
|
|
|
+
|
|
|
+ $result = [];
|
|
|
+ if(!empty($lists)){
|
|
|
+ foreach($lists as $key => $val){
|
|
|
+ $result[] = ['id'=>$val];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $this->success('success',$result);
|
|
|
}
|
|
|
|
|
|
//过滤规则
|
|
@@ -420,17 +435,17 @@ class Usercenter extends Api
|
|
|
if(empty($lists)){
|
|
|
return $lists;
|
|
|
}
|
|
|
-
|
|
|
+ //dump($lists);
|
|
|
//过滤掉通话中的
|
|
|
foreach($lists as $key => $val){
|
|
|
if(redis_get($val['id']) == 1){
|
|
|
- unset($lists[$key]);
|
|
|
+ //unset($lists[$key]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//预留全部
|
|
|
$all_result = array_column($lists,'id');
|
|
|
-
|
|
|
+ //dump($all_result);
|
|
|
//提取同城的
|
|
|
$citydata = [];
|
|
|
foreach($lists as $key => $val){
|
|
@@ -438,6 +453,7 @@ class Usercenter extends Api
|
|
|
$citydata[] = $val['id'];
|
|
|
}
|
|
|
}
|
|
|
+ //dump($citydata);
|
|
|
|
|
|
//有标签交集的
|
|
|
$tagdata = [];
|
|
@@ -451,18 +467,14 @@ class Usercenter extends Api
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //dump($tagdata);
|
|
|
|
|
|
//两个都满足
|
|
|
$double_data = [];
|
|
|
if(!empty($citydata) && !empty($tagdata)){
|
|
|
$double_data = array_intersect($citydata,$tagdata);
|
|
|
}
|
|
|
-
|
|
|
- //两种条件合并,去重。空数组合并没影响
|
|
|
- $merge_data = array_merge($citydata,$tagdata);
|
|
|
- $merge_data = array_flip(array_flip($merge_data));
|
|
|
-
|
|
|
- //最终结果
|
|
|
+ //dump($double_data);
|
|
|
|
|
|
//双条件数量足够就return
|
|
|
if(count($double_data) >= 1){
|
|
@@ -470,18 +482,16 @@ class Usercenter extends Api
|
|
|
return $double_data;
|
|
|
}
|
|
|
|
|
|
- //不够就合并
|
|
|
- $result_data = array_merge($double_data,$merge_data);
|
|
|
- $result_data = array_flip(array_flip($result_data));
|
|
|
- if(count($result_data) >= 1){
|
|
|
+ //两种条件合并,去重。空数组合并没影响
|
|
|
+ $merge_data = array_merge($citydata,$tagdata);
|
|
|
+ $merge_data = array_flip(array_flip($merge_data));
|
|
|
+ //dump($merge_data);
|
|
|
+ if(count($merge_data) >= 1){
|
|
|
//echo __LINE__;
|
|
|
- return $result_data;
|
|
|
+ return $merge_data;
|
|
|
}
|
|
|
|
|
|
- //仍然不够,全合并
|
|
|
- $all_data = array_merge($result_data,$all_result);
|
|
|
- $all_data = array_flip(array_flip($all_data));
|
|
|
- return $all_data;
|
|
|
+ return $all_result;
|
|
|
}
|
|
|
|
|
|
|