jncinet/qihucms-site-help

1.0.3 2020-12-29 05:48 UTC

This package is auto-updated.

Last update: 2024-04-29 04:46:51 UTC


README

$ composer require jncinet/qihucms-site-help

使用

数据迁移

$ php artisan migrate

发布资源

$ php artisan vendor:publish --provider="Qihucms\SiteHelp\SiteHelpServiceProvider"

后台菜单

  • 帮助分类:site-help/help-categories
  • 帮助内容:site-help/helps
  • 帮助回复:site-help/help-replies

接口

选择帮助文档

  • 请求方式:GET
  • 请求地址:site-help/select-helps?q=文档关键词
  • 返回值:
[
    {
        "id": 1,
        "text" "文档标题"
    },
    ...
]

帮助文档分类列表

  • 请求方式:GET
  • 请求地址:site-help/help-categories
  • 返回值:
[
    {
        'id': 1,
        'name': "分类名",
        'ico': "http://图片地址",
        'desc': "分类简介",
    },
    ...
]

帮助文档详细

  • 请求方式:GET
  • 请求地址:site-help/help-categories/{id={帮助分类ID}
  • 返回值:
{
    'id': 1,
    'name': "分类名",
    'ico': "http://图片地址",
    'desc': "分类简介",
}

帮助文档分页列表

  • 请求方式:GET
  • 请求地址:site-help/helps?id={帮助分类ID,默认为0读取所的文档}&limit={分页条数,可选}&page={页码,可选}
  • 返回值:
{
    "data": [
        {
            'id': 1,
            'category': {
                'id': 1,
                'name': "分类名",
                'ico': "http://图片地址",
                'desc': "分类简介",
            },
            'title': "标题",
            'desc': "简介",
            'thumbnail': "缩略图",
            'useful': 142, // 有用数
            'created_at': "3秒前",
            'updated_at': "1秒前",
        },
        ...
    ],
    "meta": {},
    "links": {}
}

帮助文档详细

  • 请求方式:GET
  • 请求地址:site-help/helps/{id={帮助文档ID}
  • 返回值:
{
    'id': 1,
    'category': {
        'id': 1,
        'name': "分类名",
        'ico': "http://图片地址",
        'desc': "分类简介",
    },
    'replies': [
        {
            'id': 1,
            'user': {"id": 1, "username": "name", ...},
            'content': "评论回复",
            'reply': "回复内容",
            'created_at': "1小时前",
            'updated_at': "1分钟前",
        },
        ...
    ]
    'title': "标题",
    'desc': "概述",
    'thumbnail': "缩略图地址"
    'content': "帮助文档内容"
    'useful': 112, // 有用数
    'created_at' "1小时前",
    'updated_at': "1分钟前",
}

会员回复列表

请求:GET
地址:/site-help/help-replies?page={$page}&limit={$limit}
参数:
int          $page    (选填)页码
int          $limit   (选填)每页显示的条数
返回值:
{
    "data": [
        {
            'id' => 1,
            'help' => {帮助文档详细},
            'content' => "评论回复",
            'reply' => "回复内容",
            'created_at' => "3天前"
            'updated_at' => "3天前",
        },
        ...
    ],
    "meta": {...},
    "links": {...}
}

添加回复

请求:POST
地址:/site-help/help-replies
参数:
{
    "site_help_id":1 // 文档ID
    "content":'评论内容'
}
返回值:
{
    'id' => 1,
    'user' => {会员资料},
    'content' => "评论回复",
    'reply' => "回复内容",
    'created_at' => "3天前"
    'updated_at' => "3天前",
}

更新回复

请求:PATCH|PUT
地址:/site-help/help-replies/{id}
参数:
{
    "site_help_id":1 // 内容ID
    "content":'评论内容'
}
返回值:
{
    status: 'SUCCESS',
    result: {
        id: 1
    }
}

删除回复

请求:DELETE
地址:/site-help/help-replies/{id}
返回值:
{
    status: 'SUCCESS',
    result: {
        id: 1
    }
}

数据库

帮助分类表:site_help_categories

Field Type Length AllowNull Default Comment
id bigint
name varchar 55 分类名称
desc varchar 255 Y NULL 分类介绍
ico varchar 255 Y NULL 小图标
sort int 0 分类排序
status tinyint 1 分类状态
created_at timestamp Y NULL 创建时间
updated_at timestamp Y NULL 更新时间

帮助内容表:site_helps

Field Type Length AllowNull Default Comment
id bigint
site_help_category_id bigint 所属分类
title varchar 255 标题
desc varchar 255 Y NULL 概要
thumbnail varchar 255 Y NULL 缩略图
content longtext 内容
useful int 0 有用
status tinyint 1 状态
created_at timestamp Y NULL 创建时间
updated_at timestamp Y NULL 更新时间

帮助回复表:site_help_replies

Field Type Length AllowNull Default Comment
id bigint
site_help_id bigint 所属内容
user_id bigint 发布人
content text 评论内容
reply text 回复内容
status tinyint 1 状态
created_at timestamp Y NULL 创建时间
updated_at timestamp Y NULL 更新时间