| backend | ||
| frontend@204654c6c0 | ||
| README.md | ||
商用咖啡机商城演示系统
功能概览
- 前端:React + Ant Design + React Router,包含商城首页、商品详情、支付演示、登录/注册以及商家后台。
- 后端:Go Gin + GORM + SQLite,提供 JWT 登录、注册、商城数据及后台 CRUD 接口。
- 商家后台:商品、订单、会员、积分、工单模块,支持增删改查与 1 分钟无操作自动登出。
- 登录演示账号:
demo / demo123。
快速开始
启动后端
cd backend
go run main.go
默认监听 http://localhost:8080,首次启动自动在 backend/data/coffee_mall.db 生成 SQLite 数据库与种子数据。
启动前端
cd frontend
npm install
npm start
前端默认运行在 http://localhost:3000。构建产物可通过 npm run build 生成。
接口说明
- 公共接口:
/api/home、/api/products、/api/products/:id、/api/orders、/api/pay/demo。 - 认证接口:
/api/auth/login、/api/auth/register(JWT)。 - 后台接口需附带
Authorization: Bearer <token>:/api/admin/products|orders|members|points|tickets。 - 1 分钟无请求自动判定登录超时,返回 401 并提示前端跳转商城首页。
目录结构
backend/ # Go Gin 服务
frontend/ # React + Ant Design 前端
README.md # 使用说明
其他
- 数据库存储在
backend/data/coffee_mall.db,如需重置可删除该文件后重新启动后端。 - 可根据需要扩展真实支付、权限角色、图表等高级特性。