wupengfei 2 years ago
parent
commit
439d307de2
2 changed files with 10 additions and 8 deletions
  1. 1 1
      .idea/workspace.xml
  2. 9 7
      application/api/controller/Article.php

+ 1 - 1
.idea/workspace.xml

@@ -252,7 +252,7 @@
       <workItem from="1678149106133" duration="24129000" />
       <workItem from="1678236784872" duration="19064000" />
       <workItem from="1678322422199" duration="23277000" />
-      <workItem from="1678410737283" duration="16572000" />
+      <workItem from="1678410737283" duration="16745000" />
     </task>
     <servers />
   </component>

+ 9 - 7
application/api/controller/Article.php

@@ -476,7 +476,7 @@ class Article extends Base
             $val['parent']  = $parent ? $parent->toArray() : null;
             $val['can_delete']  = $val['user_id'] == $this->user_id ? 1 :0;
         });
-        $total_num  = ArticleComment::where($where)->alias('c')->count();
+        $total_num  = ArticleComment::where($where)->alias('c')    ->leftJoin('store_member u','u.id = c.user_id')->count();
         $this->success('ok',['list'=>$list,'total_num'=>numTransform($total_num),'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
     
@@ -875,7 +875,7 @@ class Article extends Base
             $v['time'] = date("Y-m-d H:i:s",$v['update_int']);
             $v['is_normal'] = CheckPower::checkModulesPower($v['article_id'],$v['item_id'],$this->request->controller());
         }
-        $total_num = UserTrack::where($sel_where)->alias('t')->count();
+        $total_num = UserTrack::where($sel_where)->alias('t') ->leftJoin('ArticleItem i','t.second_id = i.id')->count();
         $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
@@ -932,7 +932,7 @@ class Article extends Base
             $v['comment_num'] = ArticleComment::getArticleCommentNum($v['item_id']);
             $v['is_like'] = ArticleLike::where(['user_id'=>$this->user_id,'article_id'=>$v['article_id'],'item_id'=>$v['item_id']])->count();
         });
-        $total_num = UserCollect::where($sel_where)->alias('t')->count();
+        $total_num = UserCollect::where($sel_where)->alias('t')   ->leftJoin('ArticleItem i','t.children_id = i.id')->count();
         $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
@@ -1077,7 +1077,8 @@ class Article extends Base
             $v['is_recently'] = $recently_id ? 1 : 0;
             $v['recently_title'] = ArticleItem::where('id',$recently_id)->value('title');
         });
-        $total_num = UserLearn::where($sel_where)->alias('t')->count();
+        $total_num = UserLearn::where($sel_where)->alias('t')   ->leftJoin('ArticleItem i','t.second_id = i.id')
+            ->leftJoin('ArticleIntro a','t.first_id = a.id')->count();
         $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
@@ -1135,7 +1136,7 @@ class Article extends Base
                 ->find()->toArray();
             $v['parent_comment'] = $parent_comment;
         }
-        $total_num = ArticleComment::where($sel_where)->alias('t')->count();
+        $total_num = ArticleComment::where($sel_where)->alias('t')  ->leftJoin('ArticleItem i','t.item_id = i.id')->count();
         $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
@@ -1200,7 +1201,8 @@ class Article extends Base
                 ->find()->toArray();
             $v['parent_comment'] = $parent_comment;
         }
-        $total_num = ArticleComment::where($sel_where)->alias('t')->count();
+        $total_num = ArticleComment::where($sel_where)->alias('t')  ->leftJoin('store_member u','t.user_id = u.id')
+            ->leftJoin('ArticleItem i','t.item_id = i.id')->count();
         $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
@@ -1356,7 +1358,7 @@ class Article extends Base
             $v['is_recently'] = $recently_id ? 1 : 0;
             $v['recently_title'] = ArticleItem::where('id',$recently_id)->value('title');
         });
-        $total_num= PlatformSwitch::field($field)->alias('p')->where($sel_where)->count();
+        $total_num= PlatformSwitch::field($field)->alias('p')   ->leftJoin('ArticleIntro a','p.switch_id = a.id')->where($sel_where)->count();
         $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }