feat: 添加许愿树功能和Go后端服务
- 新增许愿树页面(Canvas绘制、许愿条展示) - 新增许愿详情页面 - 新增许愿创建弹窗(免费/付费两种模式) - 新增网络请求封装 utils/request.js - 新增Go后端项目结构(Gin + Inertia.js) - 新增用户、订单、许愿数据模型 - 新增数据库迁移脚本 - 更新.gitignore补全忽略规则 - 更新.env.local配置(robot=2, 版本1.0.1) - 添加secrets目录说明文档
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
# 祈福小助手后端服务
|
||||
|
||||
基于 Go + Gin + Inertia.js 的后端服务。
|
||||
|
||||
## 功能模块
|
||||
|
||||
- **用户模块** — 微信登录、资料修改、授权管理
|
||||
- **支付模块** — 微信支付集成、订单管理
|
||||
- **许愿树** — 许愿发布、付费许愿、机器人自动许愿
|
||||
- **管理后台** — 基于 Inertia.js 的前后端分离管理界面
|
||||
|
||||
## 技术栈
|
||||
|
||||
- **后端**: Go 1.22 + Gin + GORM
|
||||
- **前端**: Inertia.js + React/Vue(待选择)
|
||||
- **数据库**: MySQL
|
||||
- **缓存**: Redis
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 开发环境
|
||||
|
||||
```bash
|
||||
# 安装依赖
|
||||
go mod download
|
||||
|
||||
# 启动开发服务器
|
||||
./scripts/dev.sh
|
||||
```
|
||||
|
||||
### 生产构建
|
||||
|
||||
```bash
|
||||
# 构建
|
||||
./scripts/build.sh
|
||||
|
||||
# 运行
|
||||
./bin/lunar-server
|
||||
```
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
server/
|
||||
├── cmd/ # 入口文件
|
||||
│ └── main.go
|
||||
├── internal/ # 内部包
|
||||
│ ├── config/ # 配置
|
||||
│ ├── handler/ # 处理器
|
||||
│ ├── middleware/ # 中间件
|
||||
│ ├── model/ # 数据模型
|
||||
│ └── service/ # 业务逻辑
|
||||
├── web/ # Inertia.js 前端
|
||||
│ ├── src/
|
||||
│ └── public/
|
||||
├── migrations/ # 数据库迁移
|
||||
├── scripts/ # 脚本
|
||||
└── go.mod
|
||||
```
|
||||
|
||||
## API 接口
|
||||
|
||||
### 用户接口
|
||||
|
||||
- `POST /api/user/login` — 用户登录
|
||||
- `POST /api/user/logout` — 用户登出
|
||||
- `GET /api/user/profile` — 获取用户资料
|
||||
- `PUT /api/user/profile` — 更新用户资料
|
||||
- `POST /api/user/auth` — 微信授权
|
||||
|
||||
### 支付接口
|
||||
|
||||
- `POST /api/pay/create` — 创建订单
|
||||
- `POST /api/pay/notify` — 支付回调
|
||||
- `GET /api/pay/status/:orderId` — 查询支付状态
|
||||
|
||||
### 订单接口
|
||||
|
||||
- `GET /api/order/list` — 订单列表
|
||||
- `GET /api/order/detail/:id` — 订单详情
|
||||
- `POST /api/order/cancel/:id` — 取消订单
|
||||
|
||||
### 许愿接口
|
||||
|
||||
- `GET /api/wish/tree` — 获取许愿树
|
||||
- `POST /api/wish/create` — 创建许愿
|
||||
- `GET /api/wish/list` — 许愿列表
|
||||
- `DELETE /api/wish/:id` — 删除许愿
|
||||
|
||||
## 环境变量
|
||||
|
||||
参考 `.env.local` 文件配置。
|
||||
|
||||
## 数据库
|
||||
|
||||
执行 `migrations/001_init.sql` 初始化数据库。
|
||||
Reference in New Issue
Block a user