wesmiler 2 mesi fa
parent
commit
b415409f87
2 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 1 1
      app/Models/ArticleCateModel.php
  2. 1 1
      app/Services/Api/ArticleService.php

+ 1 - 1
app/Models/ArticleCateModel.php

@@ -29,7 +29,7 @@ class ArticleCateModel extends BaseModel
     public function articles()
     {
         return $this->hasMany(ArticleModel::class, 'cate_id', 'id')
-            ->where(['status'=>1,'mark'=>1]);
+            ->where(['status'=>1,'mark'=>1])->take(3);
     }
 
 }

+ 1 - 1
app/Services/Api/ArticleService.php

@@ -182,7 +182,7 @@ class ArticleService extends BaseService
 
         $limit = ConfigService::make()->getConfigByCode('index_article_num',3);
         $datas = ArticleCateModel::with(['articles'=>function($query) use($limit){
-            $query->limit($limit);
+//            $query->limit($limit);
         }])->where(['type'=>$type,'status'=>1,'mark'=>1])
             ->select(['id','name','sort','type'])
             ->get()