---
tags: NeutecLife App
---
# 2-2.分類列表:借物 API
:::info
目錄:
<a href="https://hackmd.io/FStSBTFdRhac3tsDr8OyiA">0.登入功能相關 API 文件</a>
<a href="https://hackmd.io/coOyibBDRYqJpluQIQFYmg">1.首頁功能相關 API 文件</a>
<a href="https://hackmd.io/-A3kGYJ8SHyjegBROlwJow">2-1.分類列表:分類列表頁、借書&歸還 API 文件</a>
<a href="https://hackmd.io/boCGrFpsR0CciLYEXS-kxw">2-2.分類列表:借物 API 文件</a>
<a href="https://hackmd.io/jBWDb0OaT_KV-_ducdzqsQ">2-3.分類列表:會議室&英文課 API 文件</a>
<a href="https://hackmd.io/FhZ89ZDxSbOK8oYslEXuCA">3.最新消息 API 文件</a>
<a href="https://hackmd.io/SSAxobFGQEC8lyHiu485iQ">4.通知 API 文件</a>
<a href="https://hackmd.io/Fz8d0LtbS2iwhuI3QmmzYQ">5.我的 API 文件</a>
> [time=Dec 5, 2024]
* `更新` Document init
* `更新` 因文件長度過長,將借物資料移至新文件中
> [time=Jan 8, 2025]
* `新增` itemPage-favorite (與itemDetailPage-favorite相同)
> [time=Jan 22, 2025]
* `新增` itemPage-all 每個module都補上屬於自己的status
> [time=Feb 19, 2025]
* `更新` itemDatePickerPage中的calendarStartDate更名為canLoanStartDate、calendarEndDate更名為canLoanEndDate,並加入remark解釋[App繪製物品預約月曆的流程](#App繪製借物預約日曆注意事項 )
> [time=Feb 25, 2025]
* `更新` itemGroupId更名為functionId
> [time=Aug 12, 2025]
* `更新` someoneLoanedDays欄位中,除了借用者的日期外,亦包含「第一週不可外借」的日期
----
:::
### ✅ itemPage
URL: `wss://{domain name}/`
Method: `wss`
Descirption: `借用物品入口頁資訊`
App Screen: <a href="https://app.zeplin.io/project/65d8474dc2c129ce739d5420/screen/65dc5cc460a3f74ad462b2a4">`zeplin前端畫面`</a>
#### Remark
```
1. 若該物品分類底下無任何物品,就不列出;確保每個分類底下至少有一項資
料。
2. 精選推薦區塊一定要有資料,當API要建立recommendItemList這個module時,若後台無設定任何資料,預設抓取DB中前5筆(LIMIT 5)已上架資料。
```
<br>
**Request**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 資料參數內容 |
| functionId | int | Y | 分類列表id(1書籍、3其他設備、5電動、6露營裝備、7桌遊、8其他)|
| categoryId | int | Y | itemlist的書籍分類id<br>0:代表全部,「全部」這個分類由App端加入 |
| sort | int | Y | itemlist的排序方式 (都只有降冪DESC方式)<br>1:上架新到舊(預設值)<br>2: 評價高到低<br>3: 借閱多到少 |
| lastId | int | | itemlist的分頁機制:帶入目前資料的最後一筆itemId,API將回傳此itemId之後的30筆資料。若不帶此參數則提供最前面的30筆資料。 |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemPage",
"module": "all",
"type": "select",
"data": {
"functionId":4,
"categoryId":0,
"sort":1,
"lastId":30
}
}
```
**Response**
| Parameter | Type | Require | Description |
| --------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | int | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | array | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | int | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容 |
| datetime | string | Y | 資料發佈時間 |
<br>
**basicInfo module 基本資料**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| functionId | int | Y | 分類列表id(1書籍、3其他設備、5電動、6露營裝備、7桌遊、8其他) |
| title | string | Y | 功能大類名稱 |
<br>
**promoteTextList module 推廣文字區塊(則數限制1~10筆)**
| Parameter | Type | Require | Description |
| --------- | -------- | ------- | ----------- |
| title | string | Y | 推廣文字標題 |
| content | string | Y | 推廣文字內容 |
<br>
**recommendItemList module 精選推薦區塊**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| itemId | int | Y | 物品id |
| categoryId | int | Y | 物品分類id,0代表全部 |
| title | string | Y | 物品標題 |
| desc | string | Y | 物品描述 |
| isNew | bool | Y | 是否為新上架<br>(true:7日內新上架 false:非7日內上架) |
| isFavorite | bool | Y | 是否已標註為我的最愛<br>(true:已標註 false:未標註)|
| imgUrl | string | Y | 圖片路徑 |
| star | float | Y | 星等(四捨五入,小數點1位,點零也要出現。ex:5.0) |
| ratingNum | int | Y | 評價總數 |
<br>
**itemList module 物品列表區塊**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| itemId | int | Y | 物品id |
| categoryId | int | Y | 物品分類id |
| title | string | Y | 物品標題 |
| desc | string | Y | 物品描述 |
| isNew | bool | Y | 是否為新上架<br>(true:7日內新上架 false:非7日內上架) |
| isFavorite | bool | Y | 是否已標註為我的最愛<br>(true:已標註 false:未標註)|
| imgUrl | string | Y | 圖片路徑 |
| star | float | Y | 星等(四捨五入,小數點1位,點零也要出現。ex:5.0) |
| ratingNum | int | Y | 評價總數 |
```json=
{
"requestId": "1fb7d801-4a05-0b1d-ea16-de1d32c97d6c",
"status": 200,
"page": "itemPage",
"info": [
{
"module": "basicInfo",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"functionId": 4,
"title": "桌遊",
}
],
"datetime": "2023/11/1 12:38:11"
},
{
"module": "promoteTextList",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"title": "成為真正的遊戲大亨!",
"content": "結交新朋友,迎接無限樂趣"
}
],
"datetime": "2023/11/1 12:38:11"
},
{
"module": "recommendItemList",
"status": 200,
"type": "list",
"num": 2,
"data": [
{
"itemId": 1,
"categoryId": 1,
"title": "Bang!骰子版",
"desc":"介紹文字",
"isNew": true,
"isFavorite": true,
"imgUrl": "/img/item/1.png",
"star": 4.7,
"ratingNum": 99
},
{
"itemId": 2,
"categoryId": 1,
"title": "Seven紙牌遊戲",
"desc":"介紹文字",
"isNew": true,
"isFavorite": false,
"imgUrl": "/img/item/2.png",
"star": 4.7,
"ratingNum": 99
}
],
"datetime": "2023/11/1 12:38:11"
},
{
"module": "itemCategory",
"status": 200,
"type": "list",
"num": 3,
"data": [
{
"categoryId": 1,
"name": "派對遊戲",
},
{
"categoryId": 2,
"name": "陣營遊戲",
},
{
"categoryId": 3,
"name": "策略遊戲",
},
],
"datetime": "2023/11/1 12:38:11"
},
{
"module": "itemList",
"status": 200,
"type": "list",
"num": 2,
"data": [
{
"itemId": 1,
"categoryId": 1,
"title": "印加寶藏",
"desc":"桌遊介紹",
"isNew": true,
"isFavorite": true,
"imgUrl": "/img/item/1.png",
"star": 4.7,
"ratingNum": 99
},
{
"itemId": 2,
"categoryId": 2,
"title": "花火",
"desc":"桌遊介紹",
"isNew": true,
"isFavorite": false,
"imgUrl": "/img/item/2.png",
"star": 4.1,
"ratingNum": 199
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2023/11/1 12:38:11"
}
```
<br>
### ✅ itemPage-itemList 分頁機制
**Request for bookList Module 物品列表區塊(第二頁為例)**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 參數資料 |
| functionId | int | Y | 分類列表id(1書籍、3其他設備、5電動、6露營裝備、7桌遊、8其他) |
| categoryId | int | Y | itemList的物品分類id<br>0:代表全部,「全部」這個分類由App端加入 |
| sort | int | Y | itemList的排序方式 (都只有降冪DESC方式)<br>1:上架新到舊(預設值)<br>2: 評價高到低<br>3: 借閱多到少 |
| lastId | int | | itemList的分頁機制:帶入目前資料的最後一筆itemId,API將回傳此itemId之後的30筆資料。若不帶此參數則提供最前面的30筆資料。 |
#### Remark
```
以下為要求itemList第二頁的範例
```
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemPage",
"module": "itemList",
"type": "select",
"data": {
"functionId": 5,
"categoryId":0,
"sort":1,
"lastId": 30
}
}
```
<br>
**Response for itemList Module 物品列表區塊(第二頁為例)**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| itemId | int | Y | 物品id |
| categoryId | int | Y | 物品分類id |
| title | string | Y | 物品標題 |
| desc | string | Y | 物品描述 |
| isNew | bool | Y | 是否為新上架<br>(true:7日內新上架 false:非7日內上架) |
| isFavorite | bool | Y | 是否已標註為我的最愛<br>(true:已標註 false:未標註)|
| imgUrl | string | Y | 圖片路徑 |
| star | float | Y | 星等(四捨五入,小數點1位,點零也要出現。ex:5.0) |
| ratingNum | int | Y | 評價總數 |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"status": 200,
"page": "itemPage",
"info": [
{
"module": "itemList",
"status":200,
"type": "list",
"num": 2,
"data": [
{
"itemId": 1,
"categoryId": 1,
"title": "印加寶藏",
"desc":"桌遊介紹",
"isNew": true,
"isFavorite": true,
"imgUrl": "/img/item/1.png",
"star": 4.7,
"ratingNum": 99
},
{
"itemId": 2,
"categoryId": 2,
"title": "花火",
"desc":"桌遊介紹",
"isNew": true,
"isFavorite": false,
"imgUrl": "/img/item/2.png",
"star": 4.1,
"ratingNum": 199
}
],
"datetime":"2024/6/26 12:38:11"
},
],
"datetime": "2024/6/26 12:38:11"
}
```
<br>
### ✅ itemPage-favorite
URL: `wss://{domain name}/`
Method: `wss`
Descirption: `物品列表頁-收藏/取消收藏 動作`
App Screen: <a href="https://app.zeplin.io/project/65d8474dc2c129ce739d5420/screen/65dc5cc460a3f74ad462b2a4">`zeplin前端畫面`</a>
#### Remark
```
收藏異動的同時,有訂閱的頁面(ex:minePage or itemPage)也需要同步資料。
```
**Request for 新增收藏動作**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 資料參數 |
| itemId | int | Y | 書籍/物品id |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemPage",
"module": "favorite",
"type": "insert",
"data": {
"itemId":1
}
}
```
**Response for 新增收藏成功**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | int | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | array | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | int | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容 |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"status":200,
"page":"minePage",
"info": [
{
"module": "favoriteList",
"status": 200,
"type": "add",
"num": 1,
"data": [
{
"type":1,
"functionId":5,
"id":21,
"title":"麥克風",
"subTitle":"指向性麥克風",
"iconUrl":"/img/item/21.png"
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2024/7/2 12:38:11"
}
```
<br>
**Request for 取消收藏動作**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 資料參數 |
| itemId | int | Y | 書籍id |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemPage",
"module": "favorite",
"type": "delete",
"data": {
"itemId":21
}
}
```
**Response for 取消收藏成功**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | int | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | array | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | int | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容 |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"status":200,
"page":"minePage",
"info": [
{
"module": "favoriteList",
"status": 200,
"type": "remove",
"num": 1,
"data": [
{
"type":1,
"functionId":5,
"id":21,
"title":"麥克風",
"subTitle":"指向性麥克風",
"iconUrl":"/img/item/21.png"
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2024/7/2 12:38:11"
}
```
<br>
### ✅ itemDetailPage
URL: `wss://{domain name}/`
Method: `wss`
Descirption: `物品內容頁資訊`
App Screen: <a href="https://app.zeplin.io/project/65d8474dc2c129ce739d5420/screen/65dc5cbe0d9627c36f9d77b0">`zeplin前端畫面`</a>
**Request**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 資料參數 |
| itemId | int | Y | 物品id |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemDetailPage",
"module": "all",
"type": "select",
"data": {
"itemId": 2
}
}
```
**Response**
| Parameter | Type | Require | Description |
| ----------- | ------ | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | int | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | array | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | int | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容陣列 |
<br>
**Response itemContent module 物品詳細內容區塊**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| itemId | int | Y | 物品id|
| imgUrl | array | Y | 物品圖片,1或2張圖片|
| title | string | Y | 物品名稱 |
| categoryName| string | Y | 類別名稱 |
| clubName | string | Y | 所有者(社團名稱) |
| serialNo | string | Y | 物品編號 |
| location | string | Y | 物品位置 |
| isNew | bool | Y | 是否為7日內新上架(true:新上架 false:非新上架) |
| isFavorite | bool | Y | 是否已標註我的最愛 (true:已標註 false:未標註) |
| desc | string | Y | 物品介紹內容資訊 |
| star | float | Y | 星等(四捨五入,小數點1位,點零也要出現。ex:5.0) |
| ratingNum | int | Y | 評價總數 |
| loanRule | string | Y | 借用規則文字內容 |
| returnRule | string | Y | 歸還與展延文字內容 |
| isLoaned | bool | Y | 是否曾經借用過<br>true:曾借用 false:不曾借用<br>(用來判斷是否出現評分及評論表單) |
<br>
**Response commentList module 評論列表區塊**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| name | string | Y | 評論者<br>(匿名留言:匿名<br>實名留言:NE097-Bruce Huang)|
| star | float | Y | 星等(四捨五入,小數點1位,點零也要出現。ex:5.0) |
| comment | string | Y | 評論內容(API判斷是否有輸入留言:去除半形空白與全形空白後為空值則為「無評論」) |
```json=
{
"requestId": "1fb7d801-4a05-0b1d-ea16-de1d32c97d6c",
"status": 200,
"page": "itemDetailPage",
"info": [
{
"module": "itemContent",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"itemId":2,
"imgUrl":["/img/item/1.png", "/img/item/1-2.png"],
"title": "露營帳篷",
"categoryName":"帳篷",
"clubName":"登山社",
"serialNo":"B3028",
"location":"17F電競區鏡面櫃",
"isNew": true,
"isFavorite": true,
"desc":"物品介紹有很多字",
"star":4.5,
"ratingNum":11,
"loanRule":"這裡將顯示「借用規則」",
"returnRule":"這裡將顯示「歸還與展延規則」",
"isLoaned":true
}
],
"datetime": "2023/11/1 12:38:11"
},
{
"module": "commentList",
"status": 200,
"type": "list",
"num": 2,
"data": [
{
"name": "匿名",
"star": 5.0,
"comment": "太好用!!"
},
{
"name": "NE097-Bruce Huang",
"star": 5.0,
"comment": "好好玩!!"
}
],
"datetime": "2023/11/1 12:38:11"
},
{
"module": "loanPanel",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":1,
"itemId": 1,
"nextCanLoanDate": "2023/6/10",
"nextExpectReturnDate": "2023/6/16",
"loanedDate": "",
"expectReturnDate": "",
"leftDays": 7,
"loanWorkDays": 7,
"extendWorkDays": 15,
"expectExtendReturnDate":""
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2024/4/17 12:38:11"
}
```
#### 借物狀態1: 任何人都會看見(除非本人正在借用外)的loanPanel


| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| loanPanelStatus| int | Y | 借用板塊狀態=1 |
| itemId | int | Y | 物品id |
| nextCanLoanDate| string | Y | 預計可借用日期(排隊時顯示用) |
| nextExpectReturnDate| string | Y | 預計可借用的歸還日期=nextCanLoanDate+loanWorkDays+holidays |
| loanedDate | string | Y | 借用時間=系統今日日期 |
| expectReturnDate| string| Y | 預計歸還日期=今日+N個工作天(根據該物物品借用規則) |
| leftDays | int | Y | 剩餘幾日須歸還=14 |
| loanWorkDays | int | Y | 物品可借用工作天數=14(根據該物物品借用規則) |
| extendWorkDays | int | Y | 可展延工作天數=15(根據該物物品借用規則) |
| expectExtendReturnDate| string | Y | 預計展延後歸還日期 |
```json=
{
"module": "loanPanel",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":1,
"itemId": 1,
"nextCanLoanDate": "",
"nextExpectReturnDate": "",
"loanedDate": "",
"expectReturnDate": "",
"leftDays": 7,
"loanWorkDays": 7,
"extendWorkDays": 15,
"expectExtendReturnDate":""
}
],
"datetime": "2023/11/1 12:38:11"
}
```
<br>
#### 借物狀態2: A君已借了某物品,尚未在借用日期內,當未開放展延時(歸還日+3days)<now()時,A君在某物品的頁面將顯示「已預約」的loanPanel

| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| loanPanelStatus| int | Y | 借用板塊狀態=2 |
| itemId | int | Y | 物品id |
| nextCanLoanDate| string | Y | 預計可借用日期(排隊時顯示用) |
| nextExpectReturnDate| string | Y | 預計可借用的歸還日期=nextCanLoanDate+loanWorkDays+holidays |
| loanedDate | string | Y | 借用時間 |
| expectReturnDate| string| Y | 預計歸還日期 |
| leftDays | int | Y | 剩餘幾日須歸還 |
| loanWorkDays | string | Y | 物品可借用工作天數=7(根據該物物品借用規則) |
| extendWorkDays | string | Y | 可展延工作天數=7(根據該物物品借用規則) |
| expectExtendReturnDate| string | Y | 預計展延後歸還日期 |
```json=
{
"module": "loanPanel",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":2,
"itemId": 1,
"nextCanLoanDate": "",
"nextExpectReturnDate": "",
"loanedDate":"2024/4/17",
"expectReturnDate":"2024/4/27",
"leftDays": 0,
"loanWorkDays": 7,
"extendWorkDays": 7,
"expectExtendReturnDate":""
}
],
"datetime": "2023/11/1 12:38:11"
}
```
<br>
#### 借物狀態3: A君已借了某物品,已在借用日期內,當未開放展延時(歸還日+3days)<now()時,A君在某物品的頁面將顯示「尚未開放展延」的loanPanel

| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| loanPanelStatus| int | Y | 借用板塊狀態=3 |
| itemId | int | Y | 物品id |
| nextCanLoanDate| string | Y | 預計可借用日期(排隊時顯示用) |
| nextExpectReturnDate| string | Y | 預計可借用的歸還日期=nextCanLoanDate+loanWorkDays+holidays |
| loanedDate | string | Y | 借用時間 |
| expectReturnDate| string| Y | 預計歸還日期 |
| leftDays | int | Y | 剩餘幾日須歸還 |
| loanWorkDays | string | Y | 物品可借用工作天數=7(根據該物物品借用規則) |
| extendWorkDays | string | Y | 可展延工作天數=7(根據該物物品借用規則) |
| expectExtendReturnDate| string | Y | 預計展延後歸還日期 |
```json=
{
"module": "loanPanel",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":3,
"itemId": 1,
"nextCanLoanDate": "",
"nextExpectReturnDate": "",
"loanedDate":"2024/4/17",
"expectReturnDate":"2024/4/27",
"leftDays": 6,
"loanWorkDays": 7,
"extendWorkDays": 7,
"expectExtendReturnDate":""
}
],
"datetime": "2023/11/1 12:38:11"
}
```
<br>
#### 借物狀態4: 當A君借用了某物品,當(歸還日+3days)>=now() && 往後N日都無人預約借用時,A君在某物品的頁面將顯示「我要展延」的loanPanel


| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| loanPanelStatus| int | Y | 借用板塊狀態=4 |
| itemId | int | Y | 物品id |
| nextCanLoanDate| string | Y | 預計可借用日期(排隊時顯示用) |
| nextExpectReturnDate| string | Y | 預計可借用的歸還日期=nextCanLoanDate+loanWorkDays+holidays |
| loanedDate | string | Y | 借用時間 |
| expectReturnDate| string| Y | 預計歸還日期 |
| leftDays | int | Y | 剩餘幾日須歸還 |
| loanWorkDays | int | Y | 物品可借用工作天數=14(根據該物物品借用規則) |
| extendWorkDays | int | Y | 可展延工作天數=10(根據該物物品借用規則) |
| expectExtendReturnDate| string | Y | 預計展延後歸還日期 |
```json=
{
"module": "loanPanel",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":4,
"itemId": 1,
"nextCanLoanDate": "",
"nextExpectReturnDate": "",
"loanedDate":"2024/1/17",
"expectReturnDate":"2024/4/27",
"leftDays": 3,
"loanWorkDays": 7,
"extendWorkDays": 10,
"expectExtendReturnDate":"2024/5/18"
}
],
"datetime": "2023/11/1 12:38:11"
}
```
#### 借物狀態5: 當A君借用了某物品,當(歸還日+3days)>=now(),或歸還日往後一個工作日有其他人借用時,A君在某物品的頁面將顯示「無法展延」的loanPanel

| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| loanPanelStatus| int | Y | 借用板塊狀態=5 |
| itemId | int | Y | 物品id |
| nextCanLoanDate| string | Y | 預計可借用日期(排隊時顯示用) |
| nextExpectReturnDate| string | Y | 預計可借用的歸還日期=nextCanLoanDate+loanWorkDays+holidays |
| loanedDate | string | Y | 借用時間 |
| expectReturnDate| string| Y | 預計歸還日期 |
| leftDays | int | Y | 剩餘幾日須歸還 |
| loanWorkDays | int | Y | 物品可借用工作天數=14(根據該物物品借用規則) |
| extendWorkDays | int | Y | 可展延工作天數=15(根據該物物品借用規則) |
| expectExtendReturnDate| string | Y | 預計展延後歸還日期 |
```json=
{
"module": "loanPanel",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":5,
"itemId": 1,
"nextCanLoanDate": "",
"nextExpectReturnDate": "",
"loanedTime":"2024/1/17",
"expectReturnDate":"2024/4/9",
"leftDays": 7,
"loanWorkDays": 7,
"extendWorkDays": 10,
"expectExtendReturnDate":""
}
],
"datetime": "2023/11/1 12:38:11"
}
```
#### 借物狀態6: 當A君借用了某物品,並且已展延時,A君在某物品的頁面將顯示「已展延」的loanPanel

| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| loanPanelStatus| int | Y | 借用板塊狀態=6 |
| itemId | int | Y | 物品id |
| nextCanLoanDate| string | Y | 預計可借用日期(排隊時顯示用) |
| nextExpectReturnDate| string | Y | 預計可借用的歸還日期=nextCanLoanDate+loanWorkDays+holidays |
| loanedDate | string | Y | 借用時間 |
| expectReturnDate| string| Y | 預計歸還日期 |
| leftDays | int | Y | 剩餘幾日須歸還 |
| loanWorkDays | int | Y | 物品可借用工作天數=14(根據該物物品借用規則) |
| extendWorkDays | int | Y | 可展延工作天數=15(根據該物物品借用規則) |
| expectExtendReturnDate| string | Y | 預計展延後歸還日期 |
```json=
{
"module": "loanPanel",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":6,
"itemId": 1,
"nextCanLoanDate": "",
"nextExpectReturnDate": "",
"loanedTime":"2024/4/17",
"expectReturnDate":"2024/4/26",
"leftDays": 7,
"loanWorkDays": 7,
"extendWorkDays": 10,
"expectExtendReturnDate":"2024/5/20"
}
],
"datetime": "2023/11/1 12:38:11"
}
```
</br>
#### 借物狀態7: 當A君借用了某物品,並且已逾期時,A君在某物品頁面所顯示的loanPanel

| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| loanPanelStatus| int | Y | 借用板塊狀態=7 |
| itemId | int | Y | 物品id |
| loanedDate | string | Y | 借用時間 |
| expectReturnDate| string| Y | 預計歸還日期 |
| leftDays | int | Y | 剩餘幾日須歸還 |
| loanWorkDays | int | Y | 物品可借用工作天數=14(根據該物物品借用規則) |
| extendWorkDays | int | Y | 可展延工作天數=15(根據該物物品借用規則) |
| expectExtendReturnDate| string | Y | 預計展延後歸還日期 |
```json=
{
"module": "loanPanel",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":7,
"itemId": 1,
"nextCanLoanDate": "",
"nextExpectReturnDate": "",
"loanedTime":"2024/4/17",
"expectReturnDate":"2024/4/26",
"leftDays": -1,
"loanWorkDays": 7,
"extendWorkDays": 10,
"expectExtendReturnDate":"2024/5/20"
}
],
"datetime": "2023/11/1 12:38:11"
}
```
<br>
#### Response for 失敗(物品被刪除或下架)
| Parameter | Type | Require | Description |
| ----------| -------| ------- | ----------- |
| requestId | string | Y | 對話id |
| status | int | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| errorMsg | string | Y | 錯誤訊息 |
| datetime | string | Y | 資料回應時間 |
<img src="https://hackmd.io/_uploads/BkGqYWOXel.png" width="250" />
```
當物品被刪除或下架時再透過「舊通知」或「舊蒐藏」點擊,將會看見錯誤訊息Dialog。
```
```json=
{
"requestId": "1fb7d801-4a05-0b1d-ea16-de1d32c97d6c",
"status": 200,
"page": "itemDetailPage",
"info": [
{
"module": "itemContent",
"status": 1022,
"errorMsg": "查無此物品",
"detetime": "2025/8/13 12:38:11"
}
],
"datetime": "2025/8/13 12:38:11"
}
```
</br>
### ✅itemDetailPage-extend
URL: `wss://{domain name}/`
Method: `wss`
Descirption: `物品內容頁資訊-展延動作`
App Screen: <a href="https://app.zeplin.io/project/65d8474dc2c129ce739d5420/screen/65dc5cac576c4e8831d1140c">`zeplin前端畫面`</a>
#### Remark
```
展延是不能選時間的,借用才可以選時間。
當完成動作後,將需要立即更新loanPanel的module資訊。
```
**Request**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 資料參數 |
| itemId | int | Y | 物品id |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemDetailPage",
"module": "extend",
"type": "update",
"data": {
"itemId":1
}
}
```
**Response**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | number | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | string | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | number | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容 |
| toast | string | Y | 功能資料id |
| isPositive| bool | Y | 回應訊息是否為積極行為,true:icon顏色為藍色, false:icon顏色為白色 |
```json=
{
"requestId": "1fb7d801-4a05-0b1d-ea16-de1d32c97d6c",
"status":200,
"page":"itemDetailPage",
"info": [
{
"module": "extend",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"toast": "展延成功",
"isPositive": true
}
],
"datetime": "2023/11/1 12:38:11"
},
{
"module": "loanPanel",
"status":200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":5,
"itemId": 1,
"nextCanLoanDate": "",
"nextExpectReturnDate": "",
"loanedDate":"2024/4/17",
"expectReturnDate":"2024/4/26",
"leftDays": 7,
"loanWorkDays": 7,
"extendWorkDays": 10,
"expectExtendReturnDate":"2024/5/20"
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2023/11/1 12:38:11"
}
```
</br>
### ✅ itemDetailPage-loan
URL: `wss://{domain name}/`
Method: `wss`
Descirption: `物品內容頁資訊-取消借用(預約)動作`
App Screen: <a href="https://app.zeplin.io/project/65d8474dc2c129ce739d5420/screen/668bc5a893f48533a8da44eb">`zeplin前端畫面`</a>
#### Remark
```
1. 只有在借用日期前可以取消預約。
2. itemDetailPage-loan這一頁只會有「取消(delete)」的動作,因為借用的動作會在itemDatePickerPage-loan這裡執行。
```
**Request**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 資料參數 |
| itemId | int | Y | 物品id |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemDetailPage",
"module": "loan",
"type": "delete",
"data": {
"itemId":1
}
}
```
**Response for 取消成功**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | number | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | string | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | number | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容 |
| toast | string | Y | 功能資料id |
| isPositive| bool | Y | 回應訊息是否為積極行為,true:icon顏色為藍色, false:icon顏色為白色 |
```json=
{
"requestId": "1fb7d801-4a05-0b1d-ea16-de1d32c97d6c",
"status":200,
"page":"itemDetailPage",
"info": [
{
"module": "loan",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"toast": "取消成功",
"isPositive": false
}
],
"datetime": "2023/11/1 12:38:11"
},
{
"module": "loanPanel",
"status":200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":1,
"itemId": 1,
"nextCanLoanDate": "2023/12/10",
"nextExpectReturnDate": "2023/12/16",
"loanedDate":"",
"expectReturnDate":"",
"leftDays": 7,
"loanWorkDays": 7,
"extendWorkDays": 10,
"expectExtendReturnDate":""
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2023/11/1 12:38:11"
}
```
<br>
**Response for 取消失敗 (案例:當下時間已超過借用起始日)**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | number | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | string | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | number | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容 |
| toast | string | Y | 功能資料id |
| isPositive| bool | Y | 回應訊息是否為積極行為,true:icon顏色為藍色, false:icon顏色為白色 |
```json=
{
"requestId": "1fb7d801-4a05-0b1d-ea16-de1d32c97d6c",
"status":200,
"page":"itemDetailPage",
"info": [
{
"module": "loan",
"status": 1018,
"errorMsg": "物品已進入借用狀態,無法取消",
"datetime": "2024/4/17 12:38:11"
},
{
"module": "loanPanel",
"status":200,
"type": "list",
"num": 1,
"data": [
{
"loanPanelStatus":2,
"itemId": 1,
"nextCanLoanDate": "",
"nextExpectReturnDate": "",
"loanedDate":"2024/4/17",
"expectReturnDate":"2024/4/27",
"leftDays": 0,
"loanWorkDays": 7,
"extendWorkDays": 7,
"expectExtendReturnDate":""
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2023/11/1 12:38:11"
}
```
<br>
### ✅ itemDetailPage-favorite
URL: `wss://{domain name}/`
Method: `wss`
Descirption: `物品內容頁-收藏/取消收藏 動作`
App Screen: <a href="https://app.zeplin.io/project/65d8474dc2c129ce739d5420/screen/65dc5cbe0d9627c36f9d77b0">`zeplin前端畫面`</a>
#### Remark
```
收藏異動的同時,有訂閱的頁面(ex:minePage or itemPage)也需要同步資料。
```
**Request for 新增收藏動作**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 資料參數 |
| itemId | int | Y | 書籍/物品id |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemDetailPage",
"module": "favorite",
"type": "insert",
"data": {
"itemId":1
}
}
```
**Response for 新增收藏成功**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | int | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | array | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | int | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容 |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"status":200,
"page":"minePage",
"info": [
{
"module": "favoriteList",
"status": 200,
"type": "add",
"num": 1,
"data": [
{
"type":1,
"functionId":3,
"id":21,
"title":"麥克風",
"subTitle":"指向性麥克風",
"iconUrl":"/img/item/21.png"
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2024/7/2 12:38:11"
}
```
<br>
**Request for 取消收藏動作**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 資料參數 |
| itemId | int | Y | 書籍id |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemDetailPage",
"module": "favorite",
"type": "delete",
"data": {
"itemId":21
}
}
```
**Response for 取消收藏成功**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | int | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | array | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | int | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容 |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"status":200,
"page":"minePage",
"info": [
{
"module": "favoriteList",
"status": 200,
"type": "remove",
"num": 1,
"data": [
{
"type":1,
"functionId":3,
"id":21,
"title":"麥克風",
"subTitle":"指向性麥克風",
"iconUrl":"/img/item/21.png"
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2024/7/2 12:38:11"
}
```
<br>
### ✅itemDatePickerPage
URL: `wss://{domain name}/`
Method: `wss`
Descirption: `借物時間選擇頁資訊`
App Screen: <a href="https://app.zeplin.io/project/65d8474dc2c129ce739d5420/screen/65dc5cbf9bd3f285aeee078e">`zeplin前端畫面`</a>
#### Remark
```
1. 點選「我要借用」後,將會進入此畫面選擇開始與結束時間
2. 當Server端主動傳來cannotLoanDate module時,表示有人也借了此物品,App端需要刷新月曆。
刷新後若與已選範圍產生衝突,將彈跳「預約時段衝突」彈窗,關閉彈窗觸發「重選」按鈕動作。
```
**Request**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 資料參數 |
| itemId | int | Y | 物品id |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemDatePickerPage",
"module": "all",
"type": "select",
"data": {
"itemId":4,
}
}
```
**Response**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | number | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | string | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | number | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容陣列 |
**Response basicInfo module 基本資料**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| itemId | int | Y | 物品id |
| today | string | Y | 今日日期 |
| canLoanStartDate| string | Y | 可預約借用範圍起始日<br>(必須是工作日)<br><font color=red></font> |
| canLoanEndDate | string | Y | 可預約借用範圍結束日<br>(必須是工作日,開放60個<b><font color=red>工作天</font></b>內可預約,每日更新可視範圍) |
| loanMaxDays | int | Y | 該物品可借用的最大工作天數 |
| loanRule | string | Y | 借用規則文字內容 |
| returnRule | string | Y | 歸還與展延文字內容 |
**Response cannotLoanDate module 不可借用的日期**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| data | array | Y | 資料陣列 |
| holidays | array | Y | 該陣列存放假日的日期 |
| someoneLoanedDays | array | Y | 該陣列存放<br>1.該物已被他人借用的日期<br>2.第一週不可外借的日期<br>App端會在此日期上加入刪除線並無法點選。 |
#### App繪製借物預約日曆注意事項
```
App端在繪置月曆時,將取canLoanStartDate的月份第一天~canLoanEndDate的月份最後一天。
Ex: canLoanStartDate是2025/2/22,canLoanEndDate是2025/5/19,
繪製過程為:
1. 繪製月曆的起始至結束將是2025/2/1 ~ 2025/5/31
2. 排除不可被點選的日期,將其disable為灰色日期,不可被點選:
(1) 排除可預約借用範圍以外的時間:2025/2/1 ~ 2025/2/21 及 2025/5/20 ~ 2025/5/31
(2) 排除假日:API只會給canLoanStartDate ~ canLoanEndDate之間的假日日期
(3) 排除已被預約的日期:API只會給canLoanStartDate ~ canLoanEndDate之間已被借用的日期
```
```json=
{
"requestId": "1fb7d801-4a05-0b1d-ea16-de1d32c97d6c",
"status": 200,
"page": "itemDatePickerPage",
"info": [
{
"module": "basicInfo",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"itemId": 4,
"today":"2024/2/22",
"canLoanStartDate": "2025/2/24",
"canLoanEndDate": "2025/3/31",
"loanMaxDays":7,
"loanRule":"這裡顯示「借用規則」",
"returnRule":"這裡顯示「歸還與展延規則」"
}
],
"datetime": "2023/11/1 12:38:11"
},
{
"module": "cannotLoanDate",
"status": 200,
"type": "list",
"num": 2,
"data": [
{
"holidays":[
"2024/1/1",
"2024/1/6",
"2024/1/7",
"2024/1/13",
"2024/1/14",
"2024/1/20",
"2024/1/21"
]
},
{
"someoneLoanedDays":[
"2024/1/2",
"2024/1/3",
"2024/1/4",
"2024/1/5",
"2024/1/14",
"2024/1/22",
"2024/1/23"
]
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2023/11/1 12:38:11"
}
```
</br>
### ✅ itemDatePickerPage-loan
URL: `wss://{domain name}/`
Method: `wss`
Descirption: `借物時間選擇頁-借物動作`
App Screen: <a href="https://app.zeplin.io/project/65d8474dc2c129ce739d5420/screen/65dc5cab9dd409db2d94bc6e">`zeplin前端畫面`</a>
#### Remark
```
confirm視窗由App自行計算借用天數
```
**Request**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 資料參數 |
| itemId | int | Y | 物品id |
| startDate | string | Y | 借用起始日 |
| endDate | string | Y | 借用結束(歸還)日 |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemDatePickerPage",
"module": "loan",
"type": "insert",
"data": {
"itemId":4,
"startDate":"2024/1/17",
"endDate":"2024/1/25"
}
}
```
**Response**
| Parameter | Type | Require | Description |
| --------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | int | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | string | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | int | Y | [狀態代碼](#狀態代碼) |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容 |
| desc | string | Y | 動作說明文字 |
| takenDate | string | Y | 取物時間 |
| location | string | Y | 取物地點 |
| datetime | string | Y | 資料發佈時間 |
```json=
{
"requestId": "1fb7d801-4a05-0b1d-ea16-de1d32c97d6c",
"status": 200,
"page": "itemDatePickerPage",
"info": [
{
"module": "loan",
"status": 200,
"type": "list",
"num": 1,
"data": [
{
"desc": "借用成功",
"takenDate":"2024/1/23",
"location":"17F電玩社置物櫃",
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2024/1/1 12:38:11"
}
```
</br>
### ✅ itemSearchPage
URL: `wss://{domain name}/`
Method: `wss`
Descirption: `物品搜尋頁資訊`
App Screen: <a href="https://app.zeplin.io/project/65d8474dc2c129ce739d5420/screen/664d9ddc54fff2e4cff5b855">`zeplin前端畫面`</a>
#### Remark
```
1. 當App送出關鍵字後才會發出該請求
2. API將模糊比對「物品名稱」與「內容資訊」二欄位,並將物品資料回傳
3. 搜尋比對時,只針對functionId範圍進行比對。
ex:App在桌遊類(functionId=7)送出關鍵字,API就只對桌遊類資料進行比對。
4. 物品搜尋沒有「我要許願」區塊
```
**Request**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| page | string | Y | 手機畫面名稱 |
| module | string | Y | 功能區塊名稱 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| data | object | Y | 參數資料 |
| functionId | int | Y | 分類列表id(1書籍、3其他設備、5電動、6露營裝備、7桌遊、8其他)|
| keyword | string | Y | 關鍵字 |
| lastId | int | | 分頁機制:帶入目前資料的最後一筆itemId,API將回傳此itemId之後的30筆資料。<br>若不帶此參數則提供最前面的30筆資料。 |
```json=
{
"requestId": "64d94767-c926-6156-44a5-8bf08a3691d4",
"page": "itemSearchPage",
"module": "all",
"type": "select",
"data": {
"functionId": 5,
"keyword":"派對"
}
}
```
**Response**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| requestId | string | Y | 對話id |
| status | int | Y | [狀態代碼](#狀態代碼) |
| page | string | Y | 手機畫面名稱 |
| info | array | Y | 手機畫面資訊 |
| module | string | Y | 手機畫面區塊名稱 |
| status | int | Y | [狀態代碼](#狀態代碼) |
| errorMsg | string | | 錯誤訊息 |
| type | string | Y | [資料處理型態](#socket對話資料處理型態) |
| num | int | Y | 資料筆數 |
| data | array | Y | 資料內容 |
<br>
**itemList 物品列表區塊**
| Parameter | Type | Require | Description |
| ----------- | -------- | ------- | ----------- |
| itemId | int | Y | 物品id |
| title | string | Y | 品名 |
| categoryName| string | Y | 物品分類名稱 |
| isNew | bool | Y | 是否為新物品(新上架7日內為true) |
| isFavorite | bool | Y | 是否被選定為我的最愛 |
| imgUrl | string | Y | 圖片路徑 |
| star | float | Y | 星等平均(四捨五入,小數點1位,點零也要出現。ex:5.0) |
| ratingNum | int | Y | 評價總數 |
<br>
```json=
{
"requestId": "1fb7d801-4a05-0b1d-ea16-de1d32c97d6c",
"status": 200,
"page": "itemSearchPage",
"info": [
{
"module": "itemList",
"status":200,
"type": "list",
"num": 2,
"data": [
{
"itemId": 1,
"title": "印加寶藏",
"categoryName": "派對遊戲",
"isNew": true,
"isFavorite": true,
"imgUrl": "/img/item/1.png",
"star": 4.7,
"ratingNum": 99
},
{
"itemId": 2,
"title": "風聲黑名單",
"categoryName": "策略遊戲",
"isNew": true,
"isFavorite": false,
"imgUrl": "/img/item/2.png",
"star": 4.1,
"ratingNum": 199
}
],
"datetime": "2023/11/1 12:38:11"
}
],
"datetime": "2024/6/25 12:38:11"
}
```
---
<iframe src="https://hackmd.io/zqx1OcNuTKSHCI89YIHMOw?view" width="100%" height="500"></iframe>
<!--
### 狀態代碼
| status | description |
| ----- |-------------|
| 200 | Success |
| 1001 | Not found this page or module. |
| 1003 | Not found this DATA. |
| 1004 | DATA parameter error. |
| 1005 | Data processing error. |
| 1006 | 您輸入的帳號或密碼錯誤,請重新輸入 |
| 1008 | Your account has been logged in another device. |
| 1009 | Touch too fast. |
| 1010 | Unknow error. |
| 1011 | 身份驗證失敗,請重新登入 |
| 1012 | Blacklist. |
| 1013 | Not found this lastId. |
| 1014 | 已超過書籍借用2本上限 |
| 1015 | 此書籍正在借閱中,借閱失敗 |
| 1016 | 書籍有人排隊預約,展延失敗 |
| 1017 | 時段衝突,此時段已有人預約 |
| 1018 | 物品已進入借用狀態,無法取消 |
| 1030 | 已有他人在此時段預約\r請重新選擇起訖時間 |
| 1031 | 會議時段衝突\r請重新選擇循環時段 |
<br>
### socket對話資料處理型態
| type | description |
| ----- |-------------|
| select | App端請求「顯示用」資料。<br>ex:需要顯示書籍列表時。 |
| insert | App端請求「新增」動作。<br>ex:使用者按下借用按鈕時。 |
| update | App端請求「更新」動作。<br>ex:使用者更換快速入口項目時。 |
| delete | App端請求「刪除」動作。<br>ex:使用者按下取消收藏按鈕時。 |
| list | Server端請求刷新整個區塊資料,或僅告知事件已處理完成。<br>ex:需要顯示書籍列表時。 |
| add | Server端請求新增資料到區塊中。<br>ex:當後台新增了一筆通知時。 |
| modify | Server端請求更新畫面中的某筆資料。<br>ex:當後台修改了某一筆已發出通知的錯字時。 |
| remove | App端請求「刪除」動作。<br>ex:大樓消防演練通知會在演練結束後自動在App端移除消失。 |
-->