1.添加购物车 1.1.1 产品原型 用户可以将菜品或者套餐添加到购物车。对于菜品来说,如果设置了口味信息,则需要选择规格后才能加入购物车;对于套餐来说,可以直接点击+将当前套餐加入购物车。在购物车中可以修改菜品和套餐的数量,也可以清空购物车。 效果图: 1.1.2 接口设计 通过上述原型图,设计出对应的添加购物车接口。 说明:添加购物车时,有可能添加菜品,也有可能添加套餐。故传入参数要么是菜品id,要么是套餐id。 1.1.3 表设计 用户的购物车数据,也是需要保存在数据库中的,购物车对应的数据表为shopping_cart表,具体表结构如下: 字段名数据类型说明备注 id bigint 主键 自增 name varchar(32) 商品名称 冗余字段 image varchar(255) 商品图片路径 冗余字段 user_id bigint 用户id 逻辑外键 dish_id bigint 菜品id 逻辑外键 setmeal_id bigint 套餐id 逻辑外键 dish_flavor varchar(50) 菜品口味 number int 商品数量 amount...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with Long
Contact Long, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack