获取用户公告
This commit is contained in:
parent
59c9c28dce
commit
e2a47ec178
|
@ -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 = [];
|
||||||
|
|
Loading…
Reference in New Issue