获取用户公告

This commit is contained in:
yaooo 2023-10-28 14:04:45 +08:00
parent 59c9c28dce
commit e2a47ec178
1 changed files with 26 additions and 0 deletions

View File

@ -11,6 +11,7 @@ namespace app\api\controller;
use app\api\ApiController; use app\api\ApiController;
use app\api\middleware\Auth; use app\api\middleware\Auth;
use app\note\model\Note as NoteList;
use app\home\model\AdminLog; use app\home\model\AdminLog;
use app\user\validate\AdminCheck; use app\user\validate\AdminCheck;
use think\exception\ValidateException; use think\exception\ValidateException;
@ -24,6 +25,30 @@ class HomeIndex extends ApiController
Auth::class => ['except' => []] Auth::class => ['except' => []]
]; ];
//公告信息
public function note_list()
{
$param = get_params();
$where = array();
if (!empty($param['keywords'])) {
$where[] = ['a.title', 'like', '%' . $param['keywords'] . '%'];
}
$where[] = ['a.status', '=', 1];
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
$note = NoteList::where($where)
->field('a.id,a.cate_id,a.title,a.content,a.status,a.create_time,a.start_time,a.end_time,c.title as cate_title')
->alias('a')
->join('NoteCate c', 'a.cate_id = c.id', 'LEFT')
->order('a.end_time desc,a.sort desc,a.create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->start_time = empty($item->start_time) ? '-' : date('Y-m-d', $item->start_time);
$item->end_time = empty($item->end_time) ? '-' : date('Y-m-d', $item->end_time);
});
$this->apiSuccess('获取成功', $note);
}
//用户信息
public function userinfo() public function userinfo()
{ {
$uid = JWT_UID; $uid = JWT_UID;
@ -31,6 +56,7 @@ class HomeIndex extends ApiController
$this->apiSuccess('获取成功', $userInfo); $this->apiSuccess('获取成功', $userInfo);
} }
//用户数据汇总
public function data_total() public function data_total()
{ {
$total = []; $total = [];