Giter Club home page Giter Club logo

bookshelf-backyard's Introduction

借书小程序API文档(前端非正式版)

注册

API:/register

支持格式:JSON

请求方法:POST

请求参数:

参数名称 类型 必填 说明
nickname string 用户昵称
student_id int 用户学号
openid_code string 用户的身份标识

返回参数:

参数名称 类型 说明
errorcode int 状态标识。0表示注册成功,1表示用户已存在,2表示用户不是合法成员,3表示昵称已存在,4表示未知错误

请求示例:

request

{
  "nickname":"张三",
  "studentid":1900300000,
  "openid_code":"1c054ecb0e947af1661e9f4ae63053c5",
}

response

{
  "errorcode":0/1/2/3,
}

登录(获取openid)

API:/login

请求方法:POST

支持格式:JSON

请求参数:

参数名称 类型 必填 说明
openid_code string 获取openid必备

返回参数:

参数名称 类型 说明
result bool openid是否获取成功

请求示例:

request

{
  "openid_code":"083Hu7ll2TMK874FU0ol2cPhVk1Hu7ls"
}

response

{
  "result":success/failed,
}

身份信息

API:/userinfo

支持格式:JSON

请求方法:POST

请求参数:

参数名称 类型 必填 说明
openid_code string 用户的身份标识

返回参数:

参数名称 类型 说明
result bool 身份是否是已注册用户
nickname string 用户昵称
student_id int 用户学号

请求示例:

**request

{
    "openid_code":"083Hu7ll2TMK874FU0ol2cPhVk1Hu7ls"
}

response

{
    "result":success/failed,
    "nickname":"李四",
    "student_id":"1900300000"
}

借书

API:/borrow

支持格式:JSON

请求方法:POST

请求参数:

参数名称 类型 必填 说明
bookid string 书籍的guid
openid_code string 用户的openid_code

返回参数:

参数名称 类型 说明
errorcode int 状态标识。是否产生了错误。0表示没有错误,1表示该书不存在,2表示书本已借出,3表示用户不存在,4表示未知错误

请求示例:

request

{
    "bookid":"kexie_bookshelf_00Y8uXG6d2xYFtzsEfpIT84egQMN1zHD",
    "openid_code":"083Hu7ll2TMK874FU0ol2cPhVk1Hu7ls"
}

response

{
    "errorcode":0/1/2,
}

还书

API:/remind

支持格式:JSON

请求方法:POST

请求参数:

参数名称 类型 必填 说明
bookid string 书籍的guid
openid_code string 用户的openid_code

返回参数:

参数名称 类型 说明
errorcode int 状态标识。0表示没有错误,1表示该书不存在,2表示你没有借过这本书,3表示未知错误

请求示例:

request

{
    "bookid":"1c054ecb0e947af1661e9f4ae63053c5",
    "openid_code":"083Hu7ll2TMK874FU0ol2cPhVk1Hu7ls",
}

response

{
    "errorcode":0/1/2,
}

根据guid获取书籍信息

API:/bookinfo

支持格式:JSON

请求方法:GET

请求参数

参数名称 类型 必填 说明
bookid string 书籍的guid

返回参数

参数名称 类型 必填 说明
openid_code string 用户的openid_code
bookname string 书籍名称
authors string 作者姓名
isbn string ISBN号
introduction string 书籍简介
bookid string 书籍的guid

请求示例:

request

{
	"bookid":"xxxxxxxxxxxxx"
}

response

{
    "bookid":"bookid1",
    "name":"name1",
    "author":"author1",
    "introduction":"intro1",
    "availiable_cnt":0
  }

提交书籍信息

API:/putbook

支持格式:JSON

请求方法:POST

请求参数:

参数名称 类型 必填 说明
openid_code string 用户的openid_code
bookname string 书籍名称
authors string 作者姓名
isbn string ISBN号
introduction string 书籍简介
bookid string 书籍的guid

返回参数:

参数名称 类型 说明
errorcode int 状态标识。0表示没有错误,1表示该书已存在,2表示你用户不存在,3表示未知错误

请求示例:

request

{
    "openid_code":"083Hu7ll2TMK874FU0ol2cPhVk1Hu7ls",
    "bookname":"信息论与编码",
    "authors":"曹雪虹,张宗橙",
    "isbn":"9787302440192",
    "introduction":"XXXXXXXXXXXXXXXXXXXX",
    "bookid":"kexie_bookshelf_00Y8uXG6d2xYFtzsEfpIT84egQMN1zHD",
}

response

{
    "errcode":0/1/2/3,
}

获取所有书籍信息

API:/bookshelf

支持格式:JSON

请求方法:POST

请求参数:

参数名称 类型 必填 说明
openid_code string 用户的openid_code

返回参数:

参数名称 类型 说明
result bool 总书架信息是否获取成功
book_list string(json) 书籍信息

请求示例:

request

{
   "openid_code":"083Hu7ll2TMK874FU0ol2cPhVk1Hu7ls",
}

response

{
  "result":success/failed,
  "book_list":[{
    "bookid":"bookid1",
    "name":"name1",
    "author":"author1",
    "introduction":"intro1",
    "availiable_cnt":0,
  },{
    "bookid":"bookid2",
    "name":"name2",
    "author":"author2",
    "introduction":"intro2",
    "availiable_cnt":0,
  },{
    "bookid":"bookid3",
    "name":"name3",
    "author":"author3",
    "introduction":"intro3",
    "availiable_cnt":1,
  },
  ],
}

获取用户已借书籍

API:/mybooks

支持格式:JSON

请求方法:POST

请求参数:

参数名称 类型 必填 说明
openid_code string 用户的身份标识

返回参数:

参数名称 类型 说明
result bool 个人书架信息是否获取成功
mybook_list string 我的书籍信息

请求示例:

request

{
  "openid_code":"083Hu7ll2TMK874FU0ol2cPhVk1Hu7ls"
}

response

{
  "result":success/failed,
  "mybook_list":[{
    "bookid":"bookid1",
    "name":"name1",
    "author":"author1",
    "introduction":"intro1",
  },{
    "bookid":"bookid2",
    "name":"name2",
    "author":"author2",
    "introduction":"intro2",
  },{
    "bookid":"bookid3",
    "name":"name3",
    "author":"author3",
    "introduction":"intro3",
  },]
}

请求后端签名

API:/oss-signature

支持格式:JSON

请求方法:POST

请求参数:

参数名称 类型 必填 说明
openid_code string 用户的身份标识
bookid string 书籍的guid
dir srting 图片在oss上存储的相对路径

返回参数:

参数名称 类型 说明
result bool 个人书架信息是否获取成功
accessId srting 用于标识用户
policy srting Base64编码
signature srting 签名算法获得的签名

请求示例:

request

{
  "openid_code":"083Hu7ll2TMK874FU0ol2cPhVk1Hu7ls",
  "bookid":"kexie_bookshelf_00Y8uXG6d2xYFtzsEfpIT84egQMN1zHD",
  "dir":"keixe-bookshelf",
}

response

{
  "result":success/failed,
  "accessId":"xxxxxx",
  "policy":"xxxxxx",
  "signature":"xxxxxx",
    
}

注册验证

API:/verify

支持格式:JSON

请求方法:POST

请求参数:

参数名称 类型 必填 说明
nickname string 用户的昵称
verify int 验证码

返回参数:

参数名称 类型 说明
result bool 注册是否成功

请求示例:

request

{
  "nickname":"MXBG",
  "verify":"123456",
}

response

{
  "result":success/failed,
}

bookshelf-backyard's People

Contributors

visualdust avatar wm-mxbg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.