Explorar el Código

礼物,附近的人

lizhen_gitee hace 1 año
padre
commit
dd5b460ad4
Se han modificado 2 ficheros con 8 adiciones y 7 borrados
  1. 4 5
      application/api/controller/Gift.php
  2. 4 2
      application/api/controller/Index.php

+ 4 - 5
application/api/controller/Gift.php

@@ -24,16 +24,15 @@ class Gift extends Api
      * 获取礼物列表
      */
     public function getGiftList() {
-
+        $type = input('type',0);
 
         // 获取基本信息
         $where = ['is_show'=>1];
-
-        if(!$this->is_vip($this->auth->id)){
-            $where['is_vip'] = 0;
+        if($type){
+            $where['type'] = $type;
         }
 
-        $giftList = Db::name('gift')->where($where)->order("weigh","desc")->select();
+        $giftList = Db::name('gift')->where($where)->order("sort","asc")->select();
         $giftList = list_domain_image($giftList,['image','special']);
         $this->success("获取成功!",$giftList);
     }

+ 4 - 2
application/api/controller/Index.php

@@ -699,7 +699,7 @@ class Index extends Api
             '(st_distance(point (' . $this->auth->longitude . ', ' . $this->auth->latitude . '),point(user.longitude,user.latitude))*111195) as distance',
         ];
         $list = Db::name('user')->alias('user')->field($field)
-            ->join('age age','user.age_id = age.id','LEFT')
+            ->join('age','user.age_id = age.id','LEFT')
             ->join('enum_job job','user.job_id = job.id','LEFT')
             ->join('shopro_area area','user.city_id = area.id','LEFT')
             ->where($where)
@@ -709,7 +709,9 @@ class Index extends Api
             ->select();
         $list = list_domain_image($list,['avatar']);
         foreach($list as $key => &$val){
-            $val['distance'] = bcdiv(intval($val['distance']),1000,2).'km';
+            $val['distance'] = bcdiv(intval($val['distance']),1000,1).'km';
+            $val['is_follow'] = $this->is_follow($this->auth->id,$val['id']);
+            $val['is_friend'] = $this->is_friend($this->auth->id,$val['id']);
         }
 
         $this->success(1,$list);