|
@@ -21,23 +21,7 @@ class News extends Api
|
|
|
->order('id' , 'asc')
|
|
|
->select();
|
|
|
|
|
|
- //第一个分类的内容
|
|
|
- $list = [];
|
|
|
- if(!empty($typelist)){
|
|
|
- $list = Db::name('news')->field('content',true)
|
|
|
- ->where('company_id',$this->auth->company_id)
|
|
|
- ->where('type_id',$typelist[0]['id'])
|
|
|
- ->autopage()
|
|
|
- ->select();
|
|
|
- $list = list_domain_image($list,['image']);
|
|
|
- }
|
|
|
-
|
|
|
- $rs = [
|
|
|
- 'typelist' => $typelist,
|
|
|
- 'list' => $list,
|
|
|
- ];
|
|
|
-
|
|
|
- $this->success(1, $rs);
|
|
|
+ $this->success(1, $typelist);
|
|
|
}
|
|
|
|
|
|
//
|
|
@@ -45,15 +29,17 @@ class News extends Api
|
|
|
$type_id = input('type_id',0);
|
|
|
$keyword = input('keyword','','trim');
|
|
|
|
|
|
- $wheresearch = [];
|
|
|
+ $where = [];
|
|
|
+ if(!empty($type_id)){
|
|
|
+ $where['type_id'] = $type_id;
|
|
|
+ }
|
|
|
if(!empty($keyword)){
|
|
|
- $wheresearch['title'] = ['LIKE','%'.$keyword.'%'];
|
|
|
+ $where['title'] = ['LIKE','%'.$keyword.'%'];
|
|
|
}
|
|
|
|
|
|
$list = Db::name('news')->field('content',true)
|
|
|
->where('company_id',$this->auth->company_id)
|
|
|
- ->where('type_id',$type_id)
|
|
|
- ->where($wheresearch)
|
|
|
+ ->where($where)
|
|
|
->autopage()
|
|
|
->select();
|
|
|
$list = list_domain_image($list,['image']);
|