# Scottish
[TOC]
## 共用
### 取得關鍵字搜尋結果
**Router Api Url :`/Token/create_ap_token`**
**Service Api Url : `/Token/create_ap_token`**
**Api 呼叫方式 : `POST`**
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| Section | string | * | 搜尋文字 |
**Response**
```bson
{
"Code": "1",
"Result": [
{
ID:,
Name:"",
},
...
],
}
```
### 取得分類表
**Router Api Url :`classify`**
**Service Api Url : `classify`**
**Api 呼叫方式 : `GET`**
**Response**
```bson
{
"Code": "1",
"Result": [
{
ID: <Unit.ID>,
Name: <Unit.Name>,
Item: [
{
ID: <MainClassify.ID>,
Name: "",
Item: [
{
ID: <SubClassify.ID>,
Name: "",
},
...
]
},
...
]
},
...
],
}
```
## 前台
### 取得熱門關鍵字
**Router Api Url :`front/hot/keywords`**
**Service Api Url : `front/hot/keywords`**
**Api 呼叫方式 : `GET`**
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| Count | int | * | 數量 |
**Response**
```bson
{
"Code": 1,
"Result": [
{
ID:"",
Name:"",
},
...
]
}
```
### 取得最新影音 TV
**Router Api Url :`front/newest/tv`**
**Service Api Url : `front/newest/tv`**
**Api 呼叫方式 : `GET`**
**Response**
```bson
{
"Code": 1,
"Result": "http://.."
}
```
### 取得關注話題
**Router Api Url :`front/news/top`**
**Service Api Url : `front/news/top`**
**Api 呼叫方式 : `GET`**
**Response**
```bson
{
"Code": 1,
"Result": {
Newest: [
{
ID: "",
Title: "",
},
...
],
Random: [
{
ID: "",
Title: "",
},
...
],
}
}
```
### 取得關注話題(特定頁面)
**Router Api Url :`front/news/specific`**
**Service Api Url : `front/news/specific`**
**Api 呼叫方式 : `GET`**
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| Unit | int | * | 單元流水號 |
**Response**
```bson
{
"Code": 1,
"Result": [
{
ID: "",
Title: "",
},
...
],
}
```
### 取得新聞
**Router Api Url :`front/news/list`**
**Service Api Url : `front/news/list`**
**Api 呼叫方式 : `GET`**
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| Unit | int | | 單元流水號 |
| MainClassify | int | | 主分類流水號 |
| SubClassify | int | | 子分類流水號 |
| Count | int | * | 數量 |
**Response**
```bson
{
"Code": 1,
"Result": [
{
ID:,
Title: "",
Author:"",
PublishTime:"",
Cover: {
Url:"",
Title:"",
}
},
...
]
}
```
> 流水號擇一必填
### 搜尋文章
**Router Api Url :`front/news/search`**
**Service Api Url : `front/news/search`**
**Api 呼叫方式 : `GET`**
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| Key | string | | 搜尋文字 |
| Keywords| []int | | 關鍵字 |
| Unit | int | | 單元 |
| MainClassify | int| | 主分類 |
| SubClassify | int | | 子分類 |
**Response**
```bson
{
"Code": 1,
"Result": [
{
ID:,
Title: "",
Abstract:"",
PublishTime:"",
Author: "",
Unit:,
CoverUrl: {
Url:"",
Title:""
},
Keywords: {
<ID>: <Name>
},
},
...
]
}
```
### 取得內文
**Router Api Url :`front/news`**
**Service Api Url : `front/news`**
**Api 呼叫方式 : `GET`**
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| ID | int | * | 文章流水號 |
**Response**
```bson
{
"Code": 1,
"Result": {
Title: "",
PublishTime:"",
Content:"",
Author: "",
Cover: {
Url:"",
Title:"",
},
Keywords: {
<ID>: <Name>
},
}
}
```
## 後台
### 取得新聞列表
**Router Api Url :`news/list`**
**Service Api Url : `news/list`**
**Api 呼叫方式 : `GET`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| Title | string | | 標題 |
| Unit | int | | 主單元 |
| MainClassify | int || 主分類 |
| SubClassify| int|| 次分類|
| Keywords| []int || 關鍵字(選填時,Unit 為必填) |
| Status | int | | 文章狀態
| Author| string || 作者 |
| Operator | string || 更新人員 |
| Approver | string || 審核人員 |
| StartTime | string || 更新時間開始 |
| EndTime | string || 更新時間結束 |
| Page | int | * | 頁數|
| Count| int| * | 數量|
> 文章狀態 → 1:退件 2:草稿 3:審核中 4:待發佈 5:已公開
**Response**
```bson
{
"Code": "1",
"Resutl": [
{
Title: "",
Unit: ,
MainClassify:,
SubClassify:,
Keywords: {
<ID>:<Name>,
...
},
Hits: 0,
PublishTime: "",
UpdateTime: "",
Author: "",
Operator: "",
ApproveID: 0, // 審核用的 ID
Approver: "",
Status:,
},
...
],
}
```
> 專欄: Unit 強制給予
### 取得新聞
**Router Api Url :`news`**
**Service Api Url : `news`**
**Api 呼叫方式 : `GET`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| ID | int | * | 新聞流水號 |
**Response**
```bson
{
"Code": "1",
"Result": {
Author:"",
Title:"",
Abstract:"", // 描述
Unit:0,
MainClassify:0,
SubClassify:0,
VideoUrl:"",
CoverUrl:"",
CoverDesc:"",
RssImgShow:,
Keywords: {
1: "A",
},
Content:"",
}
}
```
### 新增新聞
**Router Api Url :`news`**
**Service Api Url : `news`**
**Api 呼叫方式 : `POST`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| Author | string |* | 作者 |
| Title | string | * | 標題 |
| Abstract | string | * | 描述 |
| Unit| int | * | 單元 |
| MainClassify| int| * | 主分類 |
| SubClassify| int|| 子分類 |
| CoverUrl| string| * | 圖片位罝 |
| CoverDesc| string || 圖片描述 |
| RssImgShow| int | * | RSS 圖片顯示(1: 否 2: 是)|
| Keyword | []Any | * | 關鍵字 |
| Content| string | * | 內文 |
**Response**
```bson
{
"Code": "1",
"Result": null
}
```
> Keyword: 已建立的關鍵字給 int, 沒建立過的給 string
### 編輯新聞
**Router Api Url :`news`**
**Service Api Url : `news`**
**Api 呼叫方式 : `PUT`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| ID | int | * | 新聞流水號 |
| Author | string | | 作者 |
| Title | string | | 標題 |
| Abstract | string | | 描述 |
| Unit| int | | 單元 |
| MainClassify| int | | 主分類 |
| SubClassify| int || 子分類 |
| CoverUrl| string | | 圖片位罝 |
| CoverDesc| string || 圖片描述 |
| RssImgShow| int | | RSS 圖片顯示|
| Keyword | []int | | 關鍵字 |
| Content| string | | 內文 |
| Status | int | * | 狀態 |
**Response**
```bson
{
"Code": "1",
"Result": null
}
```
> 文章狀態 → 2:草稿 3:審核中
### 刪除新聞
**Router Api Url :`news`**
**Service Api Url : `news`**
**Api 呼叫方式 : `DELETE`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| ID | []int | * | 新聞流水號 |
**Response**
```bson
{
"Code": "1",
"Result": null
}
```
### 取得待審核數量
**Router Api Url :`underAudit`**
**Service Api Url : `underAudit`**
**Event:`UnderAuditNumber`**
**Protocol :`socket.io`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
**Response**
```bson
{
"Code": "1",
"Resutl": {
<單元 ID>: <數量>,
<單元 ID>: <數量>,
<單元 ID>: <數量>
}
}
```
### 取得新聞審核紀錄
**Router Api Url :`news/audit`**
**Service Api Url : `news/audit`**
**Api 呼叫方式 : `GET`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| ID | int | * | 新聞流水號 |
**Response**
```bson
{
"Code": "1",
"Result": [
{
Sender:"",
SendTime:"",
Approver:"",
ApproverTime: "",
Status: ,
Remark:""
},
...
],
}
```
> 紀錄本身會依建立時的 ID 排序 ASC,即第 0 筆資料為第一次審核
### 新聞審核
**Router Api Url :`news/audit`**
**Service Api Url : `news/audit`**
**Api 呼叫方式 : `PUT`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| ID | int | * | 新聞流水號 |
| Remark | string || 審核備註 |
| Status | int | * | 狀態 |
| PublishTime | string | | 公開時間 |
**Response**
```bson
{
"Code": "1",
"Result": null
}
```
### 取得審核紀錄列表
**Router Api Url :`news/audit/list`**
**Service Api Url : `news/audit/list`**
**Api 呼叫方式 : `GET`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| Title | string | | 標題 |
| Unit | int || 主單元|
| MainClassify | int || 主分類 |
| SubClassify| int|| 次分類|
| Keywords| []int || 關鍵字 |
| Status | int | | 文章狀態
| Author| string || 作者 |
| Sender| string || 送審人 |
| StartTime| string | | 更新開始時間 |
| EndTime| string | | 更新結束時間 |
| Page | int | * | 頁數|
| Count| int| * | 數量|
> 文章狀態 → 1:退件 3:審核中 4:待發佈
**Response**
```bson
{
"Code": "1",
"Resutl": [
{
Title: "",
Unit: ,
MainClassify:,
SubClassify:,
Keywords: {
<ID>:<Name>,
...
},
UpdateTime: "",
Author: "",
Sender: "",
Status:,
},
...
],
}
```
### 取得關鍵字列表
**Router Api Url :`keywords`**
**Service Api Url : `keywords`**
**Api 呼叫方式 : `GET`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| Section | string | | 關鍵字 |
**Response**
```bson
{
"Code": "1",
"Resutl": [
{
ID:,
Name:,
CountOf: {
<UnitID>: <Num>,
...
},
CreateTime:,
},
...
],
}
```
### 新增關鍵字
**Router Api Url :`keyword`**
**Service Api Url : `keyword`**
**Api 呼叫方式 : `POST`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| Name | string | * | 關鍵字 |
**Response**
```bson
{
"Code": "1",
"Resutl": null
}
```
### 編輯關鍵字
**Router Api Url :`keyword`**
**Service Api Url : `keyword`**
**Api 呼叫方式 : `PUT`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ID | int | * | 關鍵字水流號 |
| Name | string | * | 關鍵字 |
**Response**
```bson
{
"Code": "1",
"Resutl": null,
}
```
### 刪除關鍵字
**Router Api Url :`keyword`**
**Service Api Url : `keyword`**
**Api 呼叫方式 : `DELETE`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ID | int | * | 關鍵字水流號 |
**Response**
```bson
{
"Code": "1",
"Resutl": null,
}
```
### 上傳圖片
**Router Api Url :`image`**
**Service Api Url : `image`**
**Api 呼叫方式 : `POST`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| File | file | * | 檔案|
```bson
{
"Code": "1",
"Result": "https://tp-dev-tsna.s3-ap-northeast-1.amazonaws.com/article/1/1_zXuj6k.png"
}
```
> 用於處理內文中的圖片
### 刪除圖片
**Router Api Url :`image/del`**
**Service Api Url : `image/del`**
**Api 呼叫方式 : `POST`**
| Header 參數 | 格式 | 必填 |說明 |
| :--- |:---:| :---:| ---:|
| ApiToken | string | * | 授權令牌 |
| Body 參數 | 格式 | 必填 |說明 |
| :- |:-:| :-:| -:|
| Path | string | * | 圖片路徑 |
> Domain: `https://tp-dev-tsna.s3-ap-northeast-1.amazonaws.com/article/`
> Path: `1/1_zXuj6k.png`
```bson
{
"Code": "1",
"Result": null
}
```