>[info] 快速導航
[TOC]
## 接口配置
在使用API之前你需要在后臺做一個簡單的API配置,如下圖:

## 接口簽名(sign)
>[info] 所有API接口調用必須要帶簽名參數sign
> 簽名規則:md5(時間戳+API簽名秘鑰)
> 時間戳格式:yyyy-MM-dd HH:mm:ss
## [list] 內容列表
>[info]接口地址:/cms/api/list
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| cid | int/var | 是 | 0 | 分類ID,cid和mid最少傳一個 |
| mid | int/var | 是 | 0 | 模型ID,cid和mid最少傳一個 |
| orderby | string | 否 | id desc | 結果排序 |
| attr | string/array | 否 | | 擴展屬性 |
| keyword | string/var | 否 | | 通過關鍵字搜索title |
| limit | int | 否 | 20 | 返回結果條數 |
| pagesize | int | 否 | 0 | 分頁大小 |
| field | string | 否 | | 設置返回的字段 |
| flag | string | 否 | | 通過推薦旗幟篩選內容 |
| tag | string | 否 | | 通過標簽篩選內容 |
| where | array | 否 | | 自定義查詢條件 |
>[danger] 如果需要自定義where條件時,請使用POST方式請求此接口。
where格式:\[\['字段名1', '表達式', '值'\], \['字段名2', '表達式', '值'\]\]
>[info] 示例代碼
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/list',
data: {
cid: 49,
pagesize: 20,
orderby: 'view desc',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'POST',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/list',
{
cid: 49,
pagesize: 20,
orderby: 'view desc',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [detail] 內容詳情
>[info]接口地址:/cms/api/detail
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| id | int | 是 | | 內容ID |
>[info] 示例代碼:
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/detail',
data: {
id: 49,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'POST',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/detail',
{
id: 49,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [category] 欄目列表
>[info]接口地址:/cms/api/category
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| cid | int/var | 是 | 0 | 分類ID,cid和mid最少傳一個 |
| mid | int/var | 是 | 2 | 模型ID,cid和mid最少傳一個 |
| level | int | 否 | 0 | 返回層級數,0為不限制 |
>[info] 示例代碼
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/category',
data: {
cid: 49,
level: 3,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'GET',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/category',
{
cid: 49,
level: 3,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [tag] 標簽
>[info]接口地址:/cms/api/tag
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| mid | int/var| 是 | | 指定模型ID |
| orderby | string | 否 | search\_count desc | 排序 |
| limit | int | 否 | 10 | 限制返回數量 |
>[info] 示例代碼
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/tag',
data: {
mid: 2,
limit: 15,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'GET',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/tag',
{
mid: 2,
limit: 15,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [block] 碎片塊
>[info]接口地址:/cms/api/block
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| name | string | 是 | | 碎片名稱 |
>[info] 示例代碼
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/block',
data: {
name: 'about',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'GET',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/block',
{
name: 'about',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [nav] 導航
>[info]接口地址:/cms/api/nav
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| group | string | 否 | | 返回指定分組 |
| limit | int | 否 | 10 | 限制返回數量 |
| cache | bool | 否 | false | 緩存結果集 |
>[info] 示例代碼
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/nav',
data: {
group: 'home',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'GET',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/nav',
{
group: 'home',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [link] 友情鏈接
>[info]接口地址:/cms/api/link
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| type | string | 是 | | 類型,可選值:image,text,all |
| group | string | 否 | | 返回指定分組 |
| orderby | string | 否 | sort asc | 排序 |
| limit | int | 否 | 10 | 限制返回數量 |
>[info] 示例代碼
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/link',
data: {
type: 'text',
group: 'home',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'GET',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/link',
{
type: 'text',
group: 'home',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [slide] 幻燈片
>[info]接口地址:/cms/api/slide
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| type | string | 否 | pc | 類型,可選值:pc,wap |
| group | string | 否 | | 返回指定分組 |
| orderby | string | 否 | sort asc | 排序 |
| limit | int | 否 | 10 | 限制返回數量 |
>[info] 示例代碼
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/slide',
data: {
type: 'wap',
group: 'home',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'GET',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/slide',
{
type: 'wap',
group: 'home',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [rec] 推薦:rec
>[info]接口地址:/cms/api/rec
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| name | string | 是 | | 調用名稱 |
>[info] 示例代碼
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/rec',
data: {
name: 'product',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'GET',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/rec',
{
name: 'product',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [type] 欄目類型
>[info]接口地址:/cms/api/type
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| tid | int | 是 | | 類型ID |
>[info] 示例代碼
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/type',
data: {
tid: 123,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'GET',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/type',
{
tid: 123,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [form] 表單
>[info]接口地址:/cms/api/form
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| name | string | 是 | | 表單名稱 |
>[info] 示例代碼
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/form',
data: {
name: 'test',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'GET',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get(
'/cms/api/form',
{
name: 'test',
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
function(res) {
console.log(res);
}, 'json');
```
## [like] 喜歡/點贊
>[info]接口地址:/cms/api/like
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| id | int | 是 | | 內容ID |
>[info] 示例代碼:
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/like',
data: {
id: 49,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'POST',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get('/cms/api/like', {
id: 49,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
}, function(res) {
console.log(res);
}, 'json');
```
## [dislike] 踩/不喜歡
>[info]接口地址:/cms/api/dislike
請求方式:GET/POST
| 屬性名 | 類型 | 必須 | 默認 | 說明
| --- | --- | --- | --- | --- |
| id | int | 是 | | 內容ID |
>[info] 示例代碼:
```
/* 微信小程序示例 */
wx.request({
url: 'https://cms.hisiphp.com/cms/api/dislike',
data: {
id: 49,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'POST',
success: function (res) {
console.log(res);
}
});
/* jquery示例 */
$.get('/cms/api/dislike', {
id: 49,
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
}, function(res) {
console.log(res);
}, 'json');
```
## [batch] 批量獲取接口數據
>[info]接口地址:/cms/api/batch
請求方式:POST
```
// 小程序請求示例
wx.request({
method: 'POST',
url: 'http://www.hisiphp.com/cms/api/batch',
data: {
// 接口名: {參數名: 參數值}
list: {cid: 1},// 請求內容列表接口
category: {cid: 0},// 請求分類接口
slide: {type: 'mini'},// 請求幻燈片接口
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
// 更多接口....
},
success:function(res) {
console.log(res)
}
});
// AJAX請求示例
$.ajax({
type: 'POST',
url: 'http://api.demo.hisiphp.com/v1/articles',
data: {
// 接口名: {參數名: 參數值}
list: {cid: 1},// 請求內容列表接口
category: {cid: 0},// 請求分類接口
slide: {type: 'mini'},// 請求幻燈片接口
timestamp: '2019-05-01 12:12:12',// 時間戳
sign: 'cddb29f7db9647274fc604531ff82cea'// 簽名
// 更多接口....
},
success: function(res) {
console.log(res)
}
});
```
>[warning] 上面示例代碼的data對象里面的key就是需要獲取的對應接口名(比如列表接口list,欄目接口category等等)
- 序言
- 環境配置
- 下載及安裝
- 目錄結構
- 系統配置
- 多語言
- 命令行(pro版)
- 自動生成模塊或插件(build)
- 生成模塊
- 生成插件
- 自動生成增刪改查(crud)
- 第一步:創建數據表
- 第二步:使用crud指令生成
- 自動生成類庫文件(make)
- 生成控制器文件(make:controller)
- 生成模型文件(make:model)
- 生成邏輯文件(make:logic)
- 生成服務文件(make:service)
- 生成驗證器文件(make:validate)
- 構建器(pro版)
- 表單構建器(form)
- 表單屬性設置
- 添加表單項
- 文本框(text)
- 隱藏域(hidden)
- 密碼框(password)
- 文本域(textarea)
- 單文件(file)
- 多文件(files)
- 單圖(image)
- 多圖(images)
- 開關(switch)
- 單選(radio)
- 多選(checkbox)
- 下拉框(select)
- 標簽(tag)
- 日期時間(datetime)
- 顏色選擇器(color)
- 富文本編輯器(editor)
- 滑塊(slider)
- 評分(rate)
- 穿梭框(transfer)
- 進度條(progress)
- 樹形(tree)
- 聯動(linkage)
- 自定義html(html)
- 分隔線(line)
- 文字(txt)
- 下拉框增強版(select+)
- 數據表格(table)
- 添加表單分組(group)
- 柵格布局(grid)
- 觸發器(trigger)
- 通用上傳方法
- 表格構建器(table)
- 表格基礎配置
- 添加表頭工具欄
- 添加表格篩選
- 頁面提示(pageTips)
- 引入 JS 文件
- 引入 CSS 文件
- 渲染額外 JS 代碼
- 渲染額外 CSS 代碼
- 模塊開發
- 1.生成模塊
- 2.創建菜單
- 3.創建控制器
- 后臺通用方法
- 插件開發
- 1.新建插件
- 2.插件配置
- 3.插件控制器
- 4.插件模板
- 5.插件鉤子
- 模板替換變量
- 公共函數庫
- 后臺通用JS方法
- 常見問題
- 官方模塊
- CMS內容管理模塊
- 目錄結構
- 模板標簽
- API接口
- 欄目頁/內容頁
- 小程序發布
- 官方插件
- 第三方登錄
- excel插件
- 萬能采集
- 采集規則
- 采集內容