用户登录

HTTP Request

POST /api/admin/auth/sign_in

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述

Body Parameters

字段名 是否必填 描述

请求正文

{
    "login": "13700000001",
    "password": "123456"
}

返回数据

{
    "code": 0,
    "message": "success",
    "remark": "成功",
    "data": {
        "id": 1,
        "name": "展二",
        "phone": "13700000001",
        "auth_token": "pmd9sn8dVasSPp98wG18TBfy",
        "last_sign_in_at": "2024-04-19T10:27:46.067+08:00",
        "last_sign_in_ip": "0:0:0:0:0:0:0:1",
        "role": {
            "id": 2,
            "name": "系统管理员",
            "created_at": "2024-07-31T10:45:59.155+08:00",
            "updated_at": "2024-07-31T10:45:59.155+08:00",
            "default_role": true,
            "permissions": [
                {
                    "id": 6,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "show",
                    "name": "查看展馆"
                },
                {
                    "id": 7,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "create",
                    "name": "新增展馆"
                },
                {
                    "id": 8,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "edit",
                    "name": "编辑展馆"
                },
                {
                    "id": 9,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "up",
                    "name": "上架展馆"
                },
                {
                    "id": 10,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "down",
                    "name": "下架展馆"
                }
            ]
        },
        "temp_access_token": "b116ef108e24f9daa164756977eeaf1a71c25bc7"
    }
}

获取当前登录用户信息

HTTP Request

GET /api/admin/account

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述

Body Parameters

字段名 是否必填 描述

返回数据

{
    "code": 0,
    "message": "success",
    "remark": "成功",
    "data": {
        "id": 1,
        "name": "展二",
        "phone": "13700000001",
        "auth_token": "pmd9sn8dVasSPp98wG18TBfy",
        "last_sign_in_at": "2024-04-19T10:27:46.067+08:00",
        "last_sign_in_ip": "0:0:0:0:0:0:0:1",
        "role": {
            "id": 2,
            "name": "系统管理员",
            "created_at": "2024-07-31T10:45:59.155+08:00",
            "updated_at": "2024-07-31T10:45:59.155+08:00",
            "default_role": true,
            "permissions": [
                {
                    "id": 6,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "show",
                    "name": "查看展馆"
                },
                {
                    "id": 7,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "create",
                    "name": "新增展馆"
                },
                {
                    "id": 8,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "edit",
                    "name": "编辑展馆"
                },
                {
                    "id": 9,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "up",
                    "name": "上架展馆"
                },
                {
                    "id": 10,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "down",
                    "name": "下架展馆"
                }
            ]
        },
        "temp_access_token": "b116ef108e24f9daa164756977eeaf1a71c25bc7"
    }
}

当前登录用户修改密码

HTTP Request

PUT /api/admin/change_password

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述

Body Parameters

字段名 必填 描述
new_password 新密码
password_confirmation 确认新密码

请求正文

{
    "new_password": "123456",
    "password_confirmation": "123456"
}

返回数据

{
    "code": 0,
    "message": "success",
    "remark": "成功",
    "data": {
        "id": 1,
        "name": "展二",
        "phone": "13700000001",
        "auth_token": "pmd9sn8dVasSPp98wG18TBfy",
        "last_sign_in_at": "2024-04-19T10:27:46.067+08:00",
        "last_sign_in_ip": "0:0:0:0:0:0:0:1",
        "role": {
            "id": 2,
            "name": "系统管理员",
            "created_at": "2024-07-31T10:45:59.155+08:00",
            "updated_at": "2024-07-31T10:45:59.155+08:00",
            "default_role": true,
            "permissions": [
                {
                    "id": 6,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "show",
                    "name": "查看展馆"
                },
                {
                    "id": 7,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "create",
                    "name": "新增展馆"
                },
                {
                    "id": 8,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "edit",
                    "name": "编辑展馆"
                },
                {
                    "id": 9,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "up",
                    "name": "上架展馆"
                },
                {
                    "id": 10,
                    "subject": "hall",
                    "subject_title": "展馆管理",
                    "controller": "hall",
                    "action": "down",
                    "name": "下架展馆"
                }
            ]
        },
        "temp_access_token": "b116ef108e24f9daa164756977eeaf1a71c25bc7"
    }
}

后台账号列表

HTTP Request

GET /api/admin/accounts

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述

返回数据

{
    "code": 0,
    "message": "success",
    "remark": "成功",
    "data": {
        "total_count": 1,
        "total_pages": 1,
        "next_page": null,
        "prev_page": null,
        "current_page": 1,
        "per_page": 15,
        "page": 1,
        "models": [
            {
                "id": 1,
                "name": "展二",
                "phone": "13700000001",
                "created_at": "2024-03-28T15:26:51.595+08:00",
                "updated_at": "2024-07-31T11:00:34.691+08:00",
                "role": {
                    "id": 2,
                    "name": "系统管理员"
                }
            }
        ]
    }
}

创建后台账号

HTTP Request

POST /api/admin/accounts

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述

Body Parameters

字段名 必填 描述
admin_user 账号信息
role_id 角色ID

请求正文

{
    "admin_user": {
        "name":  "test", // 用户名
        "phone": "13800000001" // 手机号,
        "password": "123456" // 密码
    },
    "role_id": 5 // 角色
}

返回数据

{
    "code": 0,
    "message": "success",
    "remark": "成功",
    "data": {
        "id": 6,
        "name": "test",
        "phone": "13800000001",
        "created_at": "2024-08-04T00:14:41.673+08:00",
        "updated_at": "2024-08-04T00:14:41.673+08:00",
        "role": {
            "id": 5,
            "name": "test"
        }
    }
}

更新后台账号

HTTP Request

PUT /api/admin/accounts/:id

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述
id 账号ID

Body Parameters

字段名 必填 描述
admin_user 账号信息
role_id 角色ID

请求正文

{
    "admin_user": {
        "name":  "test", // 用户名
        "phone": "13800000001" // 手机号
    },
    "role_id": 5 // 角色
}

返回数据

{
    "code": 0,
    "message": "success",
    "remark": "成功",
    "data": {
        "id": 6,
        "name": "test",
        "phone": "13800000001",
        "created_at": "2024-08-04T00:14:41.673+08:00",
        "updated_at": "2024-08-04T00:14:41.673+08:00",
        "role": {
            "id": 5,
            "name": "test"
        }
    }
}

修改后台账号密码

HTTP Request

PUT /api/admin/accounts/:id/change_password

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述
id 账号ID

Body Parameters

字段名 必填 描述
new_password 新密码
password_confirmation 确认新密码

请求正文

{
    "new_password": "123456",
    "password_confirmation": "123456"
}

返回数据

{
    "code": 0,
    "message": "success",
    "remark": "成功",
    "data": {
        "id": 6,
        "name": "test",
        "phone": "13800000001",
        "created_at": "2024-08-04T00:14:41.673+08:00",
        "updated_at": "2024-08-04T00:14:41.673+08:00",
        "role": {
            "id": 5,
            "name": "test"
        }
    }
}

删除账号

HTTP Request

DELETE /api/admin/accounts/:id

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述
id 账号ID

Body Parameters

字段名 是否必填 描述

返回数据

{
    "code": 0,
    "message": "success",
    "remark": "成功"
}
文档更新时间: 2025-04-09 17:20   作者:李辉