Skip to content
Spotify - 每月低于 10 元

互助圈

数据字典

用户表

字段名数据类型默认值必须唯一备注
usernameStringTrueTrue
passwordStringTrue
emailStringTrue
phoneStringTrue
addressString''
balanceNumber0
roleNumber00为普通用户,1为管理员
avatarString图片url

任务表

字段名数据类型默认值必须唯一备注
titleStringTrue
priceNumberTrue
contentStringTrue
imgsArray
setterObjectIdTrue
getterObjectId
statusNumber00为未接受,1为已接受,2为已完成

商品表

字段名数据类型默认值必须唯一备注
nameStringTrue
priceNumberTrue
stockNumberTrue
imgStringTrue

订单表

字段名数据类型默认值必须唯一备注
goodStringTrue
priceNumberTrue
imgStringTrue
addressStringTrue
expressString
userObjectIdTrue
statusNumber00为未发货,1为已发货,2为已完成

工单表

字段名数据类型默认值必须唯一备注
userObjectIdTrue
adminObjectId
questionStringTrue
answerString

聊天表

字段名数据类型默认值必须唯一备注
senderObjectIdTrue
receiverObjectIdTrue
contentStringTrue
deleteBooleanfalse

用户接口

用户列表

  • Path: /api/user

  • Method: GET

  • Description: 查询所有用户

  • Return

json
{
  "data": [
    {
      "_id": "62d69b9db0357668735fe9f5",
      "username": "admin",
      "password": "a8fafeab06db8996201cd578b21f9ea9",
      "email": "123@qq.com",
      "phone": "18063526374",
      "address": "",
      "balance": 38,
      "role": 1,
      "avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
      "createdAt": "2022-07-19T11:55:09.450Z",
      "updatedAt": "2022-07-19T12:06:10.469Z",
      "__v": 0
    }
  ],
  "errno": 0
}

登录

  • Path: /api/user/login

  • Method: POST

  • Description: 用户登录接口

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
usernameStringTrue用户名
passwordStringTrue密码
  • Return
json
{
  "data": {
    "_id": "62d69b9db0357668735fe9f5",
    "username": "admin",
    "password": "a8fafeab06db8996201cd578b21f9ea9",
    "email": "123@qq.com",
    "phone": "18063526374",
    "address": "",
    "balance": 38,
    "role": 1,
    "avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
    "createdAt": "2022-07-19T11:55:09.450Z",
    "updatedAt": "2022-07-19T12:06:10.469Z",
    "__v": 0,
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2MmQ2OWI5ZGIwMzU3NjY4NzM1ZmU5ZjUiLCJpYXQiOjE2NTgyMzUwMjYsImV4cCI6MTY1ODI3ODIyNn0._JyUpJyIvFfIUL282Wc-k_CcGLO4aIxb8tNnaPDfyj0"
  },
  "errno": 0
}

注册

  • Path: /api/user/register

  • Method: POST

  • Description: 用户注册接口

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
usernameStringTrue用户名
phoneStringTrue手机号
emailStringTrue邮箱
passwordStringTrue密码
codeStringTrue验证码
  • Return
json
{
  "msg": "注册成功",
  "errno": 0
}

发送验证码

  • Path: /api/user/code

  • Method: POST

  • Description: 用户注册接口

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
emailStringTrue邮箱
  • Return
json
{
  "msg": "发送成功",
  "errno": 0
}

用户详情

  • Path: /api/user/detail

  • Method: GET

  • Description: 获取单个用户详情

  • Query

参数名类型是否必须默认值备注
_idStringFalse登录用户ID用户ID
  • Return
json
{
  "data": {
    "_id": "62d69b9db0357668735fe9f5",
    "username": "admin",
    "password": "a8fafeab06db8996201cd578b21f9ea9",
    "email": "123@qq.com",
    "phone": "18063526374",
    "address": "",
    "balance": 38,
    "role": 1,
    "avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
    "createdAt": "2022-07-19T11:55:09.450Z",
    "updatedAt": "2022-07-19T12:06:10.469Z",
    "__v": 0
  },
  "errno": 0
}

修改密码

  • Path: /api/user/password

  • Method: POST

  • Description: 修改用户密码

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
oldPasswordStringTrue原密码
passwordStringTrue新密码
  • Return
json
{
  "msg": "修改成功",
  "errno": 0
}

忘记密码

  • Path: /api/user/forget

  • Method: POST

  • Description: 通过邮箱重置密码,新密码发送至邮箱

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
emailStringTrue邮箱
  • Return
json
{
  "msg": "新密码已发送至邮箱!",
  "errno": 0
}

编辑信息

  • Path: /api/user/edit

  • Method: POST

  • Description: 修改用户信息

  • Headers

参数名
Content-Typemultipart/form-data
  • Body
参数名类型是否必须默认值备注
_idStringFalse登录用户ID
usernameStringFalse
phoneStringFalse
emailStringFalse
addressStringFalse
avatarFileFileFalse
balanceNumberFalse
roleNumberFalse
passwordStringFalse
  • Return
json
{
  "msg": "修改成功",
  "errno": 0
}

删除用户

  • Path: /api/user/delete

  • Method: POST

  • Description: 通过ID删除用户

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
_idStringTrue
  • Return
json
{
  "msg": "删除成功",
  "errno": 0
}

任务接口

任务列表

  • Path: /api/task

  • Method: GET

  • Description: 查询所有任务

  • Query

参数名类型是否必须默认值备注
pageNumberFalse页码
pageSizeNumberFalse每页任务数
typeStringFalsepublish为发布列表,accept为接受列表,不填为全部任务
  • Return
json
{
  "data": {
    "total": 12,
    "list": [
      {
        "_id": "629d84fb3ef6e16c0c308bd2",
        "title": "任务2",
        "price": 15,
        "content": "任务2",
        "imgs": [ "/images/upload_f2c2f634e936423e0d2551ed0d310bbe.jpg" ],
        "setter": "admin",
        "getter": "user",
        "status": 2,
        "createdAt": "2022-06-06T04:39:23.021Z",
        "updatedAt": "2022-06-06T12:47:33.774Z",
        "__v": 0,
      }
    ]
  },
  "errno": 0
}

搜索任务

  • Path: /api/search

  • Method: GET

  • Description: 通过关键字搜索任务

  • Headers

  • Query

参数名类型是否必须默认值备注
keywordStringFalse查询关键字
  • Return
json
同任务列表

任务详情

  • Path: /api/task/detail

  • Method: GET

  • Description: 查询任务详情

  • Query

参数名类型是否必须默认值备注
_idStringTrue任务ID
  • Return
json
{
  "data": {
    "_id": "62d8ad96a7e3b68eb071ca9e",
    "title": "任务1",
    "price": 1,
    "content": "任务1",
    "imgs": [],
    "setter": {
      "_id": "629d847e3ef6e16c0c308b9c",
      "username": "admin"
    },
    "status": 0,
    "createdAt": "2022-07-21T01:36:22.371Z",
    "updatedAt": "2022-07-21T01:36:22.371Z",
    "__v": 0
  },
  "errno": 0
}

发布任务

  • Path: /api/task/create

  • Method: POST

  • Description: 发布任务

  • Headers

参数名
Content-Typemultipart/form-data
  • Body
参数名类型是否必须默认值备注
titleStringTrue任务标题
priceStringTrue任务价格
contentStringTrue任务介绍
imgFilesFileFalse图片列表
  • Return
json
{
  "data": {
    "title": "任务任务任务",
    "price": 1,
    "content": "任务任务任务",
    "imgs": [],
    "setter": "62d69b9db0357668735fe9f5",
    "status": 0,
    "_id": "62d8bb81b1e18dce8342124c",
    "createdAt": "2022-07-21T02:35:45.318Z",
    "updatedAt": "2022-07-21T02:35:45.318Z",
    "__v": 0
  },
  "errno": 0
}

编辑任务

  • Path: /api/task/edit

  • Method: POST

  • Description: 编辑任务

  • Headers

参数名是否必须
Content-Typemultipart/form-data
  • Body
参数名类型是否必须默认值备注
_idStringTrie任务ID
titleStringTrue任务标题
priceStringTrue任务价格
contentStringTrue任务介绍
imgFilesFileFalse图片列表
statusNumberFalse任务状态
  • Return
json
同上

删除任务

  • Path: /api/task/delete

  • Method: POST

  • Description: 删除任务

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
_idStringTrue任务ID
  • Return
json
{
  "msg": "删除成功",
  "errno": 0
}

接受任务

  • Path: /api/task/accept

  • Method: POST

  • Description: 接受任务

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
_idStringTrue任务ID
  • Return
json
{
  "msg": "接受成功",
  "errno": 0
}

放弃任务

  • Path: /api/task/giveup

  • Method: POST

  • Description: 放弃任务

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
_idStringTrue任务ID
  • Return
json
{
  "msg": "放弃成功",
  "errno": 0
}

完成任务

  • Path: /api/task/finish

  • Method: POST

  • Description: 完成任务

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
_idStringTrue任务ID
  • Return
json
{
  "msg": "任务完成",
  "errno": 0
}

商城接口

商品列表

  • Path: /api/store

  • Method: GET

  • Description: 查询所有商品

  • Return

json
{
  "data": [
    {
      "_id": "62d8aff6b1e18dce83421204",
      "name": "耳机",
      "price": 1,
      "stock": 0,
      "img": "http://localhost:8000/images/upload_d67246570c451fdce562b8fb9a527a7c.png",
      "createdAt": "2022-07-21T01:46:30.830Z",
      "updatedAt": "2022-07-21T01:46:30.830Z",
      "__v": 0
    }
  ],
  "errno": 0
}

商品详情

  • Path: /api/store/detail

  • Method: GET

  • Description: 查询单个商品详情

  • Query

参数名类型是否必须默认值备注
_idStringTrue商品ID
  • Return
json
{
  "data": {
    "_id": "62d8aff6b1e18dce83421204",
    "name": "耳机",
    "price": 1,
    "stock": 0,
    "img": "http://localhost:8000/images/upload_d67246570c451fdce562b8fb9a527a7c.png",
    "createdAt": "2022-07-21T01:46:30.830Z",
    "updatedAt": "2022-07-21T01:46:30.830Z",
    "__v": 0
  },
  "errno": 0
}

添加商品

  • Path: /api/store/create

  • Method: POST

  • Description: 添加商品信息

  • Headers

参数名
Content-Typemultipart/form-data
  • Body
参数名类型是否必须默认值备注
nameStringTrue商品名
priceNumberTrue价格
stockNumberTrue库存
imgFileFileTrue图片
  • Return
json
{
  "msg": "添加成功",
  "errno": 0
}

编辑商品

  • Path: /api/store/edit

  • Method: POST

  • Description: 编辑商品信息

  • Headers

参数名
Content-Typemultipart/form-data
  • Body
参数名类型是否必须默认值备注
_idStringTrue商品ID
nameStringTrue商品名
priceNumberTrue价格
stockNumberTrue库存
imgFileFileFalse图片
  • Return
json
{
  "msg": "修改成功",
  "errno": 0
}

删除商品

  • Path: /api/store/delete

  • Method: POST

  • Description: 删除单个商品

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
_idStringTrue商品ID
  • Return
json
{
  "msg": "删除成功",
  "errno": 0
}

兑换商品

  • Path: /api/store/exchange

  • Method: POST

  • Description: 兑换商品

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
_idStringTrue商品ID
  • Return
json
{
  "msg": "兑换成功",
  "errno": 0
}

余额查询

  • Path: /api/store/balance

  • Method: GET

  • Description: 查询用户余额

  • Return

json
{
  "data": {
    "balance": 36
  },
  "errno": 0
}

余额充值

  • Path: /api/store/recharge

  • Method: POST

  • Description: 余额充值

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
amountNumberTrue充值金额
  • Return
json
{
  "data": {
    "balance": 46
  },
  "errno": 0
}

订单接口

订单列表

  • Path: /api/order

  • Method: GET

  • Description: 查询所有订单

  • Query

参数名类型是否必须默认值备注
typeStringFalseall为全部订单,不填为当前用户订单
  • Return

    json
    {
      "data": [
        {
          "_id": "63a7d315c5d440b40fd9e34e",
          "good": "手机",
          "price": "30",
          "img": "http://localhost:8000/images/upload_ec09a6865d2bc0d034da787adc2b33ed.jpg",
          "address": "浙江",
          "user": "admin",
          "status": 1,
          "createdAt": "2022-12-25T04:35:33.249Z",
          "updatedAt": "2023-03-10T10:47:53.464Z",
          "__v": 0,
          "express": "123"
        }
      ],
      "errno": 0
    }

订单详情

  • Path: /api/order/detail
  • Method: GET
  • Description: 查询单个订单详情
  • Query
参数名类型是否必须默认值备注
_idStringTrue订单ID
  • Return

    json
    {
      "data": {
        "_id": "63a7d315c5d440b40fd9e34e",
        "good": "手机",
        "price": "30",
        "img": "/images/upload_ec09a6865d2bc0d034da787adc2b33ed.jpg",
        "address": "浙江",
        "user": "admin",
        "status": 1,
        "createdAt": "2022-12-25T04:35:33.249Z",
        "updatedAt": "2023-03-10T10:47:53.464Z",
        "__v": 0,
        "express": "123"
      },
      "errno": 0
    }

编辑订单

  • Path: /api/order/edit

  • Method: POST

  • Description: 编辑订单收货地址、填写快递单号

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
addressStringTrue收货地址
expressStringFalse快递单号
  • Return
json
{
  "msg": "编辑成功",
  "errno": 0
}

完成订单

  • Path: /api/order/finish

  • Method: POST

  • Description: 订单确认收货

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
_idStringTrue订单ID
  • Return
json
{
  "msg": "确认收货成功",
  "errno": 0
}

工单接口

工单列表

  • Path: /api/ticket

  • Method: GET

  • Description: 查询所有工单

  • Query

参数名类型是否必须默认值备注
typeStringFalseall为全部工单,不填为当前用户工单
  • Return

    json
    {
      "data": [
        {
          "_id": "63a9332af4ec535b92f3228d",
          "user": "user",
          "question": "问题",
          "answer": "回答",
          "createdAt": "2022-12-26T05:37:46.981Z",
          "updatedAt": "2023-03-10T09:28:37.991Z",
          "__v": 0,
          "admin": "admin"
        }
      ],
      "errno": 0
    }

工单详情

  • Path: /api/ticket/detail
  • Method: GET
  • Description: 查询单个订单详情
  • Query
参数名类型是否必须默认值备注
_idStringTrue工单ID
  • Return
json
{
  "data": {
     "_id": "63a9332af4ec535b92f3228d",
     "user": "user",
     "question": "你好,我有个问题",
     "answer": "请讲!",
     "createdAt": "2022-12-26T05:37:46.981Z",
     "updatedAt": "2023-03-10T09:28:37.991Z",
     "__v": 0,
     "admin": "admin"
  },
  "errno": 0
}

发布工单

  • Path: /api/ticket/question

  • Method: POST

  • Description: 发布订单

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
questionStringTrue提问内容
  • Return
json
{
  "msg": "发送成功",
  "errno": 0
}

回复工单

  • Path: /api/order/finish

  • Method: POST

  • Description: 回复工单

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
_idStringTrue工单ID
answerStringTrue回复内容
  • Return
json
{
  "msg": "回复成功",
  "errno": 0
}

聊天接口

聊天列表(所有)

  • Path: /api/chat

  • Method: GET

  • Description: 查询所有聊天列表

  • Return

    json
    {
    "data": [
        {
          "_id": "64183285ed17c631e2888c71",
          "sender": {
            "_id": "629d84c53ef6e16c0c308ba7",
            "username": "user"
          },
          "receiver": {
            "_id": "629d847e3ef6e16c0c308b9c",
            "username": "admin"
          },
          "content": "你好!",
          "delete": false,
          "createdAt": "2023-03-20T10:16:37.874Z",
          "updatedAt": "2023-03-21T12:44:04.069Z",
          "__v": 0
        }
      ],
      "errno": 0
    }

聊天列表(个人)

  • Path: /api/chat/user

  • Method: GET

  • Description: 查询个人聊天列表

  • Return

    json
    {
      "data": [
        {
          "_id": "641861144d4d36e417c4e0ce",
          "sender": "629d847e3ef6e16c0c308b9c",
          "receiver": "629d84c53ef6e16c0c308ba7",
          "content": "1",
          "delete": false,
          "createdAt": "2023-03-20T13:35:16.734Z",
          "updatedAt": "2023-03-20T13:35:16.734Z",
          "__v": 0,
          "target": "629d84c53ef6e16c0c308ba7",
          "username": "user",
          "avatar": "http://localhost:8000/images/upload_7b8b7ff1e44dcd711a2685e9b610b81c.jpg"
        }
      ],
      "errno": 0
    }

聊天记录

  • Path: /api/chat/past
  • Method: GET
  • Description: 查询聊天记录
  • Query
参数名类型是否必须默认值备注
_idStringTrue聊天对象的ID
  • Return

    json
    {
      "data": [
        {
          "_id": "64183285ed17c631e2888c71",
          "sender": "629d84c53ef6e16c0c308ba7",
          "receiver": "629d847e3ef6e16c0c308b9c",
          "content": "你好!",
          "delete": false,
          "createdAt": "2023-03-20T10:16:37.874Z",
          "updatedAt": "2023-03-21T12:44:04.069Z",
          "__v": 0
        }
      ],
      "errno": 0
    }

删除聊天记录

  • Path: /api/chat/delete

  • Method: POST

  • Description: 删除聊天记录(将 delete 标记为 true )

  • Headers

参数名
Content-Typeapplication/json
  • Body
参数名类型是否必须默认值备注
_idStringTrue聊天记录ID
  • Return
json
{
  "msg": "操作成功",
  "errno": 0
}
关注微信公众号V.PS- 美国 CN2 GIA / 9929 / CMIN2 顶级线路
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0

预览:

评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v3.1.3