# 會員專屬(公告, 健促活動)
---
API 清單
* [TOC]
---
# 公告
## 取得公告列表
* 可用角色: 租戶管理員, 手機用戶
```url
POST /member-settings/bulletin/list
```
#### Request
* query(查詢條件json)
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
startDate | string | | | 公告時間查詢起日, 格式為YYYY-MM-DD
endDate | string | | | 公告時間查詢迄日, 格式為YYYY-MM-DD
status | string | | | 公告狀態, NONE:未公告, ACTIVE:已公告, EXPIRE:已過期
title | string | | | 關鍵字, 查詢公告標題
tenantId | string | Y | | 租戶ID, 手機用戶必填, 租戶管理員會由token帶入
* pagination(分頁json)
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
current | int | | 1 | 當前頁數
pageSize | int | | 10 | 每頁結果數量,-1 為顯示所有
* sorter(排序json), 預設是用更新時間降序排列
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
field | string | | updateTime | 排序欄位,可排序欄位有 title, startDate, status, attachType, updateTime
order | string | | desc | 升序或降序
```javascript
{
"query": {
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc"
},
"pagination": {
"current": 1,
"pageSize": 15,
"total": 0
},
"sorter": {}
}
```
#### Response
欄位 | 型態 | 說明
--- | --- | ---
id | string | 公告id
tenantId | string | 租戶id
title | string | 公告標題
content | string | 公告內
startDate | timestamp(毫秒) | 公告開始日期時間
endDate | timestamp(毫秒) | 公告結束日期時間
attachType | string | 附件類型, NONE:無, URL:連結, FILE:檔案, IMAGE:圖檔
attachObjectKey | string | attachType為FILE/IMAGE時, 表示storage 中的 objectKey, attachType為URL時, 表示連結的網址
attachUrl | string | 表示連結的網址
status | string | 公告狀態, NONE:未開始, ACTIVE:進行中, EXPIRE:已結束
stickyThread | boolean | 置頂狀態(同租戶下只會有一筆置頂公告), 置頂: true 非置頂: null/false
readStatus | boolean |是否已讀, 已讀: true 未讀: false , 租戶查詢無此欄位為null
```javascript
{
"httpCode": 200,
"result": {
"data": [
{
"id": "9d351241-1ef0-45bc-8fb1-30dd252109e1",
"title": "sasd",
"content": "wqeqwe",
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"startDate": 1652198400000,
"endDate": 1653926400000,
"createTime": 1652621388674,
"updateTime": 1652621388674,
"status": "ACTIVE",
"attachObjectKey": "member-bulletin/9196fdf9-00d0-4544-83cf-22c41cd66b05.pdf",
"attachType": "FILE",
"attachUrl": "http://10.31.104.23/swift/v1/AUTH_test/kmuh/member-bulletin/9196fdf9-00d0-4544-83cf-22c41cd66b05.pdf?temp_url_sig=1cf7f45dab706446b5971a81086fa4f65f1bb6db&temp_url_expires=1652693138",
"stickyThread": true
"readStatus":true
},
{
"id": "e5e72ec0-83e8-49d0-ae6a-564862455eb6",
"title": "fff",
"content": "feeerr",
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"startDate": 1651507200000,
"endDate": 1652025600000,
"createTime": 1652449223101,
"updateTime": 1652449223101,
"status": "EXPIRE",
"attachObjectKey": "member-bulletin/ff43bfe6-2273-49ac-8cb1-a3ea7264913d.jpg",
"attachType": "IMAGE",
"attachUrl": "http://10.31.104.23/swift/v1/AUTH_test/kmuh/member-bulletin/ff43bfe6-2273-49ac-8cb1-a3ea7264913d.jpg?temp_url_sig=0701e529a0970945d8cf4b1dfdbf593a08712f2c&temp_url_expires=1652693138"
},
{
"id": "2f36f57f-af84-4606-9cdb-b427d878420f",
"title": "dadw",
"content": "wqwe",
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"startDate": 1652889600000,
"endDate": 1653321600000,
"createTime": 1652694336818,
"updateTime": 1652694336818,
"status": "NONE",
"attachObjectKey": "http://www.google.com",
"attachType": "URL",
"attachUrl": "http://www.google.com"
},
{
"id": "e76866ff-a9a1-4032-913a-47cf46b52424",
"title": "123",
"content": "2412weqwe",
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"startDate": 1640966400000,
"endDate": 1665331200000,
"createTime": 1637286281000,
"updateTime": 1652362447144,
"status": "ACTIVE",
"attachType": "NONE"
}
],
"pagination": {
"current": 1,
"pageSize": 15,
"total": 4
},
"sorter": {},
"total": 4
}
}
```
## 取得公告資訊
* 可用角色: 租戶管理員, 手機用戶
```url
POST /member-settings/bulletin/info
```
#### Request
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
id | string |Y | | 公告ID
```javascript
{
"id": "e5e72ec0-83e8-49d0-ae6a-564862455eb6"
}
```
#### Response
欄位 | 型態 | 說明
--- | --- | ---
id | string | 公告id
tenantId | string | 租戶id
title | string | 公告標題
content | string | 公告內
startDate | timestamp(毫秒) | 公告開始日期時間
endDate | timestamp(毫秒) | 公告結束日期時間
attachType | string | 附件類型, NONE:無, URL:連結, FILE:檔案, IMAGE:圖檔
attachObjectKey | string | attachType為FILE/IMAGE時, 表示storage 中的 objectKey, attachType為URL時, 表示連結的網址
attachUrl | string | 表示連結的網址
status | string | 公告狀態, NONE:未開始, ACTIVE:進行中, EXPIRE:已結束
stickyThread | boolean | 置頂狀態(同租戶下只會有一筆置頂公告), 置頂: true 非置頂: null/false
```javascript
{
"httpCode": 200,
"result": {
"data": {
"id": "e5e72ec0-83e8-49d0-ae6a-564862455eb6",
"title": "fff",
"content": "feeerr",
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"startDate": 1651507200000,
"endDate": 1652025600000,
"createTime": 1652449223101,
"updateTime": 1652449223101,
"attachObjectKey": "member-bulletin/ff43bfe6-2273-49ac-8cb1-a3ea7264913d.jpg",
"attachType": "IMAGE",
"attachUrl": "http://10.31.104.23/swift/v1/AUTH_test/kmuh/member-bulletin/ff43bfe6-2273-49ac-8cb1-a3ea7264913d.jpg?temp_url_sig=275b3d2ec5d0432c3dbaedc8ec78ba0bbb569840&temp_url_expires=1652701881"
}
}
}
```
## 新增公告
* 可用角色: 租戶管理員
```url
POST /member-settings/bulletin/add
```
#### Request
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
title | string |Y | | 公告標題
content | string | | | 公告內容
startDate | string |Y | | 公告開始日期, format: YYYY-MM-DD
endDate | string |Y | | 公告結束日期, format: YYYY-MM-DD
attachType | string | | | 附件類型, NONE:無, URL:連結, FILE:檔案, IMAGE:圖檔
attachObjectKey | string | | | attachType為FILE/IMAGE時, 表示storage 中的 objectKey, attachType為URL時, 表示連結的網址
```javascript
// NONE
{
"title": "123",
"content": "2412weqwe",
"startDate": "2022-01-20",
"endDate": "2022-07-20",
"attachType": "NONE"
}
```
#### Response
欄位 | 型態 | 說明
--- | --- | ---
id | string | 公告id
tenantId | string | 租戶id
title | string | 公告標題
content | string | 公告內
startDate | timestamp(毫秒) | 公告開始日期時間
endDate | timestamp(毫秒) | 公告結束日期時間
attachType | string | 附件類型, NONE:無, URL:連結, FILE:檔案, IMAGE:圖檔
attachObjectKey | string | attachType為FILE/IMAGE時, 表示storage 中的 objectKey, attachType為URL時, 表示連結的網址
attachUrl | string | 表示連結的網址
status | string | 公告狀態, NONE:未開始, ACTIVE:進行中, EXPIRE:已結束
```javascript
{
"httpCode": 200,
"result": {
"data": {
"id": "e5e72ec0-83e8-49d0-ae6a-564862455eb6",
"title": "fff",
"content": "feeerr",
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"startDate": 1651507200000,
"endDate": 1652025600000,
"createTime": 1652449223101,
"updateTime": 1652449223101,
"attachObjectKey": "member-bulletin/ff43bfe6-2273-49ac-8cb1-a3ea7264913d.jpg",
"attachType": "IMAGE",
"attachUrl": "http://10.31.104.23/swift/v1/AUTH_test/kmuh/member-bulletin/ff43bfe6-2273-49ac-8cb1-a3ea7264913d.jpg?temp_url_sig=275b3d2ec5d0432c3dbaedc8ec78ba0bbb569840&temp_url_expires=1652701881"
}
}
}
```
## 編輯公告
* 可用角色: 租戶管理員
```url
POST /member-settings/bulletin/update
```
#### Request
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
id | string |Y | | 公告ID
title | string |Y | | 公告標題
content | string | | | 公告內容
startDate | string |Y | | 公告開始日期, format: YYYY-MM-DD
endDate | string |Y | | 公告結束日期, format: YYYY-MM-DD
attachType | string | | | 附件類型, NONE:無, URL:連結, FILE:檔案, IMAGE:圖檔
attachObjectKey | string | | | attachType為FILE/IMAGE時, 表示storage 中的 objectKey, attachType為URL時, 表示連結的網址
```javascript
// NONE
{
"id": "e5e72ec0-83e8-49d0-ae6a-564862455eb6",
"title": "123",
"content": "2412weqwe",
"startDate": "2022-01-20",
"endDate": "2022-07-20",
"attachType": "NONE"
}
```
#### Response
欄位 | 型態 | 說明
--- | --- | ---
id | string | 公告id
tenantId | string | 租戶id
title | string | 公告標題
content | string | 公告內
startDate | timestamp(毫秒) | 公告開始日期時間
endDate | timestamp(毫秒) | 公告結束日期時間
attachType | string | 附件類型, NONE:無, URL:連結, FILE:檔案, IMAGE:圖檔
attachObjectKey | string | attachType為FILE/IMAGE時, 表示storage 中的 objectKey, attachType為URL時, 表示連結的網址
attachUrl | string | 表示連結的網址
status | string | 公告狀態, NONE:未開始, ACTIVE:進行中, EXPIRE:已結束
```javascript
{
"httpCode": 200,
"result": {
"data": {
"id": "e5e72ec0-83e8-49d0-ae6a-564862455eb6",
"title": "fff",
"content": "feeerr",
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"startDate": 1651507200000,
"endDate": 1652025600000,
"createTime": 1652449223101,
"updateTime": 1652449223101,
"attachObjectKey": "member-bulletin/ff43bfe6-2273-49ac-8cb1-a3ea7264913d.jpg",
"attachType": "IMAGE",
"attachUrl": "http://10.31.104.23/swift/v1/AUTH_test/kmuh/member-bulletin/ff43bfe6-2273-49ac-8cb1-a3ea7264913d.jpg?temp_url_sig=275b3d2ec5d0432c3dbaedc8ec78ba0bbb569840&temp_url_expires=1652701881"
}
}
}
```
## 編輯公告置頂
* 可用角色: 租戶管理員
* 透過公告ID切換置頂狀態, 同租戶下只會有一筆置頂公告
* 只允許更新同租戶的置頂狀態
```url
POST /member-settings/bulletin/sticky
```
#### Request
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
id | string |Y | | 公告ID
```javascript
{
"id": "e5e72ec0-83e8-49d0-ae6a-564862455eb6",
}
```
#### Response
欄位 | 型態 | 說明
--- | --- | ---
id | string | 公告id
tenantId | string | 租戶id
title | string | 公告標題
content | string | 公告內
startDate | timestamp(毫秒) | 公告開始日期時間
endDate | timestamp(毫秒) | 公告結束日期時間
attachType | string | 附件類型, NONE:無, URL:連結, FILE:檔案, IMAGE:圖檔
attachObjectKey | string | attachType為FILE/IMAGE時, 表示storage 中的 objectKey, attachType為URL時, 表示連結的網址
attachUrl | string | 表示連結的網址
stickyThread | boolean | 置頂狀態(同租戶下只會有一筆置頂公告), 置頂: true 非置頂: null/false
```javascript
{
"httpCode": 200,
"result": {
"data": {
"id": "e5e72ec0-83e8-49d0-ae6a-564862455eb6",
"title": "fff",
"content": "feeerr",
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"startDate": 1651507200000,
"endDate": 1652025600000,
"createTime": 1652449223101,
"updateTime": 1652449223101,
"attachObjectKey": "member-bulletin/ff43bfe6-2273-49ac-8cb1-a3ea7264913d.jpg",
"attachType": "IMAGE",
"attachUrl": "http://10.31.104.23/swift/v1/AUTH_test/kmuh/member-bulletin/ff43bfe6-2273-49ac-8cb1-a3ea7264913d.jpg?temp_url_sig=275b3d2ec5d0432c3dbaedc8ec78ba0bbb569840&temp_url_expires=1652701881",
"stickyThread": false
}
}
}
```
## 刪除公告
* 可用角色: 租戶管理員
```url
POST /member-settings/bulletin/delete
```
#### Request
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
id | string |Y | | 公告ID
```javascript
// NONE
{
"title": "123",
"content": "2412weqwe",
"startDate": "2022-01-20",
"endDate": "2022-07-20",
"attachType": "NONE"
}
```
#### Response
欄位 | 型態 | 說明
--- | --- | ---
data | string | 公告id
```javascript
{
"httpCode": 200,
"result": {
"data": 1
}
}
```
## 取得公告上傳網址
```url
POST /member-bulletin/get-upload-url
```
* 新增/編輯公告時用來上傳圖片/檔案(PDF)
#### Request
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
isMultipart | boolean | Y | false | 是否使用分段上傳
isThumbnail | boolean | Y | false | 上傳的是否為縮圖
fileName | String | Y | | 檔名,不包含副檔名,限制最多50字
fileType | String | Y | | 副檔名, 限制最多10字
totalPart | int | **N** (isMultipart=false)<br>**Y** (isMultipart=true) | | 總分塊數量,不可小於2
parts | Array [...part] | **N** (isMultipart=false)<br>**Y** (isMultipart=true) | | part 資訊
* part(Object)
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
chunkSize | int | Y | | 該 chunk 的大小, bytes
md5 | string | Y | | 該 part 的 md5
part | int | Y | | part number, 第幾塊 chunk
```javascript
// 單檔
{
"isMultipart": false,
"isThumbnail": false,
"fileName": "ad_bg_jp",
"fileType": "png"
}
// 分塊上傳
{
"isMultipart": true,
"isThumbnail": false,
"fileName": "giphy (7)",
"fileType": "mp4",
"totalPart": 2,
"parts": [
{
"chunkSize": 5242880,
"md5": "5AACA89868CD486D81192221CF9F9415",
"part": 1
},
{
"chunkSize": 3145728,
"md5": "5AACA89868CD486D81192221CF9F9415",
"part": 2
}
]
}
```
# 健促活動
## 取得健促活動設定
* 可用角色: 不須token
```url
POST /health-improve/get-settings
```
#### Request
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
tenantId | string |Y | | 租戶ID
category | string |Y | | 健促類別. STEP_RANKING: 步數排行榜
```javascript
{
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"category": "STEP_RANKING"
}
```
#### Response
欄位 | 型態 | 說明
--- | --- | ---
id | string | 設定id
title | string | 活動名稱
tenantId | string | 租戶id
startDate | Date | 活動開始日期
endDate | Date | 活動結束日期, 如果沒有則表示活動沒有結束日
rank | string | 活動排名數
status | string | 設定是否啟用, 'ON'/'OFF'
createTime | Date | 設定建立日期
updateTime | Date | 設定更新日期
category | String | 健促活動類別
```javascript
// 健促活動未設定
{
"httpCode": 200,
"result": {}
}
// 健促活動已設定
{
"httpCode": 200,
"result": {
"data": {
"id": "ce8dacb7-b1b9-4d02-96cc-ed7911c5100c",
"title": "健促r活動",
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"startDate": 1653926400000,
"rank": 50,
"createTime": 1654004723446,
"updateTime": 1654004723446,
"status": "OFF",
"category": "STEP_RANKING"
}
}
}
```
## 查詢健促活動設定
* 可用角色: 租戶管理員
```url
POST /health-improve/query-settings
```
#### Request
* query(查詢條件json)
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
title | string | | | 活動名稱(支援模糊查詢)
status | string | | | 活動啟用狀態, ON:啟用, OFF: 停用
* pagination(分頁json)
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
current | int | | 1 | 當前頁數
pageSize | int | | 10 | 每頁結果數量,-1 為顯示所有
* sorter(排序json), 預設是用更新時間降序排列
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
field | string | | updateTime | 排序欄位,可排序欄位有updateTime, startDate, title, status
order | string | | desc | 升序或降序
```javascript
{
"query": {
"title": "r",
"status": "OFF"
},
"pagination": {
"current": 1,
"pageSize": 15,
"total": 0
},
"sorter": {}
}
```
#### Response
欄位 | 型態 | 說明
--- | --- | ---
id | string | 活動id
title | string | 活動名稱
tenantId | string | 租戶id
startDate | Date | 活動開始日期
endDate | Date | 活動結束日期, 如果沒有則表示活動沒有結束日
rank | string | 活動排名數
status | string | 設定是否啟用, 'ON'/'OFF'
createTime | Date | 設定建立日期
updateTime | Date | 設定更新日期
category | String | 健促活動類別
```javascript
{
"httpCode": 200,
"result": {
"data": [
{
"id": "ce8dacb7-b1b9-4d02-96cc-ed7911c5100c",
"title": "健促r活動",
"tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
"startDate": 1653926400000,
"rank": 50,
"createTime": 1654004723446,
"updateTime": 1654004723446,
"status": "OFF",
"category": "STEP_RANKING"
}
],
"pagination": {
"current": 1,
"pageSize": 15,
"total": 1
},
"sorter": {},
"total": 1
}
}
```
## 編輯健促活動設定
* 可用角色: 租戶管理員
```url
POST /health-improve/update-settings
```
#### Request
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
id | string |Y| | 活動id
title | string || | 活動名稱
tenantId | string || | 租戶id
startDate | Date || | 活動開始日期
endDate | Date || | 活動結束日期, 如果沒有則表示活動沒有結束日
rank | integer || | 個人活動排名數
departmentRank | integer || | 組別活動排名數
departmentRankingType | string || | 組別活動排名類型. <BR>TOTAL: 總步數<BR>AVERAGE: 人均步數<BR>DISTANCE: 累積距離
rankingPeriodType | string || | 排名統計區間類型. <BR>PERIOD: 區間<BR>MONTH: 當月
status | string || | 設定是否啟用, 'ON'/'OFF'
createTime | Date || | 設定建立日期
updateTime | Date || | 設定更新日期
```javascript
{
"id": "595f5b34-4a03-4915-b194-3acb788808bd",
"title": "健促活動",
"rank": 23,
"departmentRank": 10,
"departmentRankingType": "DISTANCE",
"rankingPeriodType": "MONTH",
"startDate": 1665417600000,
"endDate": 1672934400000,
"status": "ON"
}
```
#### Response
欄位 | 型態 | 說明
--- | --- | ---
id | string | 活動id
title | string | 活動名稱
tenantId | string | 租戶id
startDate | Date | 活動開始日期
endDate | Date | 活動結束日期, 如果沒有則表示活動沒有結束日
rank | string | 活動排名數
departmentRank | integer | 組別活動排名數
departmentRankingType | string | 組別活動排名類型. <BR>TOTAL: 總步數<BR>AVERAGE: 人均步數<BR>DISTANCE: 累積距離
rankingPeriodType | string | 排名統計區間類型. <BR>PERIOD: 區間<BR>MONTH: 當月
status | string | 設定是否啟用, 'ON'/'OFF'
createTime | Date | 設定建立日期
updateTime | Date | 設定更新日期
category | String | 健促活動類別
```javascript
{
"httpCode": 200,
"result": {
"data": {
"id": "595f5b34-4a03-4915-b194-3acb788808bd",
"title": "健促活動",
"tenantId": "5efcfd67-334e-45b3-bf49-7e52f5172891",
"startDate": 1665417600000,
"endDate": 1672934400000,
"rank": 23,
"departmentRank": 10,
"createTime": 1668592441172,
"updateTime": 1668592441172,
"status": "ON",
"category": "STEP_RANKING",
"departmentRankingType": "DISTANCE",
"rankingPeriodType": "MONTH"
}
}
}
```
## 透過ID取得健促活動設定
* 可用角色: 租戶管理員
```url
POST /health-improve/get-settings-info
```
#### Request
欄位 | 型態 | 必填 | 預設 | 說明
---|---|---|---|---
id | string |Y| | 活動id
```javascript
{
"id": "ce8dacb7-b1b9-4d02-96cc-ed7911c5100c",
}
```
#### Response
欄位 | 型態 | 說明
--- | --- | ---
id | string | 活動id
title | string | 活動名稱
tenantId | string | 租戶id
startDate | Date | 活動開始日期
endDate | Date | 活動結束日期, 如果沒有則表示活動沒有結束日
rank | string | 活動排名數
departmentRank | integer | 組別活動排名數
departmentRankingType | string | 組別活動排名類型. <BR>TOTAL: 總步數<BR>AVERAGE: 人均步數<BR>DISTANCE: 累積距離
rankingPeriodType | string | 排名統計區間類型. <BR>PERIOD: 區間<BR>MONTH: 當月
status | string | 設定是否啟用, 'ON'/'OFF'
createTime | Date | 設定建立日期
updateTime | Date | 設定更新日期
category | String | 健促活動類別
```javascript
{
"httpCode": 200,
"result": {
"data": {
"id": "595f5b34-4a03-4915-b194-3acb788808bd",
"title": "健促活動",
"tenantId": "5efcfd67-334e-45b3-bf49-7e52f5172891",
"startDate": 1665417600000,
"endDate": 1672934400000,
"rank": 23,
"departmentRank": 10,
"createTime": 1668592441172,
"updateTime": 1668592441172,
"status": "ON",
"category": "STEP_RANKING",
"departmentRankingType": "DISTANCE",
"rankingPeriodType": "MONTH"
}
}
}
```