1.优化拉取公告列表接口/api/notice/noticeList,不需要token鉴权
This commit is contained in:
@@ -11,6 +11,11 @@ use support\Response;
|
||||
|
||||
class Notice extends MobileBase
|
||||
{
|
||||
/** 公告列表:公开接口,无需 auth-token / user-token */
|
||||
protected array $noNeedLogin = ['noticeList'];
|
||||
|
||||
protected array $noNeedAuthToken = ['noticeList'];
|
||||
|
||||
public function noticeList(Request $request): Response
|
||||
{
|
||||
$response = $this->initializeMobile($request);
|
||||
@@ -32,8 +37,9 @@ class Notice extends MobileBase
|
||||
}
|
||||
}
|
||||
$readMap = [];
|
||||
if ($popoutNoticeIds !== []) {
|
||||
$readRows = UserNoticeRead::where('user_id', $this->auth->id)->whereIn('notice_id', $popoutNoticeIds)->column('notice_id');
|
||||
$userId = ($this->auth && $this->auth->isLogin()) ? $this->auth->id : 0;
|
||||
if ($userId > 0 && $popoutNoticeIds !== []) {
|
||||
$readRows = UserNoticeRead::where('user_id', $userId)->whereIn('notice_id', $popoutNoticeIds)->column('notice_id');
|
||||
$readMap = array_flip($readRows);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user