Browse Source

附近和推荐排序,礼物普通会员也能看到不能送

lizhen_gitee 1 year ago
parent
commit
8885566848
2 changed files with 8 additions and 6 deletions
  1. 0 3
      application/api/controller/Gift.php
  2. 8 3
      application/api/controller/Index.php

+ 0 - 3
application/api/controller/Gift.php

@@ -28,9 +28,6 @@ class Gift extends Api
         // 获取基本信息
         $where = ['is_show'=>1];
 
-        if(!$this->is_vip($this->auth->id)){
-            $where['is_vip'] = 0;
-        }
 
         $giftList = Db::name('gift')->where($where)->order("weigh","desc")->select();
         $giftList = list_domain_image($giftList,['image','special']);

+ 8 - 3
application/api/controller/Index.php

@@ -90,6 +90,7 @@ class Index extends Api
             'user.longitude',
             'user.latitude',
             'user.attribute',
+            'user.is_active',
 
             'wallet.vip_endtime',
             '(st_distance(point (' . $this->auth->longitude . ', ' . $this->auth->latitude . '),point(user.longitude,user.latitude))*111195) as distance',
@@ -102,7 +103,7 @@ class Index extends Api
             ->where($where)
             ->where($where_black)
             ->having($having_dis)
-            ->order('distance asc')
+            ->order('user.is_active desc,distance asc')
             ->autopage()
             ->select();
         $list = list_domain_image($list,['avatar','photo_images']);
@@ -122,7 +123,10 @@ class Index extends Api
     //推荐
     //真人认证的,是推荐用户的,可能也要限制vip的
     public function tuijian(){
-        $cityname = input('cityname',$this->auth->cityname);
+        $cityname = input('cityname','');
+        if(empty($cityname)){
+            $cityname = $this->auth->cityname;
+        }
 
         $where = [
             'user.id' => ['neq',$this->auth->id],
@@ -198,6 +202,7 @@ class Index extends Api
             'user.longitude',
             'user.latitude',
             'user.attribute',
+            'user.is_active',
 
             'wallet.vip_endtime',
             '(st_distance(point (' . $this->auth->longitude . ', ' . $this->auth->latitude . '),point(user.longitude,user.latitude))*111195) as distance',
@@ -210,7 +215,7 @@ class Index extends Api
             ->where($where)
             ->where($where_black)
             ->having($having_dis)
-            ->order('distance asc')
+            ->order('user.is_active desc,distance asc')
             ->autopage()
             ->select();
         $list = list_domain_image($list,['avatar','photo_images']);