544782275@qq.com 3 سال پیش
والد
کامیت
f4d480d203
1فایلهای تغییر یافته به همراه5 افزوده شده و 5 حذف شده
  1. 5 5
      application/api/controller/Index.php

+ 5 - 5
application/api/controller/Index.php

@@ -220,18 +220,18 @@ class Index extends Base
         if($comment_list){
             foreach ($comment_list as $key=>&$value){
                 $user_info = Db::name('store_member')->field('name,headimg,privacy_switch')->where('id',$value['user_id'])->find();
+                if($user_info['privacy_switch']){
+                    unset($comment_list[$key]);
+                    continue;
+                }
                 $value['user_name'] = $user_info['name'];
                 $value['user_headimg'] = $user_info['headimg'];
                 //获取该条评论回复的数量
                 $value['apply_num'] = Db::name('store_comment')->where('forum_id',$id)->where('type',2)->where('forum_type',1)->where('root_comment_id',$value['id'])->count('id');
                 unset($value['user_id']);
-                if($user_info['privacy_switch']){
-                    unset($comment_list[$key]);
-                    continue;
-                }
             }
         }
-        $this->success('获取成功',$comment_list);
+        $this->success('获取成功',array_values($comment_list));
     }
     /**
      * @title 新闻回复评论列表