zxhxx 3 anos atrás
pai
commit
16415fcca3

+ 2 - 0
application/api/controller/Project.php

@@ -21,7 +21,9 @@ class Project extends Api
             ['status',-2],
             ['page',1],
             ['limit',10],
+            ['cid',$this->cid],
         ],$request);
+
         $this->success('获取成功',ProjectDonation::lst($where));
     }
 

+ 11 - 8
application/common/model/Article.php

@@ -87,18 +87,21 @@ class Article extends Model
     public static function lst($where)
     {
         $model = new self;
-        $model =$model->where('hidedata',0)->where('status',1);
-        if(isset($where['cid']) && $where['cid']>0) $model = $model->where('cid',$where['cid']);
-        if(isset($where['is_hot']) && $where['is_hot']==1) $model = $model->where('is_hotdata',$where['is_hot']);
-        if(isset($where['is_rec']) && $where['is_rec']==1) $model = $model->where('is_recdata',$where['is_rec']);
+        $xwhere = null;
+        $xwhere['hidedata'] = 0;
+        $xwhere['status'] = 1;
+        if(isset($where['cid']) && $where['cid']>0)  $xwhere['cid'] = $where['cid'];
+        if(isset($where['is_hot']) && $where['is_hot']==1)  $xwhere['is_hotdata'] = $where['is_hot'];
+        if(isset($where['is_rec']) && $where['is_rec']==1)   $xwhere['is_recdata'] = $where['is_rec'];
         if(isset($where['ifyid']) && $where['ifyid']>0)
         {
             $ids = get_all_categories(ArticleCategory::lst(['cid'=>$where['cid']]),$where['ifyid']);
-            $model = $model->wherein('article_category_id',$ids);
+            $xwhere['article_category_id'] =['in',$ids];
         }
-        if(isset($where['key']) && $where['key']!='') $model->whereLike('title',"%{$where['key']}%");
-        $rs = $model->order('sort desc,id desc')->page($where['page'],$where['limit'])->select();
-        return $rs;
+        if(isset($where['key']) && $where['key']!='') $xwhere['article_category_id']  = ['like',"%{$where['key']}%"];
+        $list = $model->where($xwhere)->order('sort desc,id desc')->page($where['page'],$where['limit'])->select();
+        $count =  $model->where($xwhere)->count();
+        return compact('count','list');
 
     }
 

+ 9 - 7
application/common/model/Lave.php

@@ -112,13 +112,15 @@ class Lave extends BaseModel
     public static function lst($where)
     {
         $model = new self;
-        if(isset($where['cid']) && $where['cid']>0) $model->where('cid',$where['cid']);
-        if(isset($where['user_id']) && $where['user_id']>0) $model->where('user_id',$where['user_id']);
-        if(isset($where['category_id']) && $where['category_id']>0) $model->where('category_id',$where['category_id']);
-        if(isset($where['paid']) && $where['paid']>-1) $model->where('paid',$where['paid']);
-        if(isset($where['help_id']) && $where['help_id']>-1) $model->where('help_id',$where['help_id']);
-        $data = $model->order('id desc')->page($where['page'],$where['limit'])->select();
-        return $data;
+        $xwhere = null;
+        if(isset($where['cid']) && $where['cid']>0)  $xwhere['cid'] = $where['cid'];
+        if(isset($where['user_id']) && $where['user_id']>0)  $xwhere['user_id'] = $where['user_id'];
+        if(isset($where['category_id']) && $where['category_id']>0) $xwhere['category_id'] = $where['category_id'];
+        if(isset($where['paid']) && $where['paid']>-1) $xwhere['paid'] = $where['paid'];
+        if(isset($where['help_id']) && $where['help_id']>-1) $xwhere['help_id'] = $where['help_id'];
+        $data = $model->where($xwhere)->order('id desc')->page($where['page'],$where['limit'])->select();
+        $count = $model->where($xwhere)->count();
+        return compact('count','data');
     }
     public static function lave_create($where)
     {

+ 7 - 7
application/common/model/project/ProjectDonation.php

@@ -98,13 +98,13 @@ class ProjectDonation extends BaseModel
     public static function lst($where)
     {
         $model = new self;
-        if (isset($where['cid']) && $where['cid']>0) $model = $model->where('cid',$where['cid']);
-        if (isset($where['title']) && $where['title'] !== '') $model = $model->where('title', 'LIKE', "%$where[title]%");
-        if (isset($where['status']) && $where['status']>-2) $model = $model->where('status',$where['status']);
-        if (isset($where['uid']) && $where['uid']>0) $model = $model->where('uid',$where['uid']);
-        $model = $model->order('sort desc,id desc');
-        $count = $model->count();
-        $list =  $model->page($where['page'],$where['limit'])->select();
+        $where1 = null;
+        if (isset($where['cid']) && $where['cid']>0) $where1['cid'] = $where['cid'];
+        if (isset($where['title']) && $where['title'] !== '') $where1['title'] =['LIKE',"%$where[title]%"];
+        if (isset($where['status']) && $where['status']>-2) $where1['status'] = $where['status'];
+        if (isset($where['uid']) && $where['uid']>0) $where1['uid'] = $where['uid'];
+        $list =  $model->where($where1)->order('sort desc,id desc')->page($where['page'],$where['limit'])->select();
+        $count = $model->where($where1)->count();
         return compact('count','list');
     }
     public static function info($id)