Group 6
# 功能
1. 使用者登入頁面:
1-1 查詢歷史訂單(全部、待收貨、已完成) v
1-2 對已完成商品評價 v
1-3 查看收藏商品清單
2. 商品頁面:
2-1 選擇不同顏色,顯示不同圖片 / 顯示商品評價 v
2-2 商品評價(修改/刪除) v
2-3 收藏商品
3. 主頁面:
3-1 領取優惠券 v
3-2 排序(價格高低)
3-3 輸入金額做篩選
3-4 銷售排行
3-5 Q&A
---
# 1. 使用者登入頁面:
## 1-1 查詢歷史訂單
(1) [前端] 點FB登入,拿FB給的acess_token發POST到後端
(API網址:https://jtjin.xyz/api/1.0/user/signin)
(2) [後端] 回傳以下格式資料(這裡的acess_token是後端創造的,非FB給的):
```
{
"data": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0",
"access_expired": 3600,
"user": {
"id": 11245642,
"provider": "facebook",
"name": "Pei",
"email": "pei@appworks.tw",
"picture": "https://schoolvoyage.ga/images/123498.png"
}
}
}
```
**(3)[前端] 儲存後端給的acess_token跟user_id (全域變數 or localstorage)**
(4)[前端] 用後端給的acess_token(放header)發Get到後端
(API網址:
[Web]https://jtjin.xyz/api/1.0/user/profile
[Android]https://jtjin.xyz/api/1.0/user/profile_android)
(5)[後端] 回傳以下格式資料
shippment_progress: 0(未收貨) 1(已完成)
review_status: 0(未評價) 1(已評價)
[Web]
```
{
"data": {
"user_id": 11245642,
"user_provider": "facebook",
"user_name": "abc",
"user_email": "abc@gmail.com",
"user_picture": "https://graph.facebook.com/abc",
"user_favorite": "201807242211,201807242222",
"list": [
[
{
"total": 659,
"freight": 60,
"payment": "credit_card",
"shipping": "delivery",
"subtotal": 599,
"discount": "100"
},
{
"name": "123",
"time": "anytime",
"email": "123",
"phone": "123",
"address": "123",
"shippment_progress": 0,
"review_status": 0,
"order_number": "517390658523",
"order_time": 1592391065852
},
[
{
"id": 201807202150,
"qty": 1,
"name": "小扇紋細織上衣",
"size": "S",
"color": {
"code": "DDFFBB",
"name": "亮綠"
},
"price": 599,
"stock": 3,
"main_image": [
{
"color_code": "DDFFBB",
"main_image": "https://jtjin.xyz/assets/201807202150/main.jpg"
},
{
"color_code": "CCCCCC",
"main_image": "https://jtjin.xyz/assets/201807202150/main-2.jpg"
},
{
"color_code": "BB7744",
"main_image": "https://jtjin.xyz/assets/201807202150/main-3.jpg"
}
]
}
]
]
]
}
}
```
[Android]
```
{
"data": {
"user_id": 11245642,
"user_provider": "facebook",
"user_name": "abc",
"user_email": "abc@gmail.com",
"user_picture": "https://graph.facebook.com/abc",
"user_favorite": "201807242211,201807242222",
"list": [
{
"order": {
"total": 659,
"freight": 60,
"payment": "credit_card",
"shipping": "delivery",
"subtotal": 599,
"discount": "100"
},
"recipent": {
"name": "123",
"time": "anytime",
"email": "123",
"phone": "123",
"address": "123",
"shippment_progress": 0,
"review_status": 0,
"order_number": "517390658523",
"order_time": 1592391065852
},
"product_list": [
{
"id": 201807202150,
"qty": 1,
"name": "小扇紋細織上衣",
"size": "S",
"color": {
"code": "DDFFBB",
"name": "亮綠"
},
"price": 599,
"stock": 3,
"main_image": [
{
"color_code": "DDFFBB",
"main_image": "https://jtjin.xyz/assets/201807202150/main.jpg"
},
{
"color_code": "CCCCCC",
"main_image": "https://jtjin.xyz/assets/201807202150/main-2.jpg"
},
{
"color_code": "BB7744",
"main_image": "https://jtjin.xyz/assets/201807202150/main-3.jpg"
}
]
}
]
}
]
}
}
```
## 1-2 對已完成商品評價
(1) [前端] 用以下格式的資訊發POST到後端
(API網址:https://jtjin.xyz/api/1.0/ZongHan)
```
{
"user_id": "10042",
"product_id": ["1", "2", "201807201824"],
"comment": "Bad",
"rating": "1",
"order_number": 124235923422
}
```
(2) [後端] 回傳以下格式資料
```
{
"reviews_id": 33
}
```
## 1-3 查看收藏商品清單 (待更新)
(1) [前端] 用後端給的acess_token(放header)發Get到後端
(API網址:https://jtjin.xyz/api/1.0/user/favorite)
(2) [後端] 回傳以下格式資料
```
{
"data": {
"user_id": 11245642,
"user_provider": "facebook",
"user_name": "abc",
"user_email": "abc@gmail.com",
"user_picture": "https://graph.facebook.com/abc",
"favorite": [
{
"id": 201807242211,
"category": "men",
"title": "純色輕薄百搭襯衫",
"description": "厚薄:薄\r\n彈性:無",
"price": 799,
"texture": "棉 100%",
"wash": "手洗,溫水",
"place": "中國",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"main_image": "https://jtjin.xyz/assets/201807242211/main.jpg"
},
{
"main_image": "https://jtjin.xyz/assets/201807242211/main-2.jpg"
}
],
"images": "0.jpg,1.jpg,0.jpg,1.jpg",
"purchases": 4
},
{
"id": 201807242222,
"category": "men",
"title": "經典商務西裝",
"description": "厚薄:薄\r\n彈性:無",
"price": 3999,
"texture": "棉 100%",
"wash": "手洗,溫水",
"place": "中國",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"main_image": "https://jtjin.xyz/assets/201807242222/main.jpg"
}
],
"images": "0.jpg,1.jpg,0.jpg,1.jpg",
"purchases": 11
}
]
}
}
```
# 2. 商品頁面:
## 2-1 選擇不同顏色,顯示不同圖片 / 顯示商品評價
(1)[前端]發Get到後端
(API網址:https://jtjin.xyz/api/1.0/products/details?id=[product_id])
(2)[後端] 回傳以下格式資料
```
{
"data": {
"id": 201807201824,
"category": "women",
"title": "前開衩扭結洋裝",
"description": "厚薄:薄\r\n彈性:無",
"price": 799,
"texture": "棉 100%",
"wash": "手洗,溫水",
"place": "中國",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "FFFFFF",
"main_image": "https://jtjin.xyz/assets/201807201824/main.jpg"
},
{
"color_code": "DDFFBB",
"main_image": "https://jtjin.xyz/assets/201807201824/main-2.jpg"
},
{
"color_code": "CCCCCC",
"main_image": "https://jtjin.xyz/assets/201807201824/main-3.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201807201824/0.jpg",
"https://jtjin.xyz/assets/201807201824/1.jpg",
"https://jtjin.xyz/assets/201807201824/0.jpg",
"https://jtjin.xyz/assets/201807201824/1.jpg"
],
"purchases": 10,
"variants": [
{
"color_code": "FFFFFF",
"size": "S",
"stock": 2
},
{
"color_code": "FFFFFF",
"size": "M",
"stock": 1
},
{
"color_code": "FFFFFF",
"size": "L",
"stock": 2
},
{
"color_code": "DDFFBB",
"size": "S",
"stock": 9
},
{
"color_code": "DDFFBB",
"size": "M",
"stock": 0
},
{
"color_code": "DDFFBB",
"size": "L",
"stock": 5
},
{
"color_code": "CCCCCC",
"size": "S",
"stock": 8
},
{
"color_code": "CCCCCC",
"size": "M",
"stock": 5
},
{
"color_code": "CCCCCC",
"size": "L",
"stock": 9
}
],
"colors": [
{
"code": "FFFFFF",
"name": "白色"
},
{
"code": "DDFFBB",
"name": "亮綠"
},
{
"code": "CCCCCC",
"name": "淺灰"
}
],
"sizes": [
"S",
"M",
"L"
],
"reviews": [
{
"user_id": 10042,
"name": "林鼎棋",
"picture": "https://graph.facebook.com/3006215332763756/picture?type=large",
"comment": "Bad",
"rating": 1,
"order_number": "124235923422"
},
{
"user_id": 10042,
"name": "林鼎棋",
"picture": "https://graph.facebook.com/3006215332763756/picture?type=large",
"comment": "Bad",
"rating": 1,
"order_number": "124235923422"
},
{
"user_id": 10042,
"name": "林鼎棋",
"picture": "https://graph.facebook.com/3006215332763756/picture?type=large",
"comment": "Bad",
"rating": 1,
"order_number": "124235923422"
}
]
}
}
```
## 2-2 修改、刪除商品評價
(1) [前端] 用以下格式的資訊發POST到後端
(API網址:
[修改] https://jtjin.xyz/api/1.0/reviews/edit
[刪除] https://jtjin.xyz/api/1.0/reviews/delete)
```
{
"user_id": "10042",
"product_id": ["201807201824", "1234"],
"comment": "Bad",
"rating": "1",
"order_number": "124235923422"
}
```
(2) [後端] 回傳以下格式資料
```
{
"change_rows": 2
}
```
## 2-3 收藏商品
(1) [前端] 用以下格式的資訊發POST到後端
(API網址:
[修改] https://jtjin.xyz/api/1.0/reviews/edit
[刪除] https://jtjin.xyz/api/1.0/reviews/delete)
```
{
"user_id": "10042",
"favorite": "201807201824,1234"
}
```
(2) [後端] 回傳以下格式資料
```
{
"result": "updated"
}
```
# 3. 主頁面:
## 3-1 領取優惠券
(1) [前端] 發Get到後端
(API網址:https://jtjin.xyz/api/1.0/marketing/coupon)
(2) [後端] 回傳以下格式資料
```
{
id: 1,
title: "折抵100",
discount: "100",
discount_code: "discount100",
expired: "2020-10-20"
}
```
## 3-2 商品排序(價格高低)
(1) [前端] 發Get到後端
(API網址:https://jtjin.xyz/api/1.0/products/[category]?orderBy=[order])
category: all / men / women / accessories
order: positive(價格低到高) / negative(價格高到低)
(2) [後端] 回傳以下格式資料
```
{
"data": [
{
"id": 201807242211,
"category": "men",
"title": "純色輕薄百搭襯衫",
"description": "厚薄:薄\r\n彈性:無",
"price": 799,
"texture": "棉 100%",
"wash": "手洗,溫水",
"place": "中國",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "FFFFFF",
"main_image": "https://jtjin.xyz/assets/201807242211/main.jpg"
},
{
"color_code": "DDF0FF",
"main_image": "https://jtjin.xyz/assets/201807242211/main-2.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201807242211/0.jpg",
"https://jtjin.xyz/assets/201807242211/1.jpg",
"https://jtjin.xyz/assets/201807242211/0.jpg",
"https://jtjin.xyz/assets/201807242211/1.jpg"
],
"purchases": 4,
"variants": [
{
"color_code": "FFFFFF",
"size": "M",
"stock": 5
},
{
"color_code": "FFFFFF",
"size": "L",
"stock": 7
},
{
"color_code": "FFFFFF",
"size": "XL",
"stock": 1
},
{
"color_code": "DDF0FF",
"size": "M",
"stock": 1
},
{
"color_code": "DDF0FF",
"size": "L",
"stock": 4
},
{
"color_code": "DDF0FF",
"size": "XL",
"stock": 3
}
],
"colors": [
{
"code": "FFFFFF",
"name": "白色"
},
{
"code": "DDF0FF",
"name": "淺藍"
}
],
"sizes": [
"M",
"L",
"XL"
]
}
]
}
```
## 3-3 輸入金額做篩選
(1) [前端] 發Get到後端
(API網址:https://jtjin.xyz/api/1.0/products/[category]?lower=[lower]&upper=[upper])
category: all / men / women / accessories
lower: 最低金額
upper: 最高金額
(2) [後端] 回傳以下格式資料
```
{
"data": [
{
"id": 201807242211,
"category": "men",
"title": "純色輕薄百搭襯衫",
"description": "厚薄:薄\r\n彈性:無",
"price": 799,
"texture": "棉 100%",
"wash": "手洗,溫水",
"place": "中國",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "FFFFFF",
"main_image": "https://jtjin.xyz/assets/201807242211/main.jpg"
},
{
"color_code": "DDF0FF",
"main_image": "https://jtjin.xyz/assets/201807242211/main-2.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201807242211/0.jpg",
"https://jtjin.xyz/assets/201807242211/1.jpg",
"https://jtjin.xyz/assets/201807242211/0.jpg",
"https://jtjin.xyz/assets/201807242211/1.jpg"
],
"purchases": 4,
"variants": [
{
"color_code": "FFFFFF",
"size": "M",
"stock": 5
},
{
"color_code": "FFFFFF",
"size": "L",
"stock": 7
},
{
"color_code": "FFFFFF",
"size": "XL",
"stock": 1
},
{
"color_code": "DDF0FF",
"size": "M",
"stock": 1
},
{
"color_code": "DDF0FF",
"size": "L",
"stock": 4
},
{
"color_code": "DDF0FF",
"size": "XL",
"stock": 3
}
],
"colors": [
{
"code": "FFFFFF",
"name": "白色"
},
{
"code": "DDF0FF",
"name": "淺藍"
}
],
"sizes": [
"M",
"L",
"XL"
]
}
]
}
```
## 3-4 銷售排行
(1) [前端] 發Get到後端
(API網址:https://jtjin.xyz/api/1.0/products/order/ranking)
(2) [後端] 回傳以下格式資料
```
{
"data": [
{
"id": 201807242211,
"category": "men",
"title": "純色輕薄百搭襯衫",
"description": "厚薄:薄\r\n彈性:無",
"price": 799,
"texture": "棉 100%",
"wash": "手洗,溫水",
"place": "中國",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "FFFFFF",
"main_image": "https://jtjin.xyz/assets/201807242211/main.jpg"
},
{
"color_code": "DDF0FF",
"main_image": "https://jtjin.xyz/assets/201807242211/main-2.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201807242211/0.jpg",
"https://jtjin.xyz/assets/201807242211/1.jpg",
"https://jtjin.xyz/assets/201807242211/0.jpg",
"https://jtjin.xyz/assets/201807242211/1.jpg"
],
"purchases": 4,
"variants": [
{
"color_code": "FFFFFF",
"size": "M",
"stock": 5
},
{
"color_code": "FFFFFF",
"size": "L",
"stock": 7
},
{
"color_code": "FFFFFF",
"size": "XL",
"stock": 1
},
{
"color_code": "DDF0FF",
"size": "M",
"stock": 1
},
{
"color_code": "DDF0FF",
"size": "L",
"stock": 4
},
{
"color_code": "DDF0FF",
"size": "XL",
"stock": 3
}
],
"colors": [
{
"code": "FFFFFF",
"name": "白色"
},
{
"code": "DDF0FF",
"name": "淺藍"
}
],
"sizes": [
"M",
"L",
"XL"
]
}
]
}
```
## 3-5 Q&A (放棄)
---
profile頁面

點進待評價頁面,call API叫出購買過的商品,(一個recycle view),
商品後面要能夠評論,並且送出資料到後端那一件商品裡面的comment存入,資料中要包含coupon的資料(discount)。
待出貨、待簽收根據status欄位來決定。
detail頁面下方要將comment加入(recycle view)
開啟時跳出dialog點下去取得coupon
# ------Backend APIs------
## filter & Sorting API (Raymond)
* End Point:
`/products/all` for 全部
`/products/women` for 女裝
`/products/men` for 男裝
`/products/accessories` for 配件
`/products/search` for 搜尋
* Method: `GET`
* Query Parameters
| Field | Type | Description |
| -------- | -------- | -------- |
| paging(Optional) | String | Paging for request next page. |
| orderBy(Optional) | String | Sort for forward or Reverse. |
| upper(Optional)| String | Range for low price. |
| lower(Optional)| String | Range for high price. |
| keyword(Optional)| String | Required. |
* Success Response: 200
| Field | Type | Description |
| -------- | -------- | -------- |
| data | Array| Array of Proudct Object. |
| next_paging(Optional) | Number| Next page number. If there are no more pages, server won't return next_paging parameter. |
* Request Example:
`https://[HOST_NAME]/api/[API_VERSION]/products/all `
`https://[HOST_NAME]/api/[API_VERSION]/products/women?orderBy=negative`
`https://[HOST_NAME]/api/[API_VERSION]/products/men?orderBy=negative&lower=800 `
`https://[HOST_NAME]/api/[API_VERSION]/products/accessories?orderBy=negative&lower=800&upper=2000`
`https://[HOST_NAME]/api/[API_VERSION]/products/search?keyword=洋裝 `
`https://[HOST_NAME]/api/[API_VERSION]/products/search?keyword=洋裝&orderBy=negative`
`https://[HOST_NAME]/api/[API_VERSION]/products/search?keyword=洋裝&orderBy=negative&lower=800 `
`https://[HOST_NAME]/api/[API_VERSION]/products/search?keyword=洋裝&orderBy=negative&lower=800&upper=2000`
* Success Response Example:
```
{
"data": [
{
"id": 201902191247,
"category": "women",
"title": "經典修身長筒牛仔褲",
"description": "厚薄:薄 彈性:無",
"price": 1999,
"texture": "棉 100%",
"wash": "手洗",
"place": "越南",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "FFFFFF",
"main_image": "https://jtjin.xyz/assets/201902191247/main.jpg"
},
{
"color_code": "DDF0FF",
"main_image": "https://jtjin.xyz/assets/201902191247/main-2.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201902191247/0.jpg",
"https://jtjin.xyz/assets/201902191247/1.jpg",
"https://jtjin.xyz/assets/201902191247/0.jpg",
"https://jtjin.xyz/assets/201902191247/1.jpg"
],
"purchases": 5,
"variants": [
{
"color_code": "FFFFFF",
"size": "S",
"stock": 9
},
{
"color_code": "FFFFFF",
"size": "M",
"stock": 4
},
{
"color_code": "FFFFFF",
"size": "L",
"stock": 2
},
{
"color_code": "DDF0FF",
"size": "S",
"stock": 0
},
{
"color_code": "DDF0FF",
"size": "M",
"stock": 10
},
{
"color_code": "DDF0FF",
"size": "L",
"stock": 5
}
],
"colors": [
{
"code": "FFFFFF",
"name": "白色"
},
{
"code": "DDF0FF",
"name": "淺藍"
}
],
"sizes": ["S", "M", "L"]
},
{
"id": 201807202157,
"category": "women",
"title": "活力花紋長筒牛仔褲",
"description": "厚薄:薄 彈性:無",
"price": 1299,
"texture": "棉 100%",
"wash": "手洗,溫水",
"place": "中國",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "DDF0FF",
"main_image": "https://jtjin.xyz/assets/201807202157/main.jpg"
},
{
"color_code": "CCCCCC",
"main_image": "https://jtjin.xyz/assets/201807202157/main-2.jpg"
},
{
"color_code": "334455",
"main_image": "https://jtjin.xyz/assets/201807202157/main-3.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201807202157/0.jpg",
"https://jtjin.xyz/assets/201807202157/1.jpg",
"https://jtjin.xyz/assets/201807202157/0.jpg",
"https://jtjin.xyz/assets/201807202157/1.jpg"
],
"purchases": 6,
"variants": [
{
"color_code": "DDF0FF",
"size": "S",
"stock": 8
},
{
"color_code": "DDF0FF",
"size": "M",
"stock": 5
},
{
"color_code": "DDF0FF",
"size": "L",
"stock": 6
},
{
"color_code": "CCCCCC",
"size": "S",
"stock": 0
},
{
"color_code": "CCCCCC",
"size": "M",
"stock": 6
},
{
"color_code": "CCCCCC",
"size": "L",
"stock": 5
},
{
"color_code": "334455",
"size": "S",
"stock": 2
},
{
"color_code": "334455",
"size": "M",
"stock": 7
},
{
"color_code": "334455",
"size": "L",
"stock": 9
}
],
"colors": [
{
"code": "DDF0FF",
"name": "淺藍"
},
{
"code": "CCCCCC",
"name": "淺灰"
},
{
"code": "334455",
"name": "深藍"
}
],
"sizes": ["S", "M", "L"]
},
{
"id": 201902191210,
"category": "women",
"title": "精緻扭結洋裝",
"description": "厚薄:薄 彈性:無",
"price": 999,
"texture": "棉 100%",
"wash": "手洗",
"place": "越南",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "FFFFFF",
"main_image": "https://jtjin.xyz/assets/201902191210/main.jpg"
},
{
"color_code": "FFDDDD",
"main_image": "https://jtjin.xyz/assets/201902191210/main-2.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201902191210/0.jpg",
"https://jtjin.xyz/assets/201902191210/1.jpg",
"https://jtjin.xyz/assets/201902191210/0.jpg",
"https://jtjin.xyz/assets/201902191210/1.jpg"
],
"purchases": 16,
"variants": [
{
"color_code": "FFFFFF",
"size": "S",
"stock": 0
},
{
"color_code": "FFFFFF",
"size": "M",
"stock": 9
},
{
"color_code": "FFDDDD",
"size": "S",
"stock": 2
},
{
"color_code": "FFDDDD",
"size": "M",
"stock": 1
}
],
"colors": [
{
"code": "FFFFFF",
"name": "白色"
},
{
"code": "FFDDDD",
"name": "粉紅"
}
],
"sizes": ["S", "M"]
},
{
"id": 201902191242,
"category": "women",
"title": "透肌澎澎薄紗襯衫",
"description": "厚薄:薄 彈性:無",
"price": 999,
"texture": "棉 100%",
"wash": "手洗",
"place": "越南",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "DDFFBB",
"main_image": "https://jtjin.xyz/assets/201902191242/main.jpg"
},
{
"color_code": "DDF0FF",
"main_image": "https://jtjin.xyz/assets/201902191242/main-2.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201902191242/0.jpg",
"https://jtjin.xyz/assets/201902191242/1.jpg",
"https://jtjin.xyz/assets/201902191242/0.jpg",
"https://jtjin.xyz/assets/201902191242/1.jpg"
],
"purchases": 15,
"variants": [
{
"color_code": "DDFFBB",
"size": "M",
"stock": 3
},
{
"color_code": "DDFFBB",
"size": "L",
"stock": 9
},
{
"color_code": "DDF0FF",
"size": "M",
"stock": 2
},
{
"color_code": "DDF0FF",
"size": "L",
"stock": 6
}
],
"colors": [
{
"code": "DDFFBB",
"name": "亮綠"
},
{
"code": "DDF0FF",
"name": "淺藍"
}
],
"sizes": ["M", "L"]
},
{
"id": 201902191245,
"category": "women",
"title": "小扇紋質感上衣",
"description": "厚薄:薄 彈性:無",
"price": 999,
"texture": "棉 100%",
"wash": "手洗",
"place": "越南",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "FFFFFF",
"main_image": "https://jtjin.xyz/assets/201902191245/main.jpg"
},
{
"color_code": "CCCCCC",
"main_image": "https://jtjin.xyz/assets/201902191245/main-2.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201902191245/0.jpg",
"https://jtjin.xyz/assets/201902191245/1.jpg",
"https://jtjin.xyz/assets/201902191245/0.jpg",
"https://jtjin.xyz/assets/201902191245/1.jpg"
],
"purchases": 0,
"variants": [
{
"color_code": "FFFFFF",
"size": "M",
"stock": 2
},
{
"color_code": "FFFFFF",
"size": "L",
"stock": 6
},
{
"color_code": "CCCCCC",
"size": "M",
"stock": 5
},
{
"color_code": "CCCCCC",
"size": "L",
"stock": 8
}
],
"colors": [
{
"code": "FFFFFF",
"name": "白色"
},
{
"code": "CCCCCC",
"name": "淺灰"
}
],
"sizes": ["M", "L"]
}
],
"next_paging": 1
}
```
* Client Error Response: 400
| Field | Type | Description |
| -------- | -------- | -------- |
| error | String | Error message. |
* Server Error Response: 500
| Field | Type | Description |
| -------- | -------- | -------- |
| error | String | Error message. |
## Ranking API (Raymond)
* End Point: `/order/ranking`
* Method: `GET`
* Success Response: 200
| Field | Type | Description |
| -------- | -------- | -------- |
| data | Ranking Object| Ranking info. |
* Success Response Example:
```
{
"data": [
{
"id": 201807242234,
"category": "accessories",
"title": "柔軟氣質羊毛圍巾",
"description": "厚薄:薄 彈性:無",
"price": 1799,
"texture": "棉 100%",
"wash": "手洗,溫水",
"place": "中國",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "FFFFFF",
"main_image": "https://jtjin.xyz/assets/201807242234/main.jpg"
},
{
"color_code": "DDF0FF",
"main_image": "https://jtjin.xyz/assets/201807242234/main-2.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201807242234/0.jpg",
"https://jtjin.xyz/assets/201807242234/1.jpg",
"https://jtjin.xyz/assets/201807242234/0.jpg",
"https://jtjin.xyz/assets/201807242234/1.jpg"
],
"purchases": 20,
"variants": [
{
"color_code": "FFFFFF",
"size": "F",
"stock": 4
},
{
"color_code": "DDF0FF",
"size": "F",
"stock": 7
}
],
"colors": [
{
"code": "FFFFFF",
"name": "白色"
},
{
"code": "DDF0FF",
"name": "淺藍"
}
],
"sizes": ["F"]
},
{
"id": 201902191210,
"category": "women",
"title": "精緻扭結洋裝",
"description": "厚薄:薄 彈性:無",
"price": 999,
"texture": "棉 100%",
"wash": "手洗",
"place": "越南",
"note": "實品顏色依單品照為主",
"story": "O.N.S is all about options, which is why we took our staple polo shirt and upgraded it with slubby linen jersey, making it even lighter for those who prefer their summer style extra-breezy.",
"main_image": [
{
"color_code": "FFFFFF",
"main_image": "https://jtjin.xyz/assets/201902191210/main.jpg"
},
{
"color_code": "FFDDDD",
"main_image": "https://jtjin.xyz/assets/201902191210/main-2.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/201902191210/0.jpg",
"https://jtjin.xyz/assets/201902191210/1.jpg",
"https://jtjin.xyz/assets/201902191210/0.jpg",
"https://jtjin.xyz/assets/201902191210/1.jpg"
],
"purchases": 16,
"variants": [
{
"color_code": "FFFFFF",
"size": "S",
"stock": 0
},
{
"color_code": "FFFFFF",
"size": "M",
"stock": 9
},
{
"color_code": "FFDDDD",
"size": "S",
"stock": 2
},
{
"color_code": "FFDDDD",
"size": "M",
"stock": 1
}
],
"colors": [
{
"code": "FFFFFF",
"name": "白色"
},
{
"code": "FFDDDD",
"name": "粉紅"
}
],
"sizes": ["S", "M"]
}
]
}
```
* Client Error Response: 400
| Field | Type | Description |
| -------- | -------- | -------- |
| error | String | Error message. |
* Server Error Response: 500
| Field | Type | Description |
| -------- | -------- | -------- |
| error | String | Error message. |
## Profile API (Raymond)
* End Point: `/user/profile`
* Method: `GET`
* Request Headers:
| Field | Type | Description |
| -------- | -------- | -------- |
| Authorization | String | Access token preceding `Bearer` . For example: `Bearer x48aDD534da8ADSD1XC4SD5S` |
* Success Response: 200
| Field | Type | Description |
| -------- | -------- | -------- |
| data | User Object| User info. |
* Success Response Example:
```
{
"data": {
"user_id": 11245642,
"user_provider": "facebook",
"user_name": "Raymond",
"user_email": "Raymond@appworks.tw",
"user_picture": "https://schoolvoyage.ga/images/123498.png",
"list": [
[
{
"total": 5856,
"freight": 60,
"payment": "credit_card",
"shipping": "delivery",
"subtotal": 5796,
"discount": 50,
"recipient": 12
},
{
"name": "Raymond",
"time": "anytime",
"email": "Raymond@gmail.com",
"phone": "0912345678",
"address": "Raymond home",
"shippment_progress": 0,
"order_number": "123456789",
"order_time": 0
},
[
{
"id": 201807202140,
"qty": 3,
"name": "透肌澎澎防曬襯衫",
"size": "S",
"color":
{
"code": "DDFFBB",
"name": "亮綠"
},
"price": 599,
"stock": 7,
"main_image": "http://localhost:3000/assets/201807202140/main.jpg"
},
{
"id": 201807242222,
"qty": 1,
"name": "經典商務西裝",
"size": "XL",
"color":
{
"code": "334455",
"name": "深藍"
},
"price": 3999,
"stock": 9,
"main_image": "http://localhost:3000/assets/201807242222/main.jpg"
}
]
],
[
{
"total": 5856,
"freight": 60,
"payment": "credit_card",
"shipping": "delivery",
"subtotal": 5796,
"discount": 50,
"recipient": 12
},
{
"name": "Raymond",
"time": "anytime",
"email": "Raymond@gmail.com",
"phone": "0912345678",
"address": "Raymond home",
"shippment_progress": 0,
"order_number": "123456789",
"order_time": 0
},
[
{
"id": 201807202140,
"qty": 3,
"name": "透肌澎澎防曬襯衫",
"size": "S",
"color":
{
"code": "DDFFBB",
"name": "亮綠"
},
"price": 599,
"stock": 7,
"main_image": "http://localhost:3000/assets/201807202140/main.jpg"
},
{
"id": 201807242222,
"qty": 1,
"name": "經典商務西裝",
"size": "XL",
"color":
{
"code": "334455",
"name": "深藍"
},
"price": 3999,
"stock": 9,
"main_image": "http://localhost:3000/assets/201807242222/main.jpg"
}
]
]
]
}
}
```
* Invalid Access Token: 403
| Field | Type | Description |
| -------- | -------- | -------- |
| error | String | Error message. |
* Client Error Response: 400
| Field | Type | Description |
| -------- | -------- | -------- |
| error | String | Error message. |
* Server Error Response: 500
| Field | Type | Description |
| -------- | -------- | -------- |
| error | String | Error message. |
## Product Details API (建廷)
#### (評價、main_image顏色)
1. 新增reviews table
| id | comment | rating |product_id | user_id |
| ------ | ------- | ------ | --------- | --------- |
| int PK | varchar | int | bigint FK | bigint FK |
2. 修改admin/product.html (Create product page)
* End Point:/products/details
* Method: GET
* Query Parameters
* Request Example:
`https://[HOST_NAME]/api/[API_VERSION]/products/details?id=2`
* Success Response Example:
```
{
"data": {
"id": "1234",
"title": "外套",
"description": "厚薄:薄 彈性:無",
"price": 1999,
"texture": "棉 100%",
"wash": "手洗,水溫",
"place": "韓國",
"note": "實品顏色以單品照為主",
"story": "你絕對不能錯過的超值商品",
"colors": [
{
"code":"DDFFBB",
"name":"亮綠"
},
{
"code":"334455",
"name":"深藍"
}
],
"sizes": ["S", "M", "L"],
"variants":[
{
"color_code":"DDFFBB",
"size":"S",
"stock":5
},
{
"color_code":"DDFFBB",
"size":"M",
"stock":10
},
{
"color_code":"DDFFBB",
"size":"L",
"stock":0
},
{
"color_code":"334455",
"size":"S",
"stock":5
},
{
"color_code":"334455",
"size":"M",
"stock":10
},
{
"color_code":"334455",
"size":"L",
"stock":0
}
],
"main_image": [
{
"color_code":"DDFFBB",
"main_image":"https://jtjin.xyz/assets/1234/main_1.jpg"
},
{
"color_code":"334455",
"main_image":"https://jtjin.xyz/assets/1234/main_2.jpg"
}
],
"images": [
"https://jtjin.xyz/assets/1234/0.jpg",
"https://jtjin.xyz/assets/1234/1.jpg"
],
"reviews": [
{
"id":"10042",
"name":"John",
"picture":"https://d2hv8i2cf75388.cloudfront.net/doge-wallpaper-3.jpeg",
"rating": 5,
"comment":"Very good!"
},
{
"id":"10043",
"name":"Arthur",
"picture":"https://graph.facebook.com/3006215332763756/picture?type=large",
"rating": 1,
"comment":"Sucks!!"
}
]
}
}
```
## Coupon (Tanya)
#### API
* End Point: `/marketing/coupon`
* Method: `GET`
* Request Example:
`https://[HOST_NAME]/api/[API_VERSION]/marketing/coupon`
`https://jtjin.xyz/api/1.0/marketing/coupon`
* Success Response Example:
```
{
"id": 3,
"title": "免運",
"discount": "60",
"discount_code": "discount60",
"expired": "2020-06-15"
}
```
* End Point: `/checkout`
* Method: `POST`
* Request Example:
`https://[HOST_NAME]/api/[API_VERSION]/order/checkout`
`https://jtjin.xyz/api/1.0/order/checkout`
* Request Body Example:
```
{
"prime": "ccc1491581661f700bcc1cafec673c741f0665ca77550fe828ef38ee1437a2b8",
"order": {
"shipping": "delivery",
"payment": "credit_card",
"subtotal": 1299,
"freight": 60,
"discount": 100,
"total": 1259,
"recipient": {
"name": "Luke",
"phone": "0987654321",
"email": "luke@gmail.com",
"address": "市政府站",
"time": "morning"
},
"list": [
{
"id": "201807202157",
"name": "活力花紋長筒牛仔褲",
"price": 1299,
"color": {
"code": "DDF0FF",
"name": "淺藍"
},
"size": "M",
"qty": 1
}
]
}
}
```
* End Point: `/marketing/checkCoupon`
* Method: `POST`
* Request Example:
`https://[HOST_NAME]/api/[API_VERSION]/marketing/checkCoupon`
`https://jtjin.xyz/api/1.0/marketing/checkCoupon`
* Request Body Example:
```
{
"discount_code" : "discount60"
}
```
* Success Response Example:
```
{
"status": "Expired"
}
或
{
"status": "OK"
}
```
* Client Error Response: 400
| Field | Type | Description |
| -------- | -------- | -------- |
| error | String | Error message. |
* Server Error Response: 500
| Field | Type | Description |
| -------- | -------- | -------- |
| error | String | Error message. |
#### 新增 Coupon Table
| id | title | discount | discount_number | expired |
| -------- | -------- | -------- | -------- | -------- |
| Bigint(20)/Primary key| Vachar(100) | Vachar(50) | Vachar(100) | Vachar(50) |
#### 後台新增coupon功能
https://jtjin.xyz/admin/coupon.html
## Favorite (Tanya)
#### API
* End Point: `/favorite`
* Method: `GET`
* Request Example:
`https://[HOST_NAME]/api/[API_VERSION]/user/favorite`
`https://jtjin.xyz/api/1.0/user/favorite`
* Request Headers:
| Field | Type | Description |
| -------- | -------- | -------- |
| Authorization | String | Access token |
* Success Response Example:
```
{
"favorite": [
"201807242211",
"201807242222"
]
}
或
{
"favorite": "No items"
}
```
#### 修改 User Table 新增 favorite
| id | provider | email | password | name | picture | access_token | access_expired | login_at | favorite |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Bigint(20)/Primary key| Vachar(15) | Vachar(255) | Vachar(255) | Vachar(127) | Vachar(255) | Vachar(255) | Bigint(20) | Timestamp | Vachar(500) |