|
|
@@ -35,6 +35,45 @@ class NoticeService extends BaseService
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 列表数据
|
|
|
+ * @param $params
|
|
|
+ * @param int $pageSize
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getDataList($params, $pageSize = 15)
|
|
|
+ {
|
|
|
+ $where = ['a.mark' => 1,'status'=>1];
|
|
|
+ $status = isset($params['status'])? $params['status'] : 0;
|
|
|
+ if($status>0){
|
|
|
+ $where['a.status'] = $status;
|
|
|
+ }
|
|
|
+ $list = $this->model->from('notice as a')
|
|
|
+ ->where($where)
|
|
|
+ ->where(function ($query) use($params){
|
|
|
+ $keyword = isset($params['keyword'])? $params['keyword'] : '';
|
|
|
+ if($keyword){
|
|
|
+ $query->where('a.title','like',"%{$keyword}%");
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ->select(['a.*'])
|
|
|
+ ->orderBy('a.id','desc')
|
|
|
+ ->paginate($pageSize > 0 ? $pageSize : 9999999);
|
|
|
+ $list = $list? $list->toArray() :[];
|
|
|
+ if($list){
|
|
|
+ foreach($list['data'] as &$item){
|
|
|
+ $item['create_time'] = $item['create_time']? datetime($item['create_time'],'Y-m-d H.i.s') : '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'pageSize'=> $pageSize,
|
|
|
+ 'total'=>isset($list['total'])? $list['total'] : 0,
|
|
|
+ 'list'=> isset($list['data'])? $list['data'] : []
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 设置置顶
|
|
|
* @return array
|
|
|
* @since 2020/11/21
|