lizhen_gitee 2 ヶ月 前
コミット
c945898fd4
1 ファイル変更10 行追加32 行削除
  1. 10 32
      application/api/controller/Topicdongtai.php

+ 10 - 32
application/api/controller/Topicdongtai.php

@@ -448,15 +448,16 @@ 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'); //魅力等级
+
+            //vip用户
+            $user_vip = Db::name('user_wallet')->where('user_id','IN',array_column($list,'user_id'))->where('vip_endtime','gt',time())->column('user_id');
 
             foreach ($list as &$val) {
                 $val['name'] = $val['name'] ? : '';
                 $val['birthday'] = birthtime_to_age($val['birthday']);
                 $val['createtime'] = get_last_time($val['createtime']);
                 $val['cityname'] = $val['is_hideaddress'] ? '' : $val['address'] ;
+                $val['is_vip'] = in_array($val['user_id'],$user_vip) ? 1 : 0;
                 //是否点过赞:0否  1是
                 $val['isgood'] = 0;
                 foreach($good_list as $k => $v){
@@ -473,20 +474,6 @@ class Topicdongtai extends Api
                 } else {
                     $val['is_chat'] = 0; //是否打过招呼: 1是  0否
                 }
-                //查询财富等级和魅力等级
-                /*$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']);
-                } else {
-                    $val['wealth_level'] = '';
-                }
-                $charm_level = $mt_charm_level->where(['value' => ['elt', $wallet_info['get_money']]])->order('id desc')->find();
-                if ($charm_level) {
-                    $val['charm_level'] = localpath_to_netpath($charm_level['image']);
-                } else {
-                    $val['charm_level'] = '';
-                }*/
 
                 //创建视频缩略图
                 $val['images_thumb'] = '';
@@ -511,7 +498,8 @@ class Topicdongtai extends Api
         $info = 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.idcard_status,user.is_hideaddress,th.name,user.real_status')
+            ->join('user_wallet uw','dt.user_id = uw.user_id','LEFT')
+            ->field('dt.*,user.nickname,user.avatar,user.gender,user.birthday,user.idcard_status,user.is_hideaddress,th.name,user.real_status,uw.vip_endtime')
             ->where('dt.id',$id)->find();
         if (!$info) {
             $this->error('您的网络开小差啦~');
@@ -525,6 +513,9 @@ class Topicdongtai extends Api
         $info['birthday'] = birthtime_to_age($info['birthday']);
         $info['createtime'] = get_last_time($info['createtime']);
         $info['cityname'] = $info['is_hideaddress'] ? '' : $info['address'];
+        //vip用户
+        $info['is_vip'] = $info['vip_endtime'] > time() ? 1 : 0;
+
         //是否点赞过
         $info['isgood'] = $this->is_good($id,$this->auth->id);
         //礼物数量
@@ -536,20 +527,7 @@ class Topicdongtai extends Api
         } else {
             $info['is_chat'] = 0; //是否打过招呼: 1是  0否
         }
-        //查询财富等级和魅力等级
-       /* $wallet_info = Db::name('user_wallet')->where(['user_id' => $info['user_id']])->find();
-        $wealth_level = Db::name('wealth_level')->where(['value' => ['elt', $wallet_info['pay_money']]])->order('id desc')->find();
-        if ($wealth_level) {
-            $info['wealth_level'] = localpath_to_netpath($wealth_level['image']);
-        } else {
-            $info['wealth_level'] = '';
-        }
-        $charm_level = Db::name('charm_level')->where(['value' => ['elt', $wallet_info['get_money']]])->order('id desc')->find();
-        if ($charm_level) {
-            $info['charm_level'] = localpath_to_netpath($charm_level['image']);
-        } else {
-            $info['charm_level'] = '';
-        }*/
+
         //创建视频缩略图
         $info['images_thumb'] = '';
         if ($info['type'] == 2) {