lizhen_gitee 2 месяцев назад
Родитель
Сommit
74cb045940
1 измененных файлов с 31 добавлено и 17 удалено
  1. 31 17
      application/api/controller/Topicdongtai.php

+ 31 - 17
application/api/controller/Topicdongtai.php

@@ -237,19 +237,19 @@ class Topicdongtai extends Api
     public function adddongtai(){
         $content = input('content','', 'trim');
         $images = input('images','', 'trim');
-        $show_real = input('show_real', 0, 'intval'); //是否标记真人:0=否,1=是
+//        $show_real = input('show_real', 0, 'intval'); //是否标记真人:0=否,1=是
         //$address = input('address', '', 'trim'); //位置
         $topic_id = input('topic_id', 0, 'intval'); //热门话题id
         $type = input('type', 0, 'intval'); //类型:0=文字,1=图片,2=视频
         if(!$content && !$images){
             $this->error(__('Invalid parameters'));
         }
-        if (!in_array($show_real, [0, 1])) {
+       /* if (!in_array($show_real, [0, 1])) {
             $this->error(__('Invalid parameters'));
-        }
-        if ($show_real == 1 && $this->auth->real_status != 1) { //验证是否已经通过真人认证
+        }*/
+        /*if ($show_real == 1 && $this->auth->real_status != 1) { //验证是否已经通过真人认证
             $this->error('您尚未通过真人认证,暂不能标记真人');
-        }
+        }*/
         /*if (iconv_strlen($address, 'utf-8') > 255) {
             $this->error('请选择正确位置');
         }*/
@@ -269,8 +269,8 @@ class Topicdongtai extends Api
         //关键字替换
         $content = Keyworld::sensitive($content);
 
-        $address = $this->ip_to_address();
-        $address = $address['provincename'].$address['cityname'];
+//        $address = $this->ip_to_address();
+//        $address = $address['provincename'].$address['cityname'];
 
         $data = [
             'topic_id' => $topic_id,
@@ -281,8 +281,8 @@ class Topicdongtai extends Api
 //            'latitude'  => input('latitude',''),
             'createtime' => time(),
             'updatetime' => time(),
-            'is_show_real' => $show_real,
-            'address' => $address,
+//            'is_show_real' => $show_real,
+//            'address' => $address,
             'type' => $type
         ];
 
@@ -309,17 +309,30 @@ class Topicdongtai extends Api
 
     //动态列表
     public function dongtailist() {
-        $type = input('type', 0, 'intval'); //类型:0热门 1最新
+        $type = input('type', 0, 'intval'); //类型:0热门 1关注
         $topic_id = input('topic_id', 0); //热门话题id
 
         if (!in_array($type, [0, 1])) {
             $this->error('您的网络开小差啦~');
         }
+
+        //关注
+        $where_follow = '';
         if ($type == 0) {
-//            $orderby = 'dt.goodnum desc';
             $orderby = 'dt.id desc';
         } else {
             $orderby = 'dt.id desc';
+
+            //关注的人
+            $follow_user_ids = Db::name('user_follow')->where(['uid'=>$this->auth->id])->column('follow_uid');
+            if(!empty($follow_user_ids)){
+                $where_follow .= '(dt.user_id IN ('.implode(',',$follow_user_ids).'))';
+            }
+
+            //默认
+            if($where_follow == ''){
+                $where_follow = 'dt.id = 0';
+            }
         }
 
         $where['dt.status'] = 0;
@@ -340,8 +353,9 @@ class Topicdongtai extends Api
         $list = Db::name('topic_dongtai')->alias('dt')
             ->join('user','dt.user_id = user.id','LEFT')
             ->join('topic_hub th','dt.topic_id = th.id','LEFT')
-            ->field('dt.*,user.nickname,user.avatar,user.gender,user.birthday,user.cityname,user.is_hideaddress,th.name,user.real_status')
+            ->field('dt.*,user.nickname,user.avatar,user.gender,user.birthday,user.idcard_status,user.is_hideaddress,th.name,user.real_status')
             ->where($where)
+            ->where($where_follow)
             ->order($orderby)->autopage()->select();
         $list = list_domain_image($list,['images','avatar']);
 
@@ -355,9 +369,9 @@ class Topicdongtai extends Api
             $good_list = Db::name('topic_dongtai_good')->where($map)->select();
             $mt_user_greet = Db::name('user_greet'); //是否打过招呼
             $mt_gift_user_dongtai = Db::name('gift_user_dongtai');
-            $mt_user_wallet = Db::name('user_wallet'); //钱包
-            $mt_wealth_level = Db::name('wealth_level'); //财富等级
-            $mt_charm_level = Db::name('charm_level'); //魅力等级
+//            $mt_user_wallet = Db::name('user_wallet'); //钱包
+//            $mt_wealth_level = Db::name('wealth_level'); //财富等级
+//            $mt_charm_level = Db::name('charm_level'); //魅力等级
 
             foreach ($list as &$val) {
                 $val['name'] = $val['name'] ? : '';
@@ -381,7 +395,7 @@ class Topicdongtai extends Api
                     $val['is_chat'] = 0; //是否打过招呼: 1是  0否
                 }
                 //查询财富等级和魅力等级
-                $wallet_info = $mt_user_wallet->where(['user_id' => $val['user_id']])->find();
+                /*$wallet_info = $mt_user_wallet->where(['user_id' => $val['user_id']])->find();
                 $wealth_level = $mt_wealth_level->where(['value' => ['elt', $wallet_info['pay_money']]])->order('id desc')->find();
                 if ($wealth_level) {
                     $val['wealth_level'] = localpath_to_netpath($wealth_level['image']);
@@ -393,7 +407,7 @@ class Topicdongtai extends Api
                     $val['charm_level'] = localpath_to_netpath($charm_level['image']);
                 } else {
                     $val['charm_level'] = '';
-                }
+                }*/
 
                 //创建视频缩略图
                 $val['images_thumb'] = '';