Explorar o código

动态与话题

lizhen_gitee hai 1 ano
pai
achega
fd98451946
Modificáronse 1 ficheiros con 29 adicións e 0 borrados
  1. 29 0
      application/api/controller/Topicdongtai.php

+ 29 - 0
application/api/controller/Topicdongtai.php

@@ -171,6 +171,18 @@ class Topicdongtai extends Api
             $where['dt.cityname'] = $this->auth->cityname;
         }
 
+        //性别
+        $gender = input('gender','all');
+        if($gender != 'all'){
+            $where['user.gender'] = $gender;
+        }
+
+        //属性
+        $attribute = input('attribute','all');
+        if($attribute != 'all'){
+            $where['user.attribute'] = $attribute;
+        }
+
         //排除黑名单的
         $where2 = [];
         $black_ids = Db::name('user_black')->where(['uid'=>$this->auth->id])->column('black_uid');
@@ -413,6 +425,23 @@ class Topicdongtai extends Api
         $this->success('举报成功');
     }
 
+    //收藏
+    public function collect(){
+        $where = [
+            'user_id'  => $this->auth->id,
+            'table'    => 'topic_dongtai',
+            'table_id' => input('id',0),
+        ];
+        $check = Db::name('user_collect')->where($where)->find();
+        if($check){
+            $this->success('已经收藏过了');
+        }else{
+            Db::name('user_collect')->insertGetId($where);
+            $this->success('收藏成功');
+        }
+    }
+
+
     //不感兴趣,屏蔽某条
     /*public function screen(){
         $data = [