开发手册

SoeayCMS 安装、标签使用与二次开发完整指南

API接口

SoeayCMS 提供 RESTful API 接口,支持前后端分离开发。

接口列表

接口方法说明
/api/content/listGET获取内容列表
/api/content/detailGET获取内容详情
/api/sort/listGET获取栏目列表
/api/sort/detailGET获取栏目详情
/api/searchGET搜索内容
/api/member/loginPOST会员登录
/api/member/registerPOST会员注册
/api/messagePOST提交留言
/api/commentPOST发表评论

内容列表接口

GET /api/content/list?scode=2&num=10&page=1

Response:
{
    "code": 200,
    "data": {
        "list": [
            {
                "id": 1,
                "title": "文章标题",
                "url": "/news/1.html",
                "date": "2025-01-01"
            }
        ],
        "total": 100,
        "page": 1,
        "pagesize": 10
    }
}

内容详情接口

GET /api/content/detail?id=10

Response:
{
    "code": 200,
    "data": {
        "id": 10,
        "title": "文章标题",
        "content": "<p>文章内容...</p>",
        "keywords": "关键词",
        "description": "描述",
        "visits": 123
    }
}

跨域配置

在 config/app.php 中配置允许的域名:

'cors' => [
    'allowed_origins' => [
        'http://localhost:3000',
        'https://www.soeaycms.com',
    ],
],