电商 api 接口文档

电商 api 接口文档

1、开篇

欢迎使用ShowDoc!

API格式:

备注:电商API必须返回如下3个字段:

参数名 必选 类型 说明
status int 状态
message string 信息提示
result mix 结果

2、用户相关

2.1、登录/退出

简要描述:

  • 用户登录API

请求URL:

  • http://xx.com/api/login

请求方式:

  • POST

参数:

参数名 必选 类型 说明
phone_number int 手机号码
code int 验证码
type 类型 tinyint 1 :7天 2:30天,默认传递2

返回示例

{
status: 1,
message: "OK",
result: [ ]
}

返回参数说明

简要描述:

  • 用户退出登录接口

请求URL:

  • http://xx.com/api/logout

请求方式:

  • POST GET

  • 备注

  • 更多返回错误代码请看首页的错误代码描述

    备注

  • 更多返回错误代码请看首页的错误代码描述

2.2、发送验证码

简要描述:

  • 获取短信验证码API

请求URL:

  • http://xx.com/api/smscode

请求方式:

  • POST

参数:

参数名 必选 类型 说明
phone_number int 手机号码

返回示例

  {
    "status": 1,
   "message":"发送成功",
   "result":123
  }

返回参数说明

参数名 类型 说明
status int 状态:1成功, 0失败, -1不能重新发送
message string 消息提示

备注

  • 更多返回错误代码请看首页的错误代码描述

欢迎使用ShowDoc!

2.3、个人中心

简要描述:

  • 用户个人中心数据

请求URL:

  • http://xx.com/api/user

请求方式:

  • GET

  • 用户个人中心数据

请求URL:

  • http://xx.com/api/user/1

请求方式:

  • PUT

参数:username:用户名 sex: 0:保密, 1男, 2女。

备注

  • 更多返回错误代码请看首页的错误代码描述

3、首页相关

3.1、获取轮播图

简要描述:

  • 获取轮播图

请求URL:

  • http://xx.com/api/index/getRotationChart

请求方式:

  • GET

    返回示例

  {
status: 1,
message: "ok",
result: [
{
id: 1,
title: "abcd",
image: "http://testmall.singwa.com/static/upload/image/1.jpg"
},
{
id: 2,
title: "abcd",
image: "http://testmall.singwa.com/static/upload/image/3.jpg"
},
{
id: 3,
title: "abcd",
image: "http://testmall.singwa.com/static/upload/image/3.jpg"
},
{
id: 4,
title: "abcd",
image: "http://testmall.singwa.com/static/upload/image/5.jpg"
},
{
id: 5,
title: "abcd",
image: "http://testmall.singwa.com/static/upload/image/5.jpg"
}
]
}

点击轮播图跳转到详情页 xxx/api/detail/商品ID

返回示例

备注

  • 更多返回错误代码请看首页的错误代码描述

欢迎使用ShowDoc!

3.2、获取首页栏目推荐的商品

简要描述:

  • 用户注册接口

请求URL:

  • http://xx.com/api/index/cagegoryGoodsRecommend

请求方式: -GET

返回示例

  {
status: 1,
message: "ok",
result: [
{
categorys: {
category_id: 1,
name: "女装",
icon: "",
list: [
{
name: "牛仔裤",
category_id: 2
},
{
name: "短裤",
category_id: 2
},
{
name: "休闲裤",
category_id: 2
},
{
name: "打底裤",
category_id: 2
},
{
name: "丝袜",
category_id: 2
}
]
},
goods: [
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 2,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 123.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 1256.1,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 4569,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 89.9,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 320.1,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "8原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 458,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "9原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 123,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "10原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 345,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
}
]
},
{
categorys: {
category_id: 2,
name: "电子设备",
icon: "",
list: [
{
name: "电脑",
category_id: 2
},
{
name: "手机",
category_id: 2
},
{
name: "摄像",
category_id: 2
},
{
name: "singwa",
category_id: 2
},
{
name: "abc",
category_id: 2
}
]
},
goods: [
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 2,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 123.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 1256.1,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 4569,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 89.9,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 320.1,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "8原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 458,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "9原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 123,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "10原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 345,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
}
]
},
{
categorys: {
category_id: 1,
name: "男装",
icon: "",
list: [
{
name: "牛仔裤",
category_id: 2
},
{
name: "短裤",
category_id: 2
},
{
name: "休闲裤",
category_id: 2
},
{
name: "打底裤",
category_id: 2
},
{
name: "丝袜",
category_id: 2
}
]
},
goods: [
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 2,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 123.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 1256.1,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 4569,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 89.9,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 320.1,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "8原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 458,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "9原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 123,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 1,
title: "10原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 345,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
}
]
}
]
}

备注

  • 更多返回错误代码请看首页的错误代码描述

3.3、首页分类

简要描述:

  • 分类接口

请求URL:

  • /api/category

请求方式:

  • GET

参数:

返回示例

 {
status: 1,
message: "OK",
result: [
{
category_id: 51,
name: "男装",
pid: 0,
list: [
{
category_id: 52,
name: "上装",
pid: 51,
list: [
{
category_id: 60,
name: "马甲",
pid: 52
},
{
category_id: 59,
name: "西服",
pid: 52
},
{
category_id: 58,
name: "衬衫",
pid: 52
},
{
category_id: 57,
name: "卫衣",
pid: 52
},
{
category_id: 56,
name: "夹克",
pid: 52
}
]
},
{
category_id: 54,
name: "潮流风向标",
pid: 51,
list: [
{
category_id: 70,
name: "夏装热卖",
pid: 54
},
{
category_id: 69,
name: "玩酷时尚",
pid: 54
},
{
category_id: 68,
name: "雅痞绅潮",
pid: 54
},
{
category_id: 67,
name: "潮男新计",
pid: 54
},
{
category_id: 66,
name: "夏季爆款",
pid: 54
}
]
},
{
category_id: 53,
name: "下装",
pid: 51,
list: [
{
category_id: 65,
name: "哈伦裤",
pid: 53
},
{
category_id: 64,
name: "运动裤",
pid: 53
},
{
category_id: 63,
name: "修身裤装",
pid: 53
},
{
category_id: 62,
name: "休闲裤",
pid: 53
},
{
category_id: 61,
name: "牛仔裤",
pid: 53
}
]
}
]
},
{
category_id: 71,
name: "女装",
pid: 0,
list: [
{
category_id: 74,
name: "女士上装",
pid: 71,
list: [
{
category_id: 78,
name: "衬衫",
pid: 74
},
{
category_id: 77,
name: "卫衣",
pid: 74
},
{
category_id: 76,
name: "毛衣外套",
pid: 74
},
{
category_id: 75,
name: "牛仔外套",
pid: 74
}
]
},
{
category_id: 73,
name: "女士下装",
pid: 71,
list: [
{
category_id: 84,
name: "牛仔裤",
pid: 73
},
{
category_id: 83,
name: "打底裤",
pid: 73
},
{
category_id: 82,
name: "休闲裤",
pid: 73
},
{
category_id: 81,
name: "哈伦裤",
pid: 73
},
{
category_id: 80,
name: "阔腿裤",
pid: 73
}
]
},
{
category_id: 72,
name: "女士裙装",
pid: 71,
list: [
{
category_id: 89,
name: "背带裙",
pid: 72
},
{
category_id: 88,
name: "羊绒连衣裙",
pid: 72
},
{
category_id: 87,
name: "毛呢连衣裙",
pid: 72
},
{
category_id: 86,
name: "针织连衣裙",
pid: 72
},
{
category_id: 85,
name: "蕾丝连衣裙",
pid: 72
}
]
}
]
},
{
category_id: 28,
name: "电脑",
pid: 0,
list: [
{
category_id: 41,
name: "小米",
pid: 28,
list: [
{
category_id: 45,
name: "小米游戏本",
pid: 41
},
{
category_id: 44,
name: "小米Air",
pid: 41
},
{
category_id: 43,
name: "小米Ruby",
pid: 41
},
{
category_id: 42,
name: "RedmiBook",
pid: 41
}
]
},
{
category_id: 40,
name: "戴尔",
pid: 28,
list: [
{
category_id: 47,
name: "DELL游匣",
pid: 40
},
{
category_id: 46,
name: "灵越",
pid: 40
}
]
},
{
category_id: 36,
name: "苹果",
pid: 28,
list: [
{
category_id: 50,
name: "一体机",
pid: 36
},
{
category_id: 49,
name: "mac air",
pid: 36
},
{
category_id: 48,
name: "mac book",
pid: 36
}
]
}
]
},
{
category_id: 26,
name: "手机",
pid: 0,
list: [
{
category_id: 30,
name: "苹果",
pid: 26,
list: [
{
category_id: 33,
name: "iphonexr",
pid: 30
},
{
category_id: 32,
name: "iphonexs max",
pid: 30
},
{
category_id: 31,
name: "iphonexr",
pid: 30
}
]
},
{
category_id: 39,
name: "三星",
pid: 26
},
{
category_id: 38,
name: "华为",
pid: 26
}
]
},
{
category_id: 27,
name: "书",
pid: 0,
list: [
{
category_id: 35,
name: "励志",
pid: 27
},
{
category_id: 34,
name: "计算机",
pid: 27
}
]
}
]
}

4、商品详情相关

4.1、商品详情API

简要描述:

  • 商品详情接口

请求URL:

  • /api/detail/商品ID

请求方式:

  • GET

参数:

返回示例

  {
status: 0,
message: "OK",
result: {
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
cost_price: 20.9,
sales_count: 123,
stock: 8967,  // 库存
gids: {
1,11: 1,
1,12: 5890,
2,11: 4590,
2,12: 890
},
sku: [
{
name: "颜色",
list: [
{
id: 1,
name: "红色",
flag: 1 , // 1高亮
},
{
id: 2,
name: "粉色",
flag: 0
}
]
},
{
name: "尺寸",
list: [
{
id: 11,
name: "L",
flag: 1
},
{
id: 12,
name: "S",
flag: 0
}
]
}
],
detail: {
d1: {
商品编号: "D-8812",
上架时间: "2017-06-24",
商品毛重: "200克",
商品库存: "1000件"
},
d2: "ssss师父父反反复复方法反反复复方法反反复复方法反反复复方法发发发abc"
}
}
}

返回参数说明

当选择sku中内容时候, 比如 1,11 需要去关联提供的gids中的id对应 比如1,11 对应id=1 那 直接重新请求API带上这个新id

备注

  • 更多返回错误代码请看首页的错误代码描述

5、商品列表页面

5.1、按分类检索

简要描述:

  • 分类列表接口

请求URL:

  • http://xx.com/api/category/search/分类ID

请求方式:

  • GET

参数:

返回示例

  {
status: 1,
message: "ok",
result: {
name: "我是一级分类",
focus_ids: [   // 分类的定位焦点 ,注意这个地方 有可能是一个,有可能是两个
1,
11
],
list: [
[
{
id: 1,
name: "二级分类1"
},
{
id: 2,
name: "二级分类2"
},
{
id: 3,
name: "二级分类3"
},
{
id: 4,
name: "二级分类4"
},
{
id: 5,
name: "二级分类5"
}
],
[
{
id: 11,
name: "三级分类1"
},
{
id: 12,
name: "三级分类2"
},
{
id: 13,
name: "三级分类3"
},
{
id: 14,
name: "三级分类4"
},
{
id: 15,
name: "三级分类5"
}
]
]
}
}
  • 更多返回错误代码请看首页的错误代码描述

5.2、sku分类

简要描述:

  • sku接口

请求URL:

  • http://xx.com/api/sku

请求方式:

  • GET

参数:

参数名 必选 类型 说明
category_id int 分类ID

返回示例

  {
status: 1,
message: "ok",
result: [
{
name: "颜色",
list: [
{
id: 1,
name: "红色"
},
{
id: 2,
name: "粉色"
},
{
id: 3,
name: "黄色"
},
{
id: 4,
name: "蓝色"
}
]
},
{
name: "尺寸",
list: [
{
id: 11,
name: "L"
},
{
id: 12,
name: "S"
},
{
id: 13,
name: "M"
},
{
id: 14,
name: "X"
},
{
id: 15,
name: "XL"
},
{
id: 15,
name: "XXL"
}
]
},
{
name: "价格",
list: [
{
id: 21,
name: "0-20"
},
{
id: 22,
name: "20-40"
},
{
id: 23,
name: "40-80"
},
{
id: 24,
name: "100-150"
},
{
id: 25,
name: "150以上"
}
]
}
]
}
  • 更多返回错误代码请看首页的错误代码描述

5.3、商品列表API

简要描述:

  • 商品列表/搜索API

请求URL:

  • http://xx.com/api/lists

请求方式:

  • POST

参数:

参数名 必选 类型 说明
category_id id 分类ID
sku_ids string 1,2,3
price string 10,100 ,如果选择了自定义的价格范围 请传递这个字段
page int 页数,不传递的话默认第一页面
page_size int 每页显示多少条, 默认10条
keyword sring 当是搜索页面的时候 这个字段传递下。
field sring 排序的Key , 价格:price , 销量:sales_count
order int 1: asc , 2:desc

返回示例

  {
status: 1,
message: "ok",
result: {
total_page_num: 10,
count:100
page: 1,
page_size: 10,
list: [
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sales_count: 123
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sales_count: 123
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sales_count: 123
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sales_count: 123
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sales_count: 123
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sales_count: 123
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sales_count: 123
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sales_count: 123
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sales_count: 123
},
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sales_count: 123
}
]
}
}

返回参数说明

参数名 类型 说明
total_page_num int 一共多少页
count int 一共多少商品
sales_count int 销量

备注

  • 更多返回错误代码请看首页的错误代码描述

5.4、获取子分类

简要描述:

  • 根据分类ID获取子分类

请求URL:

  • /api/subcategory/分类ID

    返回示例

  {
status: 1,
message: "ok",
result: [
{
id: 21,
name: "点二到三分类1"
},
{
id: 22,
name: "点二级三分类2"
},
{
id: 33,
name: "点二到三分类3"
},
{
id: 134,
name: "点二到三分类4"
},
{
id: 154,
name: "点二到三分类5"
}
]
}

返回参数说明

备注

  • 更多返回错误代码请看首页的错误代码描述

5.5、获取搜索关键词

简要描述:

  • 搜索关键词

请求URL:

  • /api/mall.recommend/searchTop

请求方式:

  • GET

参数:

返回示例

  {
status: 1,
message: "OK",
result: [
"鞋子",
"iphonexr",
"iphonex max",
"singwa",
"mac book"
]
}

备注

  • 更多返回错误代码请看首页的错误代码描述

5.6、获取推荐商品

简要描述:

  • 获取推荐商品

请求URL:

  • /api/mall.recommend

请求方式:

  • GET

参数:

返回示例

  {
status: 1,
message: "OK",
result: [
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 2,
title: "2原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 3,
title: "3原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 4,
title: "4原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
},
{
id: 5,
title: "5原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg"
}
]
}
  • 更多返回错误代码请看首页的错误代码描述

6、购物车

6.1、添加购物车

简要描述:

  • 添加购物车接口

请求URL:

  • /api/cart/add

请求方式:

  • POST

参数:

参数名 必选 类型 说明
id int 商品具体ID
num int 商品数量

返回示例

  {
    "status": 1,
    "message": "OK",
    "result": []
}

6.2、购物车列表

简要描述:

  • 购物车列表接口

请求URL:

  • /api/cart/lists

请求方式:

  • GET

id = 1,2 如果传递了这个那说明是提交订单之前的页面,比如:如图 电商 api 接口文档_第1张图片

返回示例

  {
    "status": 1,
    "message": "OK",
    "result": [
        {
            "id": 1,
            "title": "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
            "price": 12.13,
            "num": 2,
            "image": "http://testmall.singwa666.com/static/upload/image/10.jpg",
            "sku": "颜色:红色 尺码:L"
        },
        {
            "id": 2,
            "title": "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏2",
            "price": 12.13,
            "num": 1,
            "image": "http://testmall.singwa666.com/static/upload/image/10.jpg",
            "sku": "颜色:黄色 尺码:LL"
        }
    ]
}

6.3、删除购物车

简要描述:

  • 添加购物车接口

请求URL:

  • /api/cart/delete

请求方式:

  • POST

参数:

参数名 必选 类型 说明
id int 商品具体ID

返回示例

  {
    "status": 1,
    "message": "OK",
    "result": []
}

6.4、修改购物车数量

简要描述:

  • 修改购物车数量接口

请求URL:

  • http://xx.com/api/cart/update

请求方式:

  • POST

参数:

参数名 必选 类型 说明
id int 购物车ID
num int 数量

7、订单相关

7.1、初始化API

简要描述:

  • 初始化接口

请求URL:

  • http://xx.com/api/api/mall.init

请求方式:

  • POST

参数:

返回示例

  {
status: 1,
message: "OK",
result: {
cart_num: 12
}
}

7.2、获取用户地址信息

简要描述:

  • 地址信息接口

请求URL:

  • http://xx.com/api/address

请求方式:

  • GET

参数: 无

返回示例

  {
status: 1,
message: "OK",
result: [
{
id: 1,
consignee_info: "江西省 上饶市 鄱阳县xxx 王新华收 180xxxx",
is_default: 1
},
{
id: 2,
consignee_info: "2江西省 上饶市 鄱阳县xxx 王新华收 180xxxx",
is_default: 0
},
{
id: 3,
consignee_info: "3江西省 上饶市 鄱阳县xxx 王新华收 180xxxx",
is_default: 0
}
]
}

返回参数说明

参数名 类型 说明
id int id
consignee_info string 地址基本信息
is_default int 1:默认地址, 0:不是默认

备注

  • 更多返回错误代码请看首页的错误代码描述

7.3、提交订单

简要描述:

  • 提交订单接口

请求URL:

  • http://xx.com/api/order

请求方式:

  • POST

参数:

参数名 必选 类型 说明
address_id int 地址ID
cart_ids string 购物车id: 如1,2,3

返回示例

  {
    "status": 1,
    "message": "OK",
    "result": {
        "id": 108940795062
    }
}

备注

  • 更多返回错误代码请看首页的错误代码描述

7.4、获取订单信息

简要描述:

  • 获取订单接口

请求URL:

  • http://xx.com/api/order/订单ID

请求方式:

  • GET

参数:

返回示例

{
status: 1,
message: "OK",
result: {
id: 108940795062,
price: 123.34,
consignee_info: "江西省 上饶市 鄱阳县xxx 王新华收 180xxxx",
create_time: "2020-01-20:12:34:67",
pay_time: "2020-01-20:12:35:67",
mall_title: "桂花树苗 嫁接桂花苗盆栽四季桂金桂浓香型庭院室内植物盆景室内阳台种植 白玉藤紫藤苗 三年苗,御春阁 火棘盆景下山桩火棘树桩冬天结果植物 庭院盆栽绿化",
malls: [
{
id: 1,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏",
price: 12.13,
num: 2,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sku: "颜色:红色 尺码:L"
},
{
id: 2,
title: "原创设计日常汉服女款绣花长褙子吊带改良宋裤春夏2",
price: 12.13,
num: 1,
image: "http://testmall.singwa666.com/static/upload/image/10.jpg",
sku: "颜色:黄色 尺码:LL"
}
]
}

7.5、订单列表

简要描述:

  • 订单列表接口

请求URL:

  • http://xx.com/api/order

请求方式:

  • GET

    参数说明

参数名 类型 说明
type int 1待支付2待发货3待收货4已完成5已取消

返回示例

  {
status: 1,
message: "OK",
result: {
total_page_num: 1,
count: 4,
page: 1,
page_size: 10,
list: [
{
id: 123456,
cart_ids: "1,2",
create_time: "2020-01-20",
mall_title: "桂花树苗;嫁接桂花苗盆栽四季桂金桂浓香型庭院室内植物盆景室内阳台种植;白玉藤紫藤苗",
count: 3,
unit_price: "100,10,20.4",
price: "130.4",
type: 1,
type_name: "已完成"
},
{
id: 1234516,
cart_ids: "1",
create_time: "2020-01-20",
mall_title: "我就一个商品哦。",
count: 1,
unit_price: "100",
price: "100",
pay_status: 0,
type: 2,
type_name: "待支付"
},
{
id: 1234516,
cart_ids: "2",
create_time: "2020-01-20",
mall_title: "我就一个商品,但是我买了两件",
count: 2,
unit_price: "10",
price: "20",
type: 3,
type_name: "待发货"
},
{
id: 1234516,
cart_ids: "1,2",
create_time: "2020-01-20",
mall_title: "3桂花树苗;嫁接桂花苗盆栽四季桂金桂浓香型庭院室内植物盆景室内阳台种植;白玉藤紫藤苗",
count: 4,
unit_price: "100,10,20.4",
price: "130.4",
type: 4,
type_name: "待收货"
}
]
}
}
备注 参数名 类型 说明
id int 订单号
create_time int 订单创建时间
mall_title string 商品标题
count int 商品数量
unit_price int 单价
price int 总价
  • 更多返回错误代码请看首页的错误代码描述

7.6、取消/删除订单

简要描述:

  • 取消订单接口

请求URL:

  • http://xx.com/api/order/订单ID

请求方式:

  • PUT

参数:

参数名 必选 类型 说明
type int 5 取消订单, 99:删除订单

8、支付

8.1、页面异步回调订单支付状态

简要描述:

请求URL:

  • http://xx.com/api/order.async/queryState

请求方式:

  • POST

参数:

参数名 必选 类型 说明
order_id int 订单ID

返回示例

  {
status: 1,
message: "OK",
result: {
pay_status: 1
}
}

返回参数说明

参数名 类型 说明
pay_status int 订单状态,1:支付成功;0 :未支付

备注

  • 更多返回错误代码请看首页的错误代码描述

8.2、支付

简要描述:

请求URL:

  • http://xx.com/api/pay

请求方式:

  • POST

参数:

参数名 必选 类型 说明
order_id int 订单号
pay_type string 支付类型:alipay:支付宝 , weixin:微信支付

 

你可能感兴趣的:(数据库,服务器,前端)