商品详情

接口描述
  • 商品详情
请求URL
  • /api/goods/{good}
请求方式
  • POST
REST 参数
参数名 必选 类型 说明
good int 商品id
返回参数

goods 商品详情

参数名 必含 类型 说明
id string 自增长主键ID
user_id string 创建者
category_id string 分类
title string 标题
description string 描述
price string 价格
stock string 库存
sales string 销量
cover string 封面图
cover_url string 封面图url
pics string 小图集
pics_url string 小图集url
is_on string 是否上架 0不上架 1上架
is_recommend string 是否推荐 0不推荐 1推荐
details string 详情
created_at timestamp 添加时间
updated_at timestamp 修改时间
comments array 关联的评论数据, 参考下表

goods.comments 商品评论

参数名 必含 类型 说明
id int 自增长主键ID
user_id int 创建者
goods_id int 商品ID
order_id int 订单ID
content string 评论内容
rate int 价格
star int 库存
pics array 小图集
pics_url array 小图集url
reply string 标题
created_at timestamp 添加时间
updated_at timestamp 修改时间
user object 关联的用户数据, 参考下表

goods.comments.user 评论所关联的用户

参数名 必含 类型 说明
id int 自增长主键ID
name int 用户名
avatar string 头像
avatar_url string 头像地址

like_goods 相似商品

参数名 必含 类型 说明
id int 自增长主键ID
title string 标题
price int 价格
sales int 销量
cover string 封面图
cover_url string 封面图url
collects_count int 收藏人数
返回示例
  • 状态码 200 请求成功
  {
    "goods": {
        "id": 1,
        "user_id": 1,
        "title": "Consectetur.",
        "category_id": 64,
        "description": "Aliquid quis cupiditate maxime qui.",
        "price": 852,
        "stock": 7025,
        "sales": 0,
        "cover": "http://placeimg.com/640/480/any",
        "pics": [
            "http://placeimg.com/640/480/any",
            "http://placeimg.com/640/480/any",
            "http://placeimg.com/640/480/any"
        ],
        "is_on": 0,
        "is_recommend": 0,
        "details": "Explicabo dolores quo corporis alias et rerum placeat. Ut sequi mollitia deserunt quae est aperiam consectetur. Sint ipsum minus et. Magni repudiandae suscipit libero nisi consectetur architecto.\n\nVoluptas tempore quod laborum commodi. Reiciendis debitis delectus est aut.\n\nRerum eos eos reprehenderit est perspiciatis. Aut assumenda nobis dicta sit. Dolorum explicabo recusandae et beatae.\n\nAut culpa vel dolores minima laudantium. Rerum dignissimos et vero molestiae harum. In qui molestiae consequatur consequatur et. Doloremque rerum neque veniam commodi et ea.",
        "created_at": "2021-09-17T01:49:16.000000Z",
        "updated_at": "2021-09-17T01:49:16.000000Z",
        "cover_url": "http://placeimg.com/640/480/any",
        "pics_url": [
            "http://placeimg.com/640/480/any",
            "http://placeimg.com/640/480/any",
            "http://placeimg.com/640/480/any"
        ],
        "comments": [
            {
                "id": 1,
                "user_id": 1,
                "goods_id": 1,
                "rate": 1,
                "star": 5,
                "content": "我评论了你",
                "reply": null,
                "pics": null,
                "created_at": "2021-09-18T04:19:24.000000Z",
                "updated_at": "2021-09-18T04:19:26.000000Z",
                "user": {
                    "id": 1,
                    "name": "admin",
                    "avatar": "http://placeimg.com/200/200/any",
                    "avatar_url": "http://placeimg.com/200/200/any"
                }
            }
        ]
    },
    "like_good": [
        {
            "id": 35,
            "title": "Non eos debitis.",
            "price": 348,
            "cover": "http://placeimg.com/640/480/any",
            "sales": 0,
            "cover_url": "http://placeimg.com/640/480/any"
        },
        {
            "id": 198,
            "title": "Nostrum totam sed.",
            "price": 15,
            "cover": "http://placeimg.com/640/480/any",
            "sales": 0,
            "cover_url": "http://placeimg.com/640/480/any"
        },
        {
            "id": 237,
            "title": "Placeat perferendis.",
            "price": 170,
            "cover": "http://placeimg.com/640/480/any",
            "sales": 0,
            "cover_url": "http://placeimg.com/640/480/any"
        },
        {
            "id": 300,
            "title": "Magnam repellat.",
            "price": 992,
            "cover": "http://placeimg.com/640/480/any",
            "sales": 0,
            "cover_url": "http://placeimg.com/640/480/any"
        },
        {
            "id": 119,
            "title": "In velit voluptatem.",
            "price": 152,
            "cover": "http://placeimg.com/640/480/any",
            "sales": 0,
            "cover_url": "http://placeimg.com/640/480/any"
        },
        {
            "id": 186,
            "title": "Tempora architecto.",
            "price": 550,
            "cover": "http://placeimg.com/640/480/any",
            "sales": 0,
            "cover_url": "http://placeimg.com/640/480/any"
        },
        {
            "id": 174,
            "title": "Consequatur.",
            "price": 932,
            "cover": "http://placeimg.com/640/480/any",
            "sales": 0,
            "cover_url": "http://placeimg.com/640/480/any"
        },
        {
            "id": 83,
            "title": "Nam eaque corporis.",
            "price": 281,
            "cover": "http://placeimg.com/640/480/any",
            "sales": 0,
            "cover_url": "http://placeimg.com/640/480/any"
        },
        {
            "id": 53,
            "title": "Qui enim excepturi.",
            "price": 784,
            "cover": "http://placeimg.com/640/480/any",
            "sales": 0,
            "cover_url": "http://placeimg.com/640/480/any"
        },
        {
            "id": 240,
            "title": "Possimus et nihil.",
            "price": 259,
            "cover": "http://placeimg.com/640/480/any",
            "sales": 0,
            "cover_url": "http://placeimg.com/640/480/any"
        }
    ]
}