|
@@ -13,89 +13,27 @@ class Match extends Api
|
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
|
|
|
- //因为接受者拿不到发起者的uid,废弃了
|
|
|
- //视频和语音,接收方使用,如果是性别劣势方,检查钱是否够用
|
|
|
- public function video_audio_moneycheck(){
|
|
|
- //检测用户,发起方的uid
|
|
|
- $to_user_id = input_post('from_user_id');
|
|
|
- $to_user_info = Db::name('user')->field('id,real_status,gender')->where('id',$to_user_id)->find();
|
|
|
- if(!$to_user_info){
|
|
|
- $this->error('不存在的用户');
|
|
|
- }
|
|
|
-
|
|
|
- //扣费金币
|
|
|
- $type = input_post('type','video'); //类型
|
|
|
- $price = $type == 'video' ? config('site.video_min_price') : config('site.audio_min_price');
|
|
|
-
|
|
|
- //发起用户的分数,被发起用户的分数。按性别给分
|
|
|
- $auth_level = 0;
|
|
|
- $tous_level = 0;
|
|
|
-
|
|
|
- //打分
|
|
|
- if($this->auth->gender == 0 && $this->auth->real_status == 1){
|
|
|
- $auth_level = 30;//实名女最高
|
|
|
- }
|
|
|
- if($this->auth->gender == 0 && $this->auth->real_status != 1){
|
|
|
- $auth_level = 20;//未实名女次之
|
|
|
- }
|
|
|
- if($this->auth->gender == 1){
|
|
|
- $auth_level = 10;//男性最低
|
|
|
- }
|
|
|
- if($to_user_info['gender'] == 0 && $to_user_info['real_status'] == 1){
|
|
|
- $tous_level = 30;
|
|
|
- }
|
|
|
- if($to_user_info['gender'] == 0 && $to_user_info['real_status'] != 1){
|
|
|
- $tous_level = 20;
|
|
|
- }
|
|
|
- if($to_user_info['gender'] == 1){
|
|
|
- $tous_level = 10;
|
|
|
- }
|
|
|
-
|
|
|
- //同性不收钱
|
|
|
- //都是男的,不扣钱
|
|
|
- //都是实名认证的女性,不扣钱
|
|
|
- //都是未实名认证的女性,不扣钱
|
|
|
- if($auth_level == $tous_level){
|
|
|
- $price = 0;
|
|
|
- $this->success('success');
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //扣钱uid,收钱uid,收钱free_video
|
|
|
- //分数少扣钱,分数多收益
|
|
|
- if($auth_level < $tous_level){
|
|
|
- $kou_user = $this->auth->id;
|
|
|
- }else{
|
|
|
- $kou_user = $to_user_info['id'];
|
|
|
- }
|
|
|
-
|
|
|
- //需要扣我的(接收方的)钱,判断钱是否够
|
|
|
- if($price > 0 && $kou_user == $this->auth->id){
|
|
|
- Db::startTrans();
|
|
|
- $gold = model('wallet')->getWallet($kou_user,'gold');
|
|
|
- if(bccomp($price,$gold) == 1){
|
|
|
- Db::rollback();
|
|
|
- $this->error('金币不足');
|
|
|
- }
|
|
|
- Db::commit();
|
|
|
- }
|
|
|
- $this->success('success');
|
|
|
- }
|
|
|
|
|
|
//视频通话每分钟调用一次
|
|
|
public function video_onemin(){
|
|
|
+ if ($this->auth->gender == 0) { //女生不花钱
|
|
|
+ $this->error('您的网络开小差啦~');
|
|
|
+ }
|
|
|
+
|
|
|
//检测用户
|
|
|
$to_user_id = input_post('to_user_id');
|
|
|
- $to_user_info = Db::name('user')->field('id,real_status,gender,free_video,free_audio,free_typing')->where('id',$to_user_id)->find();
|
|
|
+ $to_user_info = Db::name('user')->field('id,intro_uid,gender,match_video_price')->where('id',$to_user_id)->find();
|
|
|
if(!$to_user_info){
|
|
|
$this->error('不存在的用户');
|
|
|
}
|
|
|
+ if ($to_user_info['gender'] != 0) {
|
|
|
+ $this->error('同性不能聊天~');
|
|
|
+ }
|
|
|
|
|
|
//正常价格
|
|
|
- $price = config('site.video_min_price'); //扣费金币
|
|
|
- $bili = config('site.money_to_gold'); //兑换比例
|
|
|
- $gift_plat_scale = config('site.gift_plat_scale'); //抽成比例
|
|
|
- $money = bcdiv($price,$bili,2); //对应人民币
|
|
|
+ $price = $to_user_info['match_video_price']; //扣费金币
|
|
|
+
|
|
|
+ $gift_plat_scale = config('site.pipei_plat_scale'); //抽成比例
|
|
|
$money = bcdiv(bcmul($money,100 - $gift_plat_scale,2),100,2); //抽成后收益
|
|
|
|
|
|
//发起用户的分数,被发起用户的分数。按性别给分
|
|
@@ -103,11 +41,8 @@ class Match extends Api
|
|
|
$tous_level = 0;
|
|
|
|
|
|
//打分
|
|
|
- if($this->auth->gender == 0 && $this->auth->real_status == 1){
|
|
|
- $auth_level = 30;//实名女最高
|
|
|
- }
|
|
|
- if($this->auth->gender == 0 && $this->auth->real_status != 1){
|
|
|
- $auth_level = 20;//未实名女次之
|
|
|
+ if($this->auth->gender == 0){
|
|
|
+ $auth_level = 30;
|
|
|
}
|
|
|
if($this->auth->gender == 1){
|
|
|
$auth_level = 10;//男性最低
|
|
@@ -175,7 +110,7 @@ class Match extends Api
|
|
|
|
|
|
//有性别差,扣费
|
|
|
if($price > 0){
|
|
|
- $rs = model('wallet')->lockChangeAccountRemain($kou_user, $get_user,'gold',-$price,11,'','user_match_video_log',$log_id);
|
|
|
+ $rs = model('wallet')->lockChangeAccountRemain($kou_user,'gold',-$price,11,'','user_match_video_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
|
$this->error($rs['msg']);
|
|
@@ -183,7 +118,7 @@ class Match extends Api
|
|
|
}
|
|
|
//另一方加钱,0收费
|
|
|
if($money > 0 && $get_user_free == 0){
|
|
|
- $rs = model('wallet')->lockChangeAccountRemain($get_user,$kou_user,'money',$money,21,'','user_match_video_log',$log_id);
|
|
|
+ $rs = model('wallet')->lockChangeAccountRemain($get_user,'money',$money,21,'','user_match_video_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
|
$this->error($rs['msg']);
|
|
@@ -286,7 +221,7 @@ class Match extends Api
|
|
|
|
|
|
//有性别差,扣费
|
|
|
if($price > 0){
|
|
|
- $rs = model('wallet')->lockChangeAccountRemain($kou_user,$get_user,'gold',-$price,12,'','user_match_audio_log',$log_id);
|
|
|
+ $rs = model('wallet')->lockChangeAccountRemain($kou_user,'gold',-$price,12,'','user_match_audio_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
|
$this->error($rs['msg']);
|
|
@@ -294,7 +229,7 @@ class Match extends Api
|
|
|
}
|
|
|
//另一方加钱,0收费
|
|
|
if($money > 0 && $get_user_free == 0){
|
|
|
- $rs = model('wallet')->lockChangeAccountRemain($get_user, $kou_user,'money',$money,22,'','user_match_audio_log',$log_id);
|
|
|
+ $rs = model('wallet')->lockChangeAccountRemain($get_user,'money',$money,22,'','user_match_audio_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
|
$this->error($rs['msg']);
|
|
@@ -398,7 +333,7 @@ class Match extends Api
|
|
|
|
|
|
//有性别差,扣费
|
|
|
if($price > 0){
|
|
|
- $rs = model('wallet')->lockChangeAccountRemain($kou_user,$get_user,'gold',-$price,13,'','user_match_typing_log',$log_id);
|
|
|
+ $rs = model('wallet')->lockChangeAccountRemain($kou_user,'gold',-$price,13,'','user_match_typing_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
|
$this->error($rs['msg']);
|
|
@@ -406,7 +341,7 @@ class Match extends Api
|
|
|
}
|
|
|
//另一方加钱,0收费
|
|
|
if($money > 0 && $get_user_free == 0){
|
|
|
- $rs = model('wallet')->lockChangeAccountRemain($get_user,$kou_user,'money',$money,23,'','user_match_typing_log',$log_id);
|
|
|
+ $rs = model('wallet')->lockChangeAccountRemain($get_user,'money',$money,23,'','user_match_typing_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
|
$this->error($rs['msg']);
|
|
@@ -428,190 +363,144 @@ class Match extends Api
|
|
|
//语音匹配
|
|
|
public function getaudiouser(){
|
|
|
|
|
|
- //判断资格
|
|
|
- /*$start = strtotime(date('Y-m-d'));
|
|
|
- $end = $start + 86399;
|
|
|
-
|
|
|
+ //给出备选用户
|
|
|
$map = [
|
|
|
- 'user_id' => $this->auth->id,
|
|
|
- 'createtime' => ['between',[$start,$end]],
|
|
|
- 'price' => 0,
|
|
|
+ 'user.status' =>1, //未封禁用户
|
|
|
+ 'user.gender' => $this->auth->gender == 1 ? 0 : 1, //异性
|
|
|
+ 'user.is_active' => 1, //在线的
|
|
|
+ 'user.open_match_audio' => 1, //打开语聊开关
|
|
|
];
|
|
|
|
|
|
- $check = Db::name('user_match_audio_log')->where($map)->find();*/
|
|
|
- $check = true;
|
|
|
+ if($this->auth->gender == 0){
|
|
|
|
|
|
- //已经用掉免费的了,判断金额
|
|
|
- if($check){
|
|
|
- $price = config('site.audio_min_price');
|
|
|
- $gold = model('wallet')->getWallet($this->auth->id,'gold');
|
|
|
+ //或者未首充用户,且还有免费分钟数
|
|
|
+ $map2['user.is_shouchong'] = 0;
|
|
|
+ $map2['uw.audio_sec'] = ['gt',0];
|
|
|
|
|
|
- if($gold < $price){
|
|
|
- $this->error('您的金币已经不足,请充值');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //找到互关的人,排除
|
|
|
- //$follow_me = Db::name('user_follow')->where('follow_uid',$this->auth->id)->column('uid');
|
|
|
- //dump($follow_me);
|
|
|
- //$my_follow = Db::name('user_follow')->where(['uid'=>$this->auth->id,'follow_uid'=>['IN',$follow_me]])->column('follow_uid');
|
|
|
- //dump($my_follow);exit;
|
|
|
+ //男性要有最少一分钟的钱
|
|
|
+ $map3['uw.gold'] = ['egt',$this->auth->match_audio_price];
|
|
|
|
|
|
+ }else{
|
|
|
+ $my_gold = Db::name('user_wallet')->where('user_id',$this->auth->id)->value('gold');
|
|
|
+ $map2['user.match_audio_price'] = ['elt',$my_gold];
|
|
|
+ }
|
|
|
|
|
|
- //给出备选用户
|
|
|
- $map = [
|
|
|
- 'status' =>1, //未封禁用户
|
|
|
- 'gender' => $this->auth->gender == 1 ? 0 : 1, //异性
|
|
|
- 'is_online' => 0, //不在语聊间的
|
|
|
- 'is_livebc' => 0, //不在直播的
|
|
|
- 'is_active' => 1, //在线的
|
|
|
- //'real_status' => 1, //真人认证
|
|
|
- //'idcard_status' => 1, //实名认证
|
|
|
- 'open_match_audio' => 1, //打开语聊开关
|
|
|
- //'id' => ['NOT IN',$my_follow] //不是好友的
|
|
|
- ];
|
|
|
+ $lists = Db::name('user')->alias('user')->field('user.id,user.gender,user.birthday,user.avatar,user.nickname,user.match_audio_price')
|
|
|
+ ->join('user_wallet uw','user.id = uw.user_id','LEFT')
|
|
|
+ ->where($map)->where($map2)->order('user.logintime desc')->page($this->page,100)->select();
|
|
|
|
|
|
- $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);
|
|
|
+ if(empty($lists) && $this->auth->gender == 0){
|
|
|
+ $lists = Db::name('user')->alias('user')->field('user.id,user.gender,user.birthday,user.avatar,user.nickname,user.match_audio_price')
|
|
|
+ ->join('user_wallet uw','user.id = uw.user_id','LEFT')
|
|
|
+ ->where($map)->where($map3)->order('user.logintime desc')->page($this->page,100)->select();
|
|
|
+ }
|
|
|
|
|
|
- $result = [];
|
|
|
if(!empty($lists)){
|
|
|
- foreach($lists as $key => $val){
|
|
|
- $result[] = ['id'=>$val];
|
|
|
- }
|
|
|
- }
|
|
|
+ foreach($lists as $key => &$val){
|
|
|
+ $val = info_domain_image($val,['avatar']);
|
|
|
|
|
|
- //tag任务赠送金币
|
|
|
- //语音匹配奖励 +5金币
|
|
|
- if(!empty($result)){
|
|
|
- $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,11);
|
|
|
- if($task_rs === false){
|
|
|
- $this->error('完成任务赠送奖励失败');
|
|
|
+ $val['age'] = birthtime_to_age($val['birthday']);
|
|
|
+ unset($val['birthday']);
|
|
|
+
|
|
|
+ $val['match_audio_price'] = $this->auth->gender == 0 ? $this->auth->match_audio_price : $val['match_audio_price'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $this->success('success',$result);
|
|
|
+ $this->success('success',$lists);
|
|
|
}
|
|
|
|
|
|
//视频匹配
|
|
|
public function getvideouser(){
|
|
|
|
|
|
- //判断资格
|
|
|
- /*$start = strtotime(date('Y-m-d'));
|
|
|
- $end = $start + 86399;
|
|
|
-
|
|
|
+ //给出备选用户
|
|
|
$map = [
|
|
|
- 'user_id' => $this->auth->id,
|
|
|
- 'createtime' => ['between',[$start,$end]],
|
|
|
- 'price' => 0,
|
|
|
+ 'user.status' =>1, //未封禁用户
|
|
|
+ 'user.gender' => $this->auth->gender == 1 ? 0 : 1, //异性
|
|
|
+ 'user.is_active' => 1, //在线的
|
|
|
+ 'user.open_match_video' => 1, //打开语聊开关
|
|
|
];
|
|
|
|
|
|
- $check = Db::name('user_match_video_log')->where($map)->find();*/
|
|
|
- $check = true;
|
|
|
+ if($this->auth->gender == 0){
|
|
|
|
|
|
- //已经用掉免费的了,判断金额
|
|
|
- if($check){
|
|
|
- $price = config('site.video_min_price');
|
|
|
- $gold = model('wallet')->getWallet($this->auth->id,'gold');
|
|
|
+ //或者未首充用户,且还有免费分钟数
|
|
|
+ $map2['user.is_shouchong'] = 0;
|
|
|
+ $map2['uw.video_sec'] = ['gt',0];
|
|
|
|
|
|
- if($gold < $price){
|
|
|
- $this->error('您的金币已经不足,请充值');
|
|
|
- }
|
|
|
+ //男性要有最少一分钟的钱
|
|
|
+ $map3['uw.gold'] = ['egt',$this->auth->match_video_price];
|
|
|
+
|
|
|
+ }else{
|
|
|
+ $my_gold = Db::name('user_wallet')->where('user_id',$this->auth->id)->value('gold');
|
|
|
+ $map2['user.match_video_price'] = ['elt',$my_gold];
|
|
|
}
|
|
|
|
|
|
- //找到互关的人,排除
|
|
|
- //$follow_me = Db::name('user_follow')->where('follow_uid',$this->auth->id)->column('uid');
|
|
|
- //dump($follow_me);
|
|
|
- //$my_follow = Db::name('user_follow')->where(['uid'=>$this->auth->id,'follow_uid'=>['IN',$follow_me]])->column('follow_uid');
|
|
|
- //dump($my_follow);exit;
|
|
|
+ $lists = Db::name('user')->alias('user')->field('user.id,user.gender,user.birthday,user.avatar,user.nickname,user.match_audio_price')
|
|
|
+ ->join('user_wallet uw','user.id = uw.user_id','LEFT')
|
|
|
+ ->where($map)->where($map2)->order('user.logintime desc')->page($this->page,100)->select();
|
|
|
|
|
|
+ if(empty($lists) && $this->auth->gender == 0){
|
|
|
+ $lists = Db::name('user')->alias('user')->field('user.id,user.gender,user.birthday,user.avatar,user.nickname,user.match_audio_price')
|
|
|
+ ->join('user_wallet uw','user.id = uw.user_id','LEFT')
|
|
|
+ ->where($map)->where($map3)->order('user.logintime desc')->page($this->page,100)->select();
|
|
|
+ }
|
|
|
|
|
|
- //给出备选用户
|
|
|
- $map = [
|
|
|
- 'status' =>1, //未封禁用户
|
|
|
- 'gender' => $this->auth->gender == 1 ? 0 : 1, //异性
|
|
|
- 'is_online' => 0, //不在语聊间的
|
|
|
- 'is_livebc' => 0, //不在直播的
|
|
|
- 'is_active' => 1, //在线的
|
|
|
- //'real_status' => 1, //真人认证
|
|
|
- //'idcard_status' => 1, //实名认证
|
|
|
- 'open_match_video' => 1, //打开视频开关的
|
|
|
- // 'id' => ['NOT IN',$my_follow] //不是好友的
|
|
|
- ];
|
|
|
+ if(!empty($lists)){
|
|
|
+ foreach($lists as $key => &$val){
|
|
|
+ $val = info_domain_image($val,['avatar']);
|
|
|
|
|
|
- $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);
|
|
|
+ $val['age'] = birthtime_to_age($val['birthday']);
|
|
|
+ unset($val['birthday']);
|
|
|
|
|
|
- $result = [];
|
|
|
- if(!empty($lists)){
|
|
|
- foreach($lists as $key => $val){
|
|
|
- $result[] = ['id'=>$val];
|
|
|
+ $val['match_audio_price'] = $this->auth->gender == 0 ? $this->auth->match_audio_price : $val['match_audio_price'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //tag任务赠送金币
|
|
|
- //视频匹配奖励 +5金币
|
|
|
- if(!empty($result)){
|
|
|
- $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,12);
|
|
|
- if($task_rs === false){
|
|
|
- $this->error('完成任务赠送奖励失败');
|
|
|
- }
|
|
|
- }
|
|
|
- $this->success('success',$result);
|
|
|
+ $this->success('success',$lists);
|
|
|
}
|
|
|
|
|
|
//聊天匹配
|
|
|
public function gettypinguser(){
|
|
|
|
|
|
- //找到互关的人,排除
|
|
|
- //$follow_me = Db::name('user_follow')->where('follow_uid',$this->auth->id)->column('uid');
|
|
|
- //dump($follow_me);
|
|
|
- //$my_follow = Db::name('user_follow')->where(['uid'=>$this->auth->id,'follow_uid'=>['IN',$follow_me]])->column('follow_uid');
|
|
|
- //dump($my_follow);exit;
|
|
|
-
|
|
|
//给出备选用户
|
|
|
$map = [
|
|
|
- 'status' =>1, //未封禁用户
|
|
|
- 'gender' => $this->auth->gender == 1 ? 0 : 1, //异性
|
|
|
- //'real_status' => 1, //真人认证
|
|
|
- //'idcard_status' => 1, //实名认证
|
|
|
- //'is_active' => 1, //在线的
|
|
|
- //打开聊天开关的
|
|
|
- 'open_match_typing' => 1, //打开文字聊天开关的
|
|
|
- //'id' => ['NOT IN',$my_follow] //不是好友的
|
|
|
+ 'user.status' =>1, //未封禁用户
|
|
|
+ 'user.gender' => $this->auth->gender == 1 ? 0 : 1, //异性
|
|
|
];
|
|
|
|
|
|
- $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,100);
|
|
|
- $lists = array_column($lists,'id');
|
|
|
+ if($this->auth->gender == 0){
|
|
|
|
|
|
- $result = [];
|
|
|
- if(!empty($lists)){
|
|
|
- /*foreach($lists as $key => $val){
|
|
|
- $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']);
|
|
|
+ //或者未首充用户,且还有免费分钟数
|
|
|
+ $map2['user.is_shouchong'] = 0;
|
|
|
+ $map2['uw.typing_times'] = ['gt',0];
|
|
|
+
|
|
|
+ //男性要有最少一分钟的钱
|
|
|
+ $map3['uw.gold'] = ['egt',$this->auth->match_typing_price];
|
|
|
+
|
|
|
+ }else{
|
|
|
+ $my_gold = Db::name('user_wallet')->where('user_id',$this->auth->id)->value('gold');
|
|
|
+ $map2['user.match_typing_price'] = ['elt',$my_gold];
|
|
|
}
|
|
|
|
|
|
- //tag任务赠送金币
|
|
|
- //缘分匹配奖励 +5金币
|
|
|
- if(!empty($result)){
|
|
|
- $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,10);
|
|
|
- if($task_rs === false){
|
|
|
- $this->error('完成任务赠送奖励失败');
|
|
|
- }
|
|
|
+ $lists = Db::name('user')->alias('user')->field('user.id')
|
|
|
+ ->join('user_wallet uw','user.id = uw.user_id','LEFT')
|
|
|
+ ->where($map)->where($map2)->order('user.logintime desc')->page($this->page,100)->select();
|
|
|
+
|
|
|
+ if(empty($lists) && $this->auth->gender == 0){
|
|
|
+ $lists = Db::name('user')->alias('user')->field('user.id')
|
|
|
+ ->join('user_wallet uw','user.id = uw.user_id','LEFT')
|
|
|
+ ->where($map)->where($map3)->order('user.logintime desc')->page($this->page,100)->select();
|
|
|
}
|
|
|
- $this->success('success',$result);
|
|
|
+
|
|
|
+ $this->success('success',$lists);
|
|
|
}
|
|
|
|
|
|
//过滤规则
|
|
|
- private function fliter_user($lists,$number = 1){
|
|
|
+ private function fliter_user($lists){
|
|
|
|
|
|
if(empty($lists)){
|
|
|
return $lists;
|
|
|
}
|
|
|
- //dump($lists);
|
|
|
+
|
|
|
|
|
|
//过滤掉通话中的
|
|
|
foreach($lists as $key => $val){
|
|
@@ -620,52 +509,8 @@ class Match extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //预留全部
|
|
|
- $all_result = array_column($lists,'id');
|
|
|
- //dump($all_result);
|
|
|
-
|
|
|
- //提取同城的
|
|
|
- $citydata = [];
|
|
|
- foreach($lists as $key => $val){
|
|
|
- if( !empty($this->auth->cityname) && $this->auth->cityname == $val['cityname'] ){
|
|
|
- $citydata[] = $val['id'];
|
|
|
- }
|
|
|
- }
|
|
|
- //dump($citydata);
|
|
|
-
|
|
|
- //有标签交集的
|
|
|
- $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'];
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //dump($tagdata);
|
|
|
-
|
|
|
- //双条件都满足
|
|
|
- $double_data = [];
|
|
|
- if(!empty($citydata) && !empty($tagdata)){
|
|
|
- $double_data = array_intersect($citydata,$tagdata);
|
|
|
- }
|
|
|
- //dump($double_data);
|
|
|
- if(count($double_data) >= $number){
|
|
|
- return $double_data;
|
|
|
- }
|
|
|
-
|
|
|
- //两种条件合并,去重。空数组合并没影响
|
|
|
- $merge_data = array_merge($citydata,$tagdata);
|
|
|
- $merge_data = array_flip(array_flip($merge_data));
|
|
|
- //dump($merge_data);
|
|
|
- if(count($merge_data) >= $number){
|
|
|
- return $merge_data;
|
|
|
- }
|
|
|
|
|
|
- return $all_result;
|
|
|
+ return $lists;
|
|
|
}
|
|
|
|
|
|
//亲密度等级信息
|