PHP

php.api接口文档例子

2018-07-14  本文已影响0人  DragonRat

telechat接口文档

Date: 2018/07/05
Author: xkan

接口格式说明

url:请求url
method:请求方式
param:请求参数
return:返回结果

返回数据格式如下

[
    'status' ==> 100,
    'desc' ==> 'ok'
    'data' ==> [
        'key' ==> 'value',
        ...
    ]
]

其中 status === 100 表示请求数据成功,其他值则表示请求失败。
status 不同数字及其对应含义自定

用户操作类

登录

param

key type required
name string true
psword string true

return

##返回用户id
[JWT]{user.id}

上文表示返回一个 JSON Web Token, 载荷当中包含 user.id 字段(data信息中),具体实例如下:

{
"status":100,
"desc":"ok",
"data":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MTksImlhdCI6MTUzMTQ3MjE5MiwiZXhwIjoxNTMxNDcyMjUyfQ.pPkzyjgRqXzh7R9AYEAWFwyfWfJC9M7LP2kHMzxfIj4"
}

注册

param

key type required
name string true
psword string true
code int true

return

[JWT]{user.id}

退出登录

return

##返回需要登出用户id
[JWT]{user.id}

多用户信息

return

[
    {id, 用户名, 昵称, 头像, 个性签名, 等级, 权限, 金币, 签到天数, 禁言标志},
    {...}
] 

单用户信息

param

key type required
id int true

return

{id, 用户名, 昵称, 头像, 个性签名, 等级, 权限, 金币, 签到天数, 禁言标志}

房间类

多房间信息

return

[
    {id, 房间名, 图标, 公告, 欢迎语},
    {...}
] 

单房间信息

param

key type required
id int true

return

{id, 房间名, 图标, 公告, 欢迎语}

创建房间接口

param

key type required
pid int true
roomname string true
pic string true
announcement string true
welcome string true

return

//访问这个接口自动创建该房间数据库
{房间的id}

删除房间接口

param

key type required
id int true

return

//访问这个接口自动删除该房间数据库
{房间的id}

后台

登录

param

key type required
user string true
psword string true

return

//返回管理员id
{id}

登出

return

//返回需要登出管理员id
{id}

添加管理员

param

key type required
user string true
psword string true

return

//返回已经添加的管理员id
{id}

删除管理员

param

key type required
id int true

return

//返回已经删除的管理员id
{id}

单个管理员

param

key type required
id int true

return

//返回单个管理员信息
{id,user,status}

多个管理员

return

//多个管理员信息
{id,user,status}
...

修改管理员信息

param

key type required
newuser string true
psword string true
newpsword string true

return

//返回修改管理员id
{id}

修改管理员权限

param

key type required
id int true
newstatus string true

return

//返回修改管理员id
{id}
上一篇 下一篇

猜你喜欢

热点阅读