1.优化拉取公告列表接口/api/notice/noticeList,不需要token鉴权
This commit is contained in:
@@ -11,6 +11,11 @@ use support\Response;
|
|||||||
|
|
||||||
class Notice extends MobileBase
|
class Notice extends MobileBase
|
||||||
{
|
{
|
||||||
|
/** 公告列表:公开接口,无需 auth-token / user-token */
|
||||||
|
protected array $noNeedLogin = ['noticeList'];
|
||||||
|
|
||||||
|
protected array $noNeedAuthToken = ['noticeList'];
|
||||||
|
|
||||||
public function noticeList(Request $request): Response
|
public function noticeList(Request $request): Response
|
||||||
{
|
{
|
||||||
$response = $this->initializeMobile($request);
|
$response = $this->initializeMobile($request);
|
||||||
@@ -32,8 +37,9 @@ class Notice extends MobileBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$readMap = [];
|
$readMap = [];
|
||||||
if ($popoutNoticeIds !== []) {
|
$userId = ($this->auth && $this->auth->isLogin()) ? $this->auth->id : 0;
|
||||||
$readRows = UserNoticeRead::where('user_id', $this->auth->id)->whereIn('notice_id', $popoutNoticeIds)->column('notice_id');
|
if ($userId > 0 && $popoutNoticeIds !== []) {
|
||||||
|
$readRows = UserNoticeRead::where('user_id', $userId)->whereIn('notice_id', $popoutNoticeIds)->column('notice_id');
|
||||||
$readMap = array_flip($readRows);
|
$readMap = array_flip($readRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
- `POST` 时请求头 `Content-Type: application/json`,参数放在 JSON body
|
- `POST` 时请求头 `Content-Type: application/json`,参数放在 JSON body
|
||||||
- `GET` 兼容模式下,参数走 URL query string
|
- `GET` 兼容模式下,参数走 URL query string
|
||||||
- **例外**:公告模块 `/api/notice/noticeList`、`/api/notice/noticeConfirm` **仅支持 `GET`**,参数一律走 URL query string
|
- **例外**:公告模块 `/api/notice/noticeList`、`/api/notice/noticeConfirm` **仅支持 `GET`**,参数一律走 URL query string
|
||||||
|
- **公告列表免鉴权**:`GET /api/notice/noticeList` **无需** `auth-token`、`user-token`;若仍携带 `user-token` 则强弹窗项可返回该用户真实的 `is_read`
|
||||||
- 鉴权类接口 `/api/v1/authToken` 仍为 `GET`
|
- 鉴权类接口 `/api/v1/authToken` 仍为 `GET`
|
||||||
- 时间:UTC 时间戳(秒) + 服务端时区配置
|
- 时间:UTC 时间戳(秒) + 服务端时区配置
|
||||||
- 金额:数字传输(如 `"100.00"`),客户端展示统一保留两位小数(存储仍为 `decimal(18,2)`)
|
- 金额:数字传输(如 `"100.00"`),客户端展示统一保留两位小数(存储仍为 `decimal(18,2)`)
|
||||||
@@ -714,6 +715,7 @@
|
|||||||
|
|
||||||
### 6.1 拉取公告列表
|
### 6.1 拉取公告列表
|
||||||
- **GET** `/api/notice/noticeList`
|
- **GET** `/api/notice/noticeList`
|
||||||
|
- **鉴权**:无需 `auth-token`、`user-token`(公开接口)
|
||||||
|
|
||||||
请求参数(query string):
|
请求参数(query string):
|
||||||
- `page`:int(可选,默认 1)
|
- `page`:int(可选,默认 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user