MoreMall商城API接口


title: 电商项目
language_tabs:

  • shell: Shell
  • http: HTTP
  • javascript: JavaScript
  • ruby: Ruby
  • python: Python
  • php: PHP
  • java: Java
  • go: Go
    toc_footers: []
    includes: []
    search: true
    code_clipboard: true
    highlight_theme: darkula
    headingLevel: 2
    generator: “@tarslib/widdershins v4.0.23”

电商项目

Base URLs:

Authentication

用户接口

POST 登录

POST /user/login

Body 请求参数

{
  "username": "jack",
  "password": "123"
}

请求参数

名称位置类型必选说明
usernamequerystring用户名
passwordquerystring密码
bodybodyobjectnone

返回示例

成功

{
  "code": 200,
  "data": null,
  "message": "登录成功"
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

POST 注册

POST /user/register

Body 请求参数

{
  "username": "admin",
  "password": "123",
  "email": "11111"
}

请求参数

名称位置类型必选说明
usernamequerystring用户名
passwordquerystring密码
emailquerystring邮箱
bodybodyobjectnone

返回示例

200 Response

{}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

GET 获取用户数据

GET /user/profile

返回示例

成功

{
  "code": 200,
  "data": {
    "id": 1,
    "username": "jack",
    "email": "jack@163.com",
    "avatar": "http://127.0.0.1:3000/public/images/avatar.jpg",
    "createTime": "2021-05-01T07:43:56.000Z",
    "updateTime": "2021-04-19T23:29:07.000Z"
  },
  "message": null
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» dataobjecttruenonenone
»» idintegertruenonenone
»» usernamestringtruenonenone
»» emailstringtruenonenone
»» avatarstringtruenonenone
»» createTimestringtruenonenone
»» updateTimestringtruenonenone
» messagenulltruenonenone

GET 获取地址列表

GET /contact/list

返回示例

200 Response

{
  "code": 0,
  "data": [
    "string"
  ],
  "message": null
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» data[string]truenonenone
» messagenulltruenonenone

商品接口

GET 根据分类id查询商品

GET /product/list

请求参数

名称位置类型必选说明
categoryIdquerystringnone

返回示例

成功

{
  "code": 200,
  "data": [
    {
      "details": [
        {
          "id": 1,
          "name": "8GB+128GB(秘银色)",
          "stock": 86,
          "price": "5999.00",
          "image": "http://119.91.249.251:8088/public/images/p1d01.png",
          "salePrice": "4999.00",
          "createTime": "2021-05-01T02:25:02.000Z",
          "updateTime": "2024-05-18T07:45:13.000Z",
          "productId": 1
        },
        {
          "id": 2,
          "name": "8GB+128GB(夏日胡杨)",
          "stock": 3,
          "price": "5999.00",
          "image": "http://119.91.249.251:8088/public/images/p1d02.png",
          "salePrice": "4999.00",
          "createTime": "2021-05-01T02:25:07.000Z",
          "updateTime": "2021-04-30T11:57:58.000Z",
          "productId": 1
        }
      ],
      "id": 1,
      "name": "HUAWEI Mate 40 5G 全网通",
      "description": " 华为Mate40是华为研发的智能手机,搭载麒麟9000E芯片,采用6.5英寸的68度曲面屏,分辨率为2376*1080",
      "showIndex": 0,
      "createTime": "2021-05-02T08:34:24.000Z",
      "updateTime": "2021-04-20T19:55:52.000Z",
      "categoryId": 1
    },
    {
      "details": [
        {
          "id": 3,
          "name": "8GB+256GB(陶瓷黑)",
          "stock": 0,
          "price": "11999.00",
          "image": "http://119.91.249.251:8088/public/images/p2d01.png",
          "salePrice": "10999.00",
          "createTime": "2021-05-01T02:25:15.000Z",
          "updateTime": "2021-04-28T06:30:59.000Z",
          "productId": 2
        },
        {
          "id": 4,
          "name": "8GB+256GB(陶瓷白)",
          "stock": 94,
          "price": "11999.00",
          "image": "http://119.91.249.251:8088/public/images/p2d02.png",
          "salePrice": "10999.00",
          "createTime": "2021-05-01T02:25:21.000Z",
          "updateTime": "2021-04-30T11:57:59.000Z",
          "productId": 2
        }
      ],
      "id": 2,
      "name": "HUAWEI Mate 40 RS保时捷设计 5G 全网通",
      "description": "保时捷设计基因, 5nm 麒麟9000旗舰芯片, 超感知徕卡电影五摄, 有线无线双超..\r\n芯片:  5nm 麒麟9000旗舰芯片摄像:  超感知徕卡电影五摄充电:  66W有线50W无线快充系统:  EMUI 11",
      "showIndex": 0,
      "createTime": "2021-04-20T19:57:12.000Z",
      "updateTime": "2021-04-20T19:57:12.000Z",
      "categoryId": 1
    },
    {
      "details": [
        {
          "id": 11,
          "name": "8GB+256GB(陶瓷黑)",
          "stock": 10,
          "price": "5999",
          "image": "http://119.91.249.251:8088/public/images/p5d01.jpg",
          "salePrice": "5999",
          "createTime": "2021-05-02T14:58:44.000Z",
          "updateTime": "2021-05-02T14:58:45.000Z",
          "productId": 5
        },
        {
          "id": 12,
          "name": "8GB+256GB(陶瓷白)",
          "stock": 10,
          "price": "5999",
          "image": "http://119.91.249.251:8088/public/images/p5d02.jpg",
          "salePrice": "5999",
          "createTime": "2021-05-02T06:07:57.000Z",
          "updateTime": "2021-05-01T06:15:57.000Z",
          "productId": 5
        }
      ],
      "id": 5,
      "name": "小米11 Ultra",
      "description": "匠心独具的现代陶瓷工艺,坚固度、耐久性远超想象,细腻的触感有如凝脂,这一点,你的双手将会印象深刻。",
      "showIndex": 0,
      "createTime": "2021-05-01T06:06:40.000Z",
      "updateTime": "2021-05-01T06:06:42.000Z",
      "categoryId": 1
    },
    {
      "details": [
        {
          "id": 13,
          "name": "8GB+128GB(緑野仙踪)",
          "stock": 9,
          "price": "3999",
          "image": "http://119.91.249.251:8088/public/images/p6d01.jpg",
          "salePrice": "3796",
          "createTime": "2021-05-03T03:14:42.000Z",
          "updateTime": "2021-05-02T15:09:34.000Z",
          "productId": 6
        },
        {
          "id": 14,
          "name": "8GB+128GB( 流光幻镜)",
          "stock": 10,
          "price": "3999",
          "image": "http://119.91.249.251:8088/public/images/p6d02.jpg",
          "salePrice": "3899",
          "createTime": "2021-05-01T06:23:56.000Z",
          "updateTime": "2021-05-01T06:23:45.000Z",
          "productId": 6
        }
      ],
      "id": 6,
      "name": "荣耀30 Pro",
      "description": "50倍远摄 麒麟990 5G 4000万超感光摄影 3200W美颜自拍 游戏手机 全网通版",
      "showIndex": 0,
      "createTime": "2021-05-01T06:20:08.000Z",
      "updateTime": "2021-05-01T06:20:11.000Z",
      "categoryId": 1
    }
  ],
  "message": null
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» data[object]truenonenone
»» details[object]truenonenone
»»» idintegertruenonenone
»»» namestringtruenonenone
»»» stockintegertruenonenone
»»» pricestringtruenonenone
»»» imagestringtruenonenone
»»» salePricestringtruenonenone
»»» createTimestringtruenonenone
»»» updateTimestringtruenonenone
»»» productIdintegertruenonenone
»» idintegertruenonenone
»» namestringtruenonenone
»» descriptionstringtruenonenone
»» showIndexintegertruenonenone
»» createTimestringtruenonenone
»» updateTimestringtruenonenone
»» categoryIdintegertruenonenone
» messagenulltruenonenone

GET 根据id查询商品

GET /product/content/{id}

请求参数

名称位置类型必选说明
idpathstringnone
idquerystringnone

返回示例

成功

{
  "code": 200,
  "data": {
    "category": [
      {
        "id": 1,
        "name": "手机",
        "createTime": "2021-04-20T19:52:03.000Z",
        "updateTime": "2021-04-20T19:52:03.000Z"
      }
    ],
    "details": [
      {
        "id": 1,
        "name": "8GB+128GB(秘银色)",
        "stock": 86,
        "price": "5999.00",
        "image": "http://119.91.249.251:8088/public/images/p1d01.png",
        "salePrice": "4999.00",
        "createTime": "2021-05-01T02:25:02.000Z",
        "updateTime": "2024-05-18T07:45:13.000Z",
        "productId": 1
      },
      {
        "id": 2,
        "name": "8GB+128GB(夏日胡杨)",
        "stock": 3,
        "price": "5999.00",
        "image": "http://119.91.249.251:8088/public/images/p1d02.png",
        "salePrice": "4999.00",
        "createTime": "2021-05-01T02:25:07.000Z",
        "updateTime": "2021-04-30T11:57:58.000Z",
        "productId": 1
      }
    ],
    "id": 1,
    "name": "HUAWEI Mate 40 5G 全网通",
    "description": " 华为Mate40是华为研发的智能手机,搭载麒麟9000E芯片,采用6.5英寸的68度曲面屏,分辨率为2376*1080",
    "showIndex": 0,
    "createTime": "2021-05-02T08:34:24.000Z",
    "updateTime": "2021-04-20T19:55:52.000Z",
    "categoryId": 1
  },
  "message": null
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» dataobjecttruenonenone
»» category[object]truenonenone
»»» idintegerfalsenonenone
»»» namestringfalsenonenone
»»» createTimestringfalsenonenone
»»» updateTimestringfalsenonenone
»» details[object]truenonenone
»»» idintegertruenonenone
»»» namestringtruenonenone
»»» stockintegertruenonenone
»»» pricestringtruenonenone
»»» imagestringtruenonenone
»»» salePricestringtruenonenone
»»» createTimestringtruenonenone
»»» updateTimestringtruenonenone
»»» productIdintegertruenonenone
»» idintegertruenonenone
»» namestringtruenonenone
»» descriptionstringtruenonenone
»» showIndexintegertruenonenone
»» createTimestringtruenonenone
»» updateTimestringtruenonenone
»» categoryIdintegertruenonenone
» messagenulltruenonenone

GET 获取商品分类

GET /category/list

返回示例

成功

{
  "code": 200,
  "data": [
    {
      "id": 1,
      "name": "手机",
      "createTime": "2021-04-20T19:52:03.000Z",
      "updateTime": "2021-04-20T19:52:03.000Z"
    },
    {
      "id": 2,
      "name": "手环手表",
      "createTime": "2021-04-20T19:52:25.000Z",
      "updateTime": "2021-04-20T19:52:25.000Z"
    },
    {
      "id": 3,
      "name": "平板电脑",
      "createTime": "2021-05-01T06:31:28.000Z",
      "updateTime": "2021-05-01T06:31:30.000Z"
    }
  ],
  "message": null
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» data[object]truenonenone
»» idintegertruenonenone
»» namestringtruenonenone
»» createTimestringtruenonenone
»» updateTimestringtruenonenone
» messagenulltruenonenone

购物车接口

POST 添加购物车

POST /cart/add

Body 请求参数

{
  "quantity": 1,
  "productId": 1,
  "detailId": 1,
  "userId": 1
}

请求参数

名称位置类型必选说明
bodybodyobjectnone

返回示例

成功

{
  "code": 200,
  "data": null,
  "message": "添加购物车成功"
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» datanulltruenonenone
» messagestringtruenonenone

GET 获取购物车列表

GET /cart/list

返回示例

成功

{
  "code": 200,
  "data": [
    {
      "product": {
        "id": 1,
        "name": "HUAWEI Mate 40 5G 全网通",
        "description": " 华为Mate40是华为研发的智能手机,搭载麒麟9000E芯片,采用6.5英寸的68度曲面屏,分辨率为2376*1080",
        "showIndex": 0,
        "createTime": "2021-05-02T08:34:24.000Z",
        "updateTime": "2021-04-20T19:55:52.000Z",
        "categoryId": 1
      },
      "detail": {
        "id": 1,
        "name": "8GB+128GB(秘银色)",
        "stock": 85,
        "price": "5999.00",
        "image": "http://119.91.249.251:8088/public/images/p1d01.png",
        "salePrice": "4999.00",
        "createTime": "2021-05-01T02:25:02.000Z",
        "updateTime": "2024-05-20T11:35:37.000Z",
        "productId": 1
      },
      "id": 2,
      "checked": true,
      "quantity": 5,
      "createTime": "2024-05-18T07:45:13.000Z",
      "updateTime": "2024-05-20T11:35:37.000Z",
      "productId": 1,
      "detailId": 1,
      "userId": 1
    }
  ],
  "message": null
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» data[object]truenonenone
»» productobjecttruenonenone
»»» idintegertruenonenone
»»» namestringtruenonenone
»»» descriptionstringtruenonenone
»»» showIndexintegertruenonenone
»»» createTimestringtruenonenone
»»» updateTimestringtruenonenone
»»» categoryIdintegertruenonenone
»» detailobjecttruenonenone
»»» idintegertruenonenone
»»» namestringtruenonenone
»»» stockintegertruenonenone
»»» pricestringtruenonenone
»»» imagestringtruenonenone
»»» salePricestringtruenonenone
»»» createTimestringtruenonenone
»»» updateTimestringtruenonenone
»»» productIdintegertruenonenone
»» idintegertruenonenone
»» checkedbooleantruenonenone
»» quantityintegertruenonenone
»» createTimestringtruenonenone
»» updateTimestringtruenonenone
»» productIdintegertruenonenone
»» detailIdintegertruenonenone
»» userIdintegertruenonenone
» messagenulltruenonenone

POST 根据id删除购物车

POST /cart/delete

Body 请求参数

{
  "id": 1
}

请求参数

名称位置类型必选说明
bodybodyobjectnone

返回示例

200 Response

{
  "code": 0,
  "data": null,
  "message": "string"
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» datanulltruenonenone
» messagestringtruenonenone

POST 修改商品数量

POST /cart/quantity

Body 请求参数

{
  "quantity": 4,
  "cartId": 2
}

请求参数

名称位置类型必选说明
bodybodyobjectnone

返回示例

成功

{
  "code": 200,
  "data": null,
  "message": "更新数量成功"
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» datanulltruenonenone
» messagestringtruenonenone

订单接口

GET 获取订单列表

GET /order/list

返回示例

成功

{
  "code": 200,
  "data": [
    {
      "details": [
        {
          "id": 17,
          "quantity": 1,
          "createTime": "2021-04-28T06:34:37.000Z",
          "updateTime": "2021-04-28T06:34:37.000Z",
          "orderId": "2021428143437645",
          "productId": 2,
          "detailId": 4
        }
      ],
      "contact": {
        "id": 1,
        "name": "哈哈",
        "telephone": "13612341234",
        "address": "湖南长沙市天心xxx路xxx号",
        "tag": "学校",
        "createTime": "2021-05-04T09:03:40.000Z",
        "updateTime": "2021-04-26T06:56:54.000Z",
        "userId": 2
      },
      "id": "2021428143437645",
      "price": "10999.00",
      "paid": 1,
      "createTime": "2021-04-28 06:34:43",
      "updateTime": "2021-04-28T06:34:38.000Z",
      "contactId": 1,
      "userId": 1
    },
    {
      "details": [
        {
          "id": 20,
          "quantity": 1,
          "createTime": "2021-04-30T11:58:32.000Z",
          "updateTime": "2021-04-30T11:58:32.000Z",
          "orderId": "2021430195832547",
          "productId": 1,
          "detailId": 1
        }
      ],
      "contact": {
        "id": 1,
        "name": "哈哈",
        "telephone": "13612341234",
        "address": "湖南长沙市天心xxx路xxx号",
        "tag": "学校",
        "createTime": "2021-05-04T09:03:40.000Z",
        "updateTime": "2021-04-26T06:56:54.000Z",
        "userId": 2
      },
      "id": "2021430195832547",
      "price": "4999.00",
      "paid": 1,
      "createTime": "2021-04-30 11:58:34",
      "updateTime": "2021-04-30T11:58:33.000Z",
      "contactId": 1,
      "userId": 1
    },
    {
      "details": [
        {
          "id": 16,
          "quantity": 1,
          "createTime": "2021-04-28T06:31:58.000Z",
          "updateTime": "2021-04-28T06:31:58.000Z",
          "orderId": "2021428143158728",
          "productId": 2,
          "detailId": 4
        }
      ],
      "contact": {
        "id": 2,
        "name": "tantan",
        "telephone": "13612341234",
        "address": "湖南株洲市石峰区xxx路xxx号",
        "tag": "家",
        "createTime": "2021-05-01T07:56:01.000Z",
        "updateTime": "2021-04-26T06:57:18.000Z",
        "userId": 2
      },
      "id": "2021428143158728",
      "price": "10999.00",
      "paid": 0,
      "createTime": "2021-04-28 14:31:59",
      "updateTime": "2021-04-28T06:31:59.000Z",
      "contactId": 2,
      "userId": 1
    },
    {
      "details": [
        {
          "id": 18,
          "quantity": 1,
          "createTime": "2021-04-28T06:44:37.000Z",
          "updateTime": "2021-04-28T06:44:37.000Z",
          "orderId": "2021428144437336",
          "productId": 2,
          "detailId": 3
        },
        {
          "id": 19,
          "quantity": 1,
          "createTime": "2021-04-28T06:44:37.000Z",
          "updateTime": "2021-04-28T06:44:37.000Z",
          "orderId": "2021428144437336",
          "productId": 1,
          "detailId": 1
        }
      ],
      "contact": {
        "id": 2,
        "name": "tantan",
        "telephone": "13612341234",
        "address": "湖南株洲市石峰区xxx路xxx号",
        "tag": "家",
        "createTime": "2021-05-01T07:56:01.000Z",
        "updateTime": "2021-04-26T06:57:18.000Z",
        "userId": 2
      },
      "id": "2021428144437336",
      "price": "15998.00",
      "paid": 1,
      "createTime": "2021-04-28 06:44:39",
      "updateTime": "2021-04-28T06:44:37.000Z",
      "contactId": 2,
      "userId": 1
    },
    {
      "details": [
        {
          "id": 21,
          "quantity": 1,
          "createTime": "2021-04-30T12:00:57.000Z",
          "updateTime": "2021-04-30T12:00:57.000Z",
          "orderId": "202143020057661",
          "productId": 3,
          "detailId": 5
        }
      ],
      "contact": {
        "id": 2,
        "name": "tantan",
        "telephone": "13612341234",
        "address": "湖南株洲市石峰区xxx路xxx号",
        "tag": "家",
        "createTime": "2021-05-01T07:56:01.000Z",
        "updateTime": "2021-04-26T06:57:18.000Z",
        "userId": 2
      },
      "id": "202143020057661",
      "price": "4688.00",
      "paid": 1,
      "createTime": "2021-04-30 12:00:59",
      "updateTime": "2021-04-30T12:00:58.000Z",
      "contactId": 2,
      "userId": 1
    }
  ],
  "message": null
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» data[object]truenonenone
»» details[object]truenonenone
»»» idintegertruenonenone
»»» quantityintegertruenonenone
»»» createTimestringtruenonenone
»»» updateTimestringtruenonenone
»»» orderIdstringtruenonenone
»»» productIdintegertruenonenone
»»» detailIdintegertruenonenone
»» contactobjecttruenonenone
»»» idintegertruenonenone
»»» namestringtruenonenone
»»» telephonestringtruenonenone
»»» addressstringtruenonenone
»»» tagstringtruenonenone
»»» createTimestringtruenonenone
»»» updateTimestringtruenonenone
»»» userIdintegertruenonenone
»» idstringtruenonenone
»» pricestringtruenonenone
»» paidintegertruenonenone
»» createTimestringtruenonenone
»» updateTimestringtruenonenone
»» contactIdintegertruenonenone
»» userIdintegertruenonenone
» messagenulltruenonenone

POST 支付

POST /order/pay

Body 请求参数

{
  "id": "2021428143437645"
}

请求参数

名称位置类型必选说明
bodybodyobjectnone

返回示例

成功

{
  "code": 200,
  "data": null,
  "message": "支付成功"
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» datanulltruenonenone
» messagestringtruenonenone

POST 生成订单

POST /order/buy

Body 请求参数

{
  "contactId": "",
  "products": {
    "quantity": 1,
    "productId": 1,
    "detailId": 1,
    "cartId": 2
  }
}

请求参数

名称位置类型必选说明
bodybodyobjectnone

返回示例

500 Response

返回结果

状态码状态码含义说明数据模型
500Internal Server Error服务器错误Inline

返回数据结构

数据模型

  • 49
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值