|
@@ -111,367 +111,11 @@ class Usercenter extends Api
|
|
|
$this->success('success',$userinfo);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- public function samecity(){
|
|
|
- $gender = input_post('gender','all');
|
|
|
- $agemin = input_post('agemin',0);
|
|
|
- $agemax = input_post('agemax',100);
|
|
|
-
|
|
|
- if(empty($this->auth->cityname) || empty($this->auth->longitude) || empty($this->auth->latitude)){
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'user.status' => 1,
|
|
|
-
|
|
|
- 'user.id' => ['neq',$this->auth->id],
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- ];
|
|
|
- if($gender != 'all'){
|
|
|
- $map['user.gender'] = $gender;
|
|
|
- }
|
|
|
-
|
|
|
- $map['user.birthday'] = ['between',[time() - $agemax * 31536000,time() - $agemin * 31536000]];
|
|
|
-
|
|
|
-
|
|
|
- $field = [
|
|
|
- 'user.id','user.username','user.nickname','user.birthday','user.height','user.longitude','user.latitude','user.avatar','user.audio_bio','user.bio','user.gender','user.active_time'
|
|
|
- ];
|
|
|
- $list = Db::name('user')->alias('user')->field($field)->where($map)->order('user.active_time desc')->autopage()->select();
|
|
|
-
|
|
|
-
|
|
|
- $list = list_domain_image($list,['avatar']);
|
|
|
-
|
|
|
- foreach($list as $key => $one){
|
|
|
- $one['age'] = birthtime_to_age($one['birthday']);
|
|
|
-
|
|
|
- $one['distance'] = rand(0,10).'km';
|
|
|
-
|
|
|
-
|
|
|
- $one['active_text'] = '刚刚离线';
|
|
|
- if($one['active_time'] > time()-21600){
|
|
|
- $one['active_text'] = '1小时内在线';
|
|
|
- }
|
|
|
- if($one['active_time'] > time()-3600){
|
|
|
- $one['active_text'] = '在线';
|
|
|
- }
|
|
|
-
|
|
|
- $list[$key] = $one;
|
|
|
- }
|
|
|
-
|
|
|
- $this->success('success',$list);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public function nearuser(){
|
|
|
- $gender = input_post('gender','all');
|
|
|
- $agemin = input_post('agemin',0);
|
|
|
- $agemax = input_post('agemax',100);
|
|
|
-
|
|
|
- if(empty($this->auth->cityname) || empty($this->auth->longitude) || empty($this->auth->latitude)){
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'user.status' => 1,
|
|
|
-
|
|
|
- 'user.id' => ['neq',$this->auth->id],
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- ];
|
|
|
- if($gender != 'all'){
|
|
|
- $map['user.gender'] = $gender;
|
|
|
- }
|
|
|
-
|
|
|
- $map['user.birthday'] = ['between',[time() - $agemax * 31536000,time() - $agemin * 31536000]];
|
|
|
-
|
|
|
-
|
|
|
- $field = [
|
|
|
- 'user.id','user.username','user.nickname','user.birthday','user.height','user.longitude','user.latitude','user.avatar','user.audio_bio','user.bio','user.gender','user.active_time'
|
|
|
- ];
|
|
|
|
|
|
- $list = Db::name('user')->alias('user')->field($field)->where($map)->order('user.active_time desc')->autopage()->select();
|
|
|
-
|
|
|
|
|
|
- $list = list_domain_image($list,['avatar']);
|
|
|
|
|
|
- foreach($list as $key => $one){
|
|
|
- $one['age'] = birthtime_to_age($one['birthday']);
|
|
|
-
|
|
|
- $one['distance'] = rand(0,10).'km';
|
|
|
|
|
|
-
|
|
|
- $one['active_text'] = '刚刚离线';
|
|
|
- if($one['active_time'] > time()-21600){
|
|
|
- $one['active_text'] = '1小时内在线';
|
|
|
- }
|
|
|
- if($one['active_time'] > time()-3600){
|
|
|
- $one['active_text'] = '在线';
|
|
|
- }
|
|
|
-
|
|
|
- $list[$key] = $one;
|
|
|
- }
|
|
|
-
|
|
|
- $this->success('success',$list);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- public function getaudiouser(){
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $end = $start + 86399;
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'user_id' => $this->auth->id,
|
|
|
- 'createtime' => ['between',[$start,$end]],
|
|
|
- 'price' => 0,
|
|
|
- ];
|
|
|
|
|
|
- $check = Db::name('user_match_audio_log')->where($map)->find();*/
|
|
|
- $check = true;
|
|
|
-
|
|
|
-
|
|
|
- if($check){
|
|
|
- $price = config('site.audio_min_price');
|
|
|
- $gold = model('wallet')->getWallet($this->auth->id,'gold');
|
|
|
-
|
|
|
- if($gold < $price){
|
|
|
- $this->error('您的金币已经不足,请充值');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'status' =>1,
|
|
|
- 'gender' => $this->auth->gender == 1 ? 0 : 1,
|
|
|
- 'is_online' => 0,
|
|
|
- 'is_livebc' => 0,
|
|
|
- 'is_active' => 1,
|
|
|
-
|
|
|
-
|
|
|
- 'open_match_audio' => 1,
|
|
|
-
|
|
|
- 'id' => ['BETWEEN',[368,382]]
|
|
|
- ];
|
|
|
-
|
|
|
- $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,10);
|
|
|
-
|
|
|
- $result = [];
|
|
|
- if(!empty($lists)){
|
|
|
- foreach($lists as $key => $val){
|
|
|
- $result[] = ['id'=>$val];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(!empty($result)){
|
|
|
- $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,11);
|
|
|
- if($task_rs === false){
|
|
|
- $this->error('完成任务赠送奖励失败');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $this->success('success',$result);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public function getvideouser(){
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $end = $start + 86399;
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'user_id' => $this->auth->id,
|
|
|
- 'createtime' => ['between',[$start,$end]],
|
|
|
- 'price' => 0,
|
|
|
- ];
|
|
|
-
|
|
|
- $check = Db::name('user_match_video_log')->where($map)->find();*/
|
|
|
- $check = true;
|
|
|
-
|
|
|
-
|
|
|
- if($check){
|
|
|
- $price = config('site.video_min_price');
|
|
|
- $gold = model('wallet')->getWallet($this->auth->id,'gold');
|
|
|
-
|
|
|
- if($gold < $price){
|
|
|
- $this->error('您的金币已经不足,请充值');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'status' =>1,
|
|
|
- 'gender' => $this->auth->gender == 1 ? 0 : 1,
|
|
|
- 'is_online' => 0,
|
|
|
- 'is_livebc' => 0,
|
|
|
- 'is_active' => 1,
|
|
|
-
|
|
|
-
|
|
|
- 'open_match_video' => 1,
|
|
|
-
|
|
|
- 'id' => ['BETWEEN',[368,382]]
|
|
|
- ];
|
|
|
-
|
|
|
- $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,10);
|
|
|
-
|
|
|
- $result = [];
|
|
|
- if(!empty($lists)){
|
|
|
- foreach($lists as $key => $val){
|
|
|
- $result[] = ['id'=>$val];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(!empty($result)){
|
|
|
- $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,12);
|
|
|
- if($task_rs === false){
|
|
|
- $this->error('完成任务赠送奖励失败');
|
|
|
- }
|
|
|
- }
|
|
|
- $this->success('success',$result);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public function gettypinguser(){
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'status' =>1,
|
|
|
- 'gender' => $this->auth->gender == 1 ? 0 : 1,
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- 'open_match_typing' => 1,
|
|
|
-
|
|
|
- 'id' => ['BETWEEN',[368,382]]
|
|
|
- ];
|
|
|
-
|
|
|
- $lists = Db::name('user')->field('id,cityname,status,gender,real_status,tag_ids')->where($map)->order('logintime desc')->page($this->page,100)->select();
|
|
|
-
|
|
|
- $lists = array_column($lists,'id');
|
|
|
-
|
|
|
- $result = [];
|
|
|
- if(!empty($lists)){
|
|
|
-
|
|
|
- $result[] = ['id'=>$val];
|
|
|
- }*/
|
|
|
- $result = Db::name('user')->field('id,nickname,username,avatar,audio_bio')->where(['id'=>['IN',$lists]])->select();
|
|
|
- $result = list_domain_image($result,['avatar,audio_bio']);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(!empty($result)){
|
|
|
- $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,10);
|
|
|
- if($task_rs === false){
|
|
|
- $this->error('完成任务赠送奖励失败');
|
|
|
- }
|
|
|
- }
|
|
|
- $this->success('success',$result);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private function fliter_user($lists,$number = 1){
|
|
|
-
|
|
|
- if(empty($lists)){
|
|
|
- return $lists;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- foreach($lists as $key => $val){
|
|
|
- if(redis_matching_get($val['id']) == 1){
|
|
|
- unset($lists[$key]);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- $all_result = array_column($lists,'id');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $citydata = [];
|
|
|
- foreach($lists as $key => $val){
|
|
|
- if( !empty($this->auth->cityname) && $this->auth->cityname == $val['cityname'] ){
|
|
|
- $citydata[] = $val['id'];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $tagdata = [];
|
|
|
- foreach($lists as $key => $val){
|
|
|
- if( !empty($this->auth->tag_ids) && !empty($val['tag_ids']) ){
|
|
|
-
|
|
|
- $auth_tag_ids = explode(',',$this->auth->tag_ids);
|
|
|
- $val_tag_ids = explode(',',$val['tag_ids']);
|
|
|
- if(count(array_intersect($auth_tag_ids,$val_tag_ids)) > 0){
|
|
|
- $tagdata[] = $val['id'];
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $double_data = [];
|
|
|
- if(!empty($citydata) && !empty($tagdata)){
|
|
|
- $double_data = array_intersect($citydata,$tagdata);
|
|
|
- }
|
|
|
-
|
|
|
- if(count($double_data) >= $number){
|
|
|
- return $double_data;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- $merge_data = array_merge($citydata,$tagdata);
|
|
|
- $merge_data = array_flip(array_flip($merge_data));
|
|
|
-
|
|
|
- if(count($merge_data) >= $number){
|
|
|
- return $merge_data;
|
|
|
- }
|
|
|
-
|
|
|
- return $all_result;
|
|
|
- }
|
|
|
|
|
|
|
|
|
|