前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SpringBoot-MyBatis Spring boot + MyBatis 提供 SaaS 接口服务

SpringBoot-MyBatis Spring boot + MyBatis 提供 SaaS 接口服务

作者头像
凯哥Java
发布2019-06-28 16:32:24
9250
发布2019-06-28 16:32:24
举报
文章被收录于专栏:凯哥Java凯哥Java

Spring boot + MyBatis 提供 SaaS 接口服务

SpringBoot-MyBatis

Spring boot + MyBatis 提供 RESTful 风格 SaaS 服务

get请求不需要鉴权token,所有的post、put、delete请求均作了接口token鉴权,不过具体的鉴权逻辑没有实现,硬编码 token=123456 为鉴权通过,其余均为非法请求。

------ 接口列表 ------

一、类别相关接口

1.1、添加类别接口

代码语言:javascript
复制
http + post /category
Request body :
{
    "token": "123456",
    "name": "name",
    "introduction": "introduction",
    "preview": "preview"
}
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": null
}

1.2、删除类别接口

代码语言:javascript
复制
http + delete /category/{id}
Request body : 
{
    "token":"123456"
}
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": null
}

1.3、更新类别接口

代码语言:javascript
复制
http + put /category/{id}
Request body : 
{
    "token":"123456",
    "name": "name",
    "introduction": "introduction",
    "preview":"preview"
}
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": null
}

1.4、获取类别详情接口

代码语言:javascript
复制
http + get /category/{id}
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": {
    "id": "27837bca658b40f990b2e75768357847",
    "createTime": 1490853441000,
    "updateTime": 1490853441000,
    "name": "name",
    "introduction": "introduction1",
    "preview": "preview"
  }
}

1.5、分页获取类别列表接口

代码语言:javascript
复制
http + get /category?pageno=1&pagesize=10
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": {
    "total": 5,
    "nodes": [
      {
        "id": "27837bca658b40f990b2e75768357847",
        "createTime": 1490853441000,
        "updateTime": 1490853441000,
        "name": "哈哈",
        "introduction": "introduction",
        "preview": "preview"
      },
      {
        "id": "a7878d52932e4028a45205431f6b9032",
        "createTime": 1490854115000,
        "updateTime": 1490854115000,
        "name": "哈哈",
        "introduction": "introduction",
        "preview": "preview"
      }, ......
    ]
  }
}

二、文章相关接口

2.1、添加文章接口

代码语言:javascript
复制
http + post /article
Request body : 
{
    "token": "123456",
    "categoryId": "1838d27816b14735810ed2ee55f30ec2",
    "name": "name",
    "content": "content",
    "preview": "preview"
}
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": null
}

2.2、删除文章接口

代码语言:javascript
复制
http + delete /article/{id}
Request body : 
{
    "token":"123456"
}
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": null
}

2.3、更新文章接口

代码语言:javascript
复制
http + put /article/{id}
Request body : 
{
    "token":"123456",
    "categoryId": "categoryId",
    "name": "name",
    "content": "content",
    "preview":"preview"
}
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": null
}

2.4、获取文章详情接口

代码语言:javascript
复制
http + get /article/{id}
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": {
    "id": "fbe10f1a336d4c5fa3b098694f318086",
    "categoryId": "27837bca658b40f990b2e75768357847",
    "categoryName": "name",
    "name": "name",
    "preview": "preview",
    "content": "content",
    "viewNum": 0
  }
}

2.5、分页获取文章列表

代码语言:javascript
复制
http + get /article?pageno=1&pagesize=10
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": {
    "total": 3,
    "nodes": [
      {
        "id": "fbe10f1a336d4c5fa3b098694f318086",
        "categoryId": "27837bca658b40f990b2e75768357847",
        "categoryName": "name",
        "name": "name",
        "preview": "preview",
        "content": "content",
        "viewNum": 1
      },
      {
        "id": "d84fb1d691f3496885fb9a21caeed16e",
        "categoryId": "27837bca658b40f990b2e75768357847",
        "categoryName": "name",
        "name": "name",
        "preview": "preview",
        "content": "content",
        "viewNum": 0
      },
      {
        "id": "142fbfeb8763448d99c4b400ca1eea79",
        "categoryId": "27837bca658b40f990b2e75768357847",
        "categoryName": "name",
        "name": "name",
        "preview": "preview",
        "content": "content",
        "viewNum": 0
      }
    ]
  }
}

三、爬取其他网站接口

3.1、搜索微信公众号接口

代码语言:javascript
复制
http + get /wechat/search/{keywords}
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": [
    {
      "photo": "http://xxxxxx.jpg",
      "describe": "xxxxxx",
      "title": "xxxxxx",
      "account": "xxxxxx"
    },
    {
      "photo": "http://xxxxxx.jpg",
      "describe": "xxxxxx",
      "title": "xxxxxx",
      "account": "xxxxxx"
    }
  ]
}

3.2、获取某公众号文章列表接口

代码语言:javascript
复制
http + get /wechat/account/{account}/{pageno}
**注意事项:最后的分页(pageno)必须是12的倍数**
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": {
    "total": 3552,
    "articles": [
      {
        "createTime": "2017-02-12",
        "id": "1561973031016",
        "title": "xxxxxx"
      },
      {
        "createTime": "2017-02-11",
        "id": "1557723531913",
        "title": "xxxxxx"
      }, ......
    ]
  }
}

3.3、获取文章详细信息接口

代码语言:javascript
复制
http + get /wechat/article/{articleId}
Response data :
{
  "code": 0,
  "msg": "OK",
  "result": {
    "createTime": "2016-05-13",
    "nickName": "xxx",
    "author": "xxx",
    "name": "xxx",
    "content": "xxx"
  }
}

https://github.com/Qbian61/SpringBoot-MyBatis

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018-09-26 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • SpringBoot-MyBatis
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档