1092772959 / AppDevelopment

夏季小学期app开发
0 stars 1 forks source link

Manager Page 路由及接口 #7

Open RandnYC opened 5 years ago

RandnYC commented 5 years ago

管理员页面功能需求

  1. 更换礼品
    • 手动添加礼品图片与描述
  2. 解决工单
    • 上传文本
  3. 用户管理
    • 普通用户与会员的放权与撤权
  4. 新闻推送



路由及接口

登录

http://host/api/manager/login
{  // request post
        "userId": "account"
    "passwd": "VzEIxwQU"
}

  若登录成功后服务器请重定向页面

http://host/path/to/home.html

奖品

奖品列表

  get方式无参请求

http://host/api/manager/awards/list
[  // respond
    {
        "id": 1,
        "title": "huawei P90",
        "img": '/path/to/file',
        "desc": "Lorem ipsum dolor sit amet consectetur adipisicing elit.",
        "step": 1000    // rewards threshold
    },
    {
        "id": 2,
        "name": "rongyao v20",
        "img": '/path/to/file',
        "desc": "Lorem ipsum dolor sit amet consectetur adipisicing elit.",
        "step": 1000
    },
]

添加奖品

http://host/api/manager/awards/update
{  // request post
    "img": 'base64Code',
    "name": "huawei P90",
    "desc": 'Lorem ipsum dolor sit amet consectetur adipisicing elit.', // description
    "step": 1000,   // rewards threshold
}

删除奖品

http://host/api/manager/awards/delete
[  // request post
    {id: 1},
    {id: 2}
]

解决工单

  等前端完成..

用户列表

请求用户列表

  get方式无参请求

http://host/api/manager/users/list
[  // respond
    {
        "id": 1,
        "name": "foo",
        "type": 0,  // 0--normal; 1--member
        "step": 1000
    },
    {
        "id": 2,
        "name": "bar",
        "type": 1,
        "step": 0
    }
]

修改用户身份

http://host/api/manager/users/update
[  // request post
    {id: 1},
    {id: 2}
]

新闻推送

http://host/api/manager/news/update
{  // request
    "title": 'Untitled-1',
    "date": "2019-07-06",
    "content": 'Lorem ipsum dolor sit amet consectetur adipisicing elit.'
}
1092772959 commented 5 years ago

管理员页面功能需求

  1. 更换礼品
    • 手动添加礼品图片与描述
  2. 解决工单
    • 上传文本
  3. 用户管理
    • 普通用户与会员的放权与撤权
  4. 新闻推送
  5. 票务
    • 获取
    • 更新
    • 删除



base_url为http://localhost:8080

路由及接口

登录

http://host/api/manager/login
//method: post

//body
{  
    "userId": "account"
    "passwd": "VzEIxwQU"
}

//response
{
    "status": "success",
    "message": null,
    "data": {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxMDAxIiwiZXhwIjoxNTY0Nzk2NTAzLCJpYXQiOjE1NjQzNjQ1MDN9.ci2cJvcsZPWk8v4xksFfsiisQVdLr1lzfVEISD91UntioEMSpqwwIfSx6Rv-Y0vDXeI2seNvYupc-d9gH-D4Sw",
        "identity": null,
        "userName": null,
        "userId": "1001"
    }
}

 若登录成功后服务器请重定向页面(后端只返回状态,不重定向)

http://host/path/to/home.html           #前端重定向

奖品

奖品列表

host/api/manager/awards/list
//method: post

//headers
Authorization: “your token”

//body
userId: “管理员ID”

//response
{
    "status": "success",
    "message": null,
    "data": [
        {
            "id": 2,
            "adminId": 1,
            "title": "测试奖品",
            "cnt": 200,
            "remain": 0,
            "stepNeed": 100,
            "content": "...",
            "srcUrl": null,
            "releaseTime": "2019-07-17",
            "redeemed": null(对管理员来说没用),
            "available": null(对管理员来说没用)
        },
        {
            "id": 3,
            "adminId": 1,
            "title": "iponeX",
            "cnt": 50,
            "remain": 5,
            "stepNeed": 1000,
            "content": "...",
            "srcUrl": null,
            "releaseTime": "2019-07-16",
            "redeemed": null,
            "available": null
        }
    ]
}

添加奖品

http://host/api/manager/awards/update
//method: post

//headers
Authorization: “your token”

//body
userId: “管理员ID”
img: “图片路径”
name: “奖品名称”
desc: ”奖品文字描述”
step: “步数要求”
cnt: “数量”

//response
{
    "status": "success",
    "message": null,
    "data": "添加成功"
}

删除奖品

host/api/manager/awards/delete
//method: post

//headers
Authorization: “your token”

//body
userId: “管理员ID”
prizeId: “礼品id”

//response
{
    "status": "success",
    "message": null,
    "data": "删除成功"
}

解决工单

  等前端完成..

用户列表

请求用户列表

host/api/manager/users/list
//method: post

//headers:
Authorization: “your token”

//body
userId: “管理员ID”

//response
{
    "status": "success",
    "message": null,
    "data": [
        {
            "id": 1000,
            "num": "16124332",
            "username": "xwl",
            "type": 1,
            "device": "Mi10",
            "registTime": "2019-06-20T02:53:09.000+0000",
            "email": "",
            "todayStep": 106,
            "weekStep": 10204,
            "monthStep": 10304,
            "seasonStep": 10404,
            "totalStep": 11111,
            "iconPath": "",
            "bgPath": "mybg"
        },
        {
            "id": 1001,
            "num": "1101",
            "username": "裏",
            "type": 1,
            "device": "ipone5",
            "registTime": "2019-06-11T02:54:42.000+0000",
            "email": null,
            "todayStep": 5,
            "weekStep": null,
            "monthStep": null,
            "seasonStep": null,
            "totalStep": null,
            "iconPath": null,
            "bgPath": null
        },
    ]
}

修改用户身份

host/api/manager/users/update
//method: post

//Headers
Authorization: “your token”

//body
userId: “管理员ID”
updateId: “需要修改的用户ID”
type: “用户类型 0表非会员 1表会员”

//response
{
    "status": "success",
    "message": null,
    "data": "更新成功"
}

新闻推送

host/api/manager/news/update
//method: post

//headers:
Authorization: “your token”

//body:
userId: “管理员ID”
content: “新闻内容”
title: “新闻标题”
img: “图片路径”

//response:
{
    "status": "success",
    "message": null,
    "data": "添加成功"
}

票务

票务列表

host/api/manager/ticket/getAll
//method: post

//Headers:
Authorization: “your token”

//body:
userId: “管理员ID”

返回:
{
    "status": "success",
    "message": null,
    "data": [
        {
            "id": 3,
            "adminId": 2,
            "title": "王力宏“龙的传人2060”世界巡演杭州大莲花专场",
            "cnt": 5,
            "remain": 2,
            "content": "...",
            "releaseTime": "2019-06-22",
            "deadline": "2019-06-30",
            "iconPath": null,
            "videoPath": null,
            "reDeemed": null(对管理员无用)
        },
        {
            "id": 2,
            "adminId": 1,
            "title": "2019张杰【未·LIVE】全球巡回演唱会 重庆站",
            "cnt": 20,
            "remain": 12,
            "content": "...",
            "releaseTime": "2019-06-21",
            "deadline": "2019-06-04",
            "iconPath": null,
            "videoPath": null,
            "reDeemed": null
        }
    ]
}

添加票

host/api/manager/ticket/add
//method: post

//headers
Authorization: “your token”

//body

userId: “管理员ID”
title:”票名”
cnt: “数量”
content:”内容”
img:”图片路径”
video: “视频路径”
time: “一个数字,表示过多少天失效”

//response

{
    "status": "success",
    "message": null,
    "data": "添加成功"
}

删除票

host/api/manager/ticket/delete
//method: post

//headers
Authorization: “your token”

//body
userId: “管理员ID”
ticketId: “票ID”

//response
{
    "status": "success",
    "message": null,
    "data": "删除成功"
}