the backend of Khaos server written in golang
main -> routers -> api ( -> database ) -> api -> return
测试服务器状态
"status": "200"
获取用户数量、订单数量的统计 *注:PastOrderNumber从左到右按日期降序排序
"Usernumber": "2",
"Ordernumber": "1",
"PastOrderNumber" : [0,0,1,1,0,0,0]
获取用户列表
[
{
"id": 1,
"username": "pphui8",
"registerdate": "2022/8/30",
"phone": "19861550668",
"privilege": "manager",
},
// .....
]
获取某用户的信息
"id": 1,
"username": "pphui8",
"descript": "Ciallo~(∠・ω< )⌒★",
"registerdate": "2022/8/30",
"phone": "19861550668",
"privilege": "manager",
删除某用户
"status": "succeess"
管理员登录
"publickey": "3D75AD4DB3E952BC206E2DAFED2D91DC"
返回:
"status": "successed",
"id": 1,
"username": "pphui8",
获取商品列表
[
{
"id": 1,
"productname": "伸腿瞪眼丸",
"price": 999,
"descipt": "药到病除",
"stock": 993,
"sale": 7,
"type": "保健品",
"status": "在售",
}
// ...
]
删除某商品
"status": "succeess"
添加某商品
"productname": "伸腿瞪眼丸",
"descript": "药到病除",
"price": 997,
"img": "base64: xxxxxxx",
"stock": 999,
"sale": 7,
"type": "保健品",
"status": "在售",
预期返回
"status": "success"
获取全部订单列表
[
{
"id": 1,
"userid": 1,
"username": "pphui8",
"productid": 1,
"productname": "伸腿瞪眼丸",
"price": 999,
"number": 1,
"date": "2022/8/31",
"location": "上海",
"status": "未发货"
}
// ...
]
删除某订单
"status": "succeess"
根据用户id查找订单
[
{
"id": 1,
"userid": 1,
"username": "pphui8",
"productid": 1,
"productname": "伸腿瞪眼丸",
"price": 999,
"number": 1,
"date": "2022/8/31",
"location": "上海",
"status": "未发货"
}
// ...
]
获取公告列表
[
{
"id": 1,
"title": "关于停服维护的通知",
"content": "本站将于9月20号进行为期2天的停服维护",
"date": "2022/9/15"
"img": ""
}
// ...
]
添加一条公告
"title": "关于停服维护时间延长的通知",
"content": "由于技术原因,停服时间延长至9月24号",
"date": "2022/9/21",
"img": "" // 可为空
预期返回
"status": "success"
删除一条公告
"status":"succeess"
获取帖子列表
[
{
"id":1,
"userid":1,
"username":"pphui8",
"title":"这是一条帖子",
"content":"恭喜本站开始运营",
"browseNumber":100,
"date":"2022-09-15",
"legal":1,
"elite":1,
"img":"https://img1.imgtp.com/2022/09/22/QreqdzeV.jpg",
"tag":"公告"
}
// ...
]
获取帖子评论
[
{
"id": 1,
"userid": 1,
"username": "pphui8",
"postid": 1,
"content": "这是一条评论",
"date": "2022-09-15",
"support": 100,
"against": 0
}
// ...
]
删除一条帖子
"status": "success"
删除一条评论
"status": "success"