docs(website): 添加简记memo产品原型和UI设计规范文档
- 新增「简记memo」一体化小程序产品原型设计文档 - 新增简记memo完整版UI视觉设计规范和界面细节 - 添加IDEA项目配置文件.gitignore - 创建404页面HTML文件,包含响应式布局和错误提示 - 添加关于页面HTML文件,展示品牌介绍和团队信息 - 实现AES加解密工具函数,支持请求体加密 - 添加用户协议页面基础框架
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
// routes/api_app.go
|
||||
// 小程序端API路由
|
||||
package routes
|
||||
|
||||
import (
|
||||
"simple-memo/api/app"
|
||||
"simple-memo/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// registerAPIAppRoutes 注册小程序端API路由
|
||||
func registerAPIAppRoutes(r *gin.Engine) {
|
||||
api := r.Group("/api")
|
||||
|
||||
// 小程序接口(需要加密)
|
||||
appGroup := api.Group("/app")
|
||||
appGroup.Use(middleware.Limiter()) // 限流
|
||||
appGroup.Use(middleware.Encryption()) // 加解密
|
||||
{
|
||||
// 登录
|
||||
appGroup.POST("/user/login", app.NewUserHandler().Login)
|
||||
|
||||
// 邮箱登录相关(无需登录)
|
||||
appGroup.POST("/user/email/login", app.NewUserHandler().EmailLogin) // 邮箱密码登录
|
||||
appGroup.POST("/user/register", app.NewUserHandler().EmailRegister) // 注册账号
|
||||
appGroup.POST("/user/email/code", app.NewUserHandler().SendEmailCode) // 发送验证码(type=register/login/reset_password)
|
||||
appGroup.POST("/user/email/exists", app.NewUserHandler().CheckEmailExists) // 检查邮箱是否已注册
|
||||
appGroup.POST("/user/reset-password", app.NewUserHandler().ResetPassword) // 重置密码
|
||||
|
||||
appGroup.POST("/captcha/digit", app.NewCaptchaHandler().GenerateDigitCaptcha) // 生成数字验证码
|
||||
appGroup.POST("/captcha/digit/verify", app.NewCaptchaHandler().VerifyDigitCaptcha) // 验证数字验证码
|
||||
|
||||
// 需要登录鉴权
|
||||
auth := appGroup.Group("/")
|
||||
auth.Use(middleware.JWTAuth())
|
||||
{
|
||||
// ===================== 用户 =====================
|
||||
auth.POST("/user/logout", app.NewUserHandler().Logout) // 退出登录
|
||||
auth.POST("/user/info", app.NewUserHandler().UserInfo) // 获取用户信息(预留)
|
||||
auth.POST("/user/edit", app.NewUserHandler().EditUser) // 修改用户信息
|
||||
auth.POST("/user/email/set", app.NewUserHandler().SetEmail) // 设置邮箱(绑定邮箱)
|
||||
auth.POST("/user/change-password", app.NewUserHandler().ChangePassword) // 修改密码(已登录)
|
||||
auth.POST("/user/bind-wechat", app.NewUserHandler().BindWechatMini) // 绑定微信(小程序端,wx.login code)
|
||||
|
||||
auth.POST("/user/config/info", app.NewUserConfigHandler().UserConfigInfo) // 获取用户配置
|
||||
auth.POST("/user/config/edit", app.NewUserConfigHandler().EditUserConfig) // 修改用户配置
|
||||
|
||||
// ===================== 成长等级 =====================
|
||||
auth.POST("/growth/info", app.NewGrowthHandler().GetGrowthInfo)
|
||||
auth.POST("/growth/rules", app.NewGrowthHandler().GetGrowthRules)
|
||||
auth.POST("/growth/achievements", app.NewGrowthHandler().GetAchievements)
|
||||
auth.POST("/growth/add_exp", app.NewGrowthHandler().AddExp)
|
||||
|
||||
// ===================== 待办 =====================
|
||||
auth.POST("/todo/add", app.NewTodoHandler().AddTodo)
|
||||
auth.POST("/todo/list", app.NewTodoHandler().TodoList)
|
||||
auth.POST("/todo/delete", app.NewTodoHandler().DeleteTodo)
|
||||
auth.POST("/todo/done", app.NewTodoHandler().DoneTodo)
|
||||
auth.POST("/todo/edit", app.NewTodoHandler().EditTodo)
|
||||
auth.POST("/todo/stat", app.NewTodoHandler().TodoStat) // 待办统计(新增)
|
||||
|
||||
// ===================== 账单 =====================
|
||||
auth.POST("/bill/add", app.NewBillHandler().AddBill)
|
||||
auth.POST("/bill/edit", app.NewBillHandler().EditBill)
|
||||
auth.POST("/bill/list", app.NewBillHandler().BillList)
|
||||
auth.POST("/bill/delete", app.NewBillHandler().DeleteBill)
|
||||
auth.POST("/bill/stat/month", app.NewBillHandler().MonthStat) // 月度统计(mine.vue使用)
|
||||
auth.POST("/bill/stat/category", app.NewBillHandler().CateStat) // 分类统计
|
||||
auth.POST("/bill/stat/aggregate", app.NewBillHandler().AggregateStat) // 聚合统计(新增)
|
||||
auth.POST("/bill/export", app.NewBillHandler().ExportBill)
|
||||
|
||||
// ===================== 预算 =====================
|
||||
auth.POST("/budget/get", app.NewBudgetHandler().GetBudget) // 获取预算(mine.vue使用)
|
||||
auth.POST("/budget/set", app.NewBudgetHandler().SetBudget) // 设置预算(mine.vue使用)
|
||||
auth.POST("/budget/delete", app.NewBudgetHandler().DeleteBudget)
|
||||
|
||||
// ===================== 分类 =====================
|
||||
auth.POST("/category/list", app.NewCategoryHandler().CategoryList) // 自定义分类(mine.vue使用)
|
||||
auth.POST("/category/add", app.NewCategoryHandler().AddCategory)
|
||||
auth.POST("/category/delete", app.NewCategoryHandler().DeleteCategory)
|
||||
|
||||
// ===================== 心情 =====================
|
||||
auth.POST("/mood/get", app.NewMoodHandler().GetMoodByDate)
|
||||
auth.POST("/mood/save", app.NewMoodHandler().SaveMood)
|
||||
auth.POST("/mood/list", app.NewMoodHandler().GetMoodList)
|
||||
auth.POST("/mood/delete", app.NewMoodHandler().DeleteMood)
|
||||
auth.POST("/mood/stat", app.NewMoodHandler().MoodStat) // 心情统计(新增)
|
||||
|
||||
// ===================== 复盘 =====================
|
||||
auth.POST("/review/save", app.NewReviewHandler().SaveReview) // 保存复盘(新增)
|
||||
auth.POST("/review/get", app.NewReviewHandler().GetReview) // 获取单日复盘(新增)
|
||||
auth.POST("/review/list", app.NewReviewHandler().ReviewList) // 获取复盘列表(新增)
|
||||
auth.POST("/review/delete", app.NewReviewHandler().DeleteReview) // 删除复盘(新增)
|
||||
|
||||
// ===================== 首页聚合 =====================
|
||||
auth.POST("/dashboard/daily", app.NewDashboardHandler().DailyDashboard) // 首页聚合数据(新增)
|
||||
|
||||
// ===================== AI 助手 =====================
|
||||
auth.POST("/ai/mood/analysis", app.NewAIHandler().MoodAnalysis) // 心情分析
|
||||
auth.POST("/ai/mood/weekly", app.NewAIHandler().MoodWeeklySummary) // 心情周报
|
||||
auth.POST("/ai/mood/result", app.NewAIHandler().GetMoodAIResult) // 获取心情AI生成结果
|
||||
auth.POST("/ai/mood/regenerate", app.NewAIHandler().RegenerateMoodAI) // 重新生成心情AI内容
|
||||
auth.POST("/ai/classify", app.NewAIHandler().Classify) // AI 智能分类
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
// routes/api_web.go
|
||||
// Web端API路由
|
||||
package routes
|
||||
|
||||
import (
|
||||
"simple-memo/api/app"
|
||||
"simple-memo/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// registerAPIWebRoutes 注册Web端API路由
|
||||
func registerAPIWebRoutes(r *gin.Engine) {
|
||||
api := r.Group("/api")
|
||||
|
||||
// 网页端接口(不需要加密,直接接收JSON)
|
||||
web := api.Group("/web")
|
||||
web.Use(middleware.Limiter()) // 限流(不加加密中间件)
|
||||
{
|
||||
// 网页端登录相关(无需登录)
|
||||
web.POST("/login", app.NewUserHandler().EmailLogin) // 邮箱登录
|
||||
web.POST("/register", app.NewUserHandler().EmailRegister) // 注册
|
||||
web.POST("/send-code", app.NewUserHandler().SendEmailCode) // 发送邮箱验证码
|
||||
web.POST("/reset-password", app.NewUserHandler().ResetPassword) // 重置密码
|
||||
|
||||
// 验证码接口(无需登录)
|
||||
web.POST("/captcha/digit", app.NewCaptchaHandler().GenerateDigitCaptcha) // 生成数字验证码
|
||||
web.POST("/captcha/digit/verify", app.NewCaptchaHandler().VerifyDigitCaptcha) // 验证数字验证码
|
||||
|
||||
// 成长规则(无需登录,公开页面使用)
|
||||
web.GET("/growth/rules", app.NewGrowthHandler().GetGrowthRules)
|
||||
|
||||
// 常量接口
|
||||
web.POST("/constants/all", app.NewConstantsHandler().GetAllConstants)
|
||||
web.POST("/constants/bill-categories", app.NewConstantsHandler().GetBillCategories)
|
||||
web.POST("/constants/todo-categories", app.NewConstantsHandler().GetTodoCategories)
|
||||
web.POST("/constants/mood-list", app.NewConstantsHandler().GetMoodList)
|
||||
web.POST("/constants/pay-channels", app.NewConstantsHandler().GetPayChannels)
|
||||
|
||||
// 需要登录鉴权的网页端接口
|
||||
webAuth := web.Group("/")
|
||||
webAuth.Use(middleware.JWTAuth())
|
||||
{
|
||||
// 用户信息(GET获取,POST修改)
|
||||
webAuth.GET("/user/info", app.NewUserHandler().UserInfo)
|
||||
webAuth.POST("/user/edit", app.NewUserHandler().EditUser)
|
||||
webAuth.POST("/user/logout", app.NewUserHandler().Logout)
|
||||
webAuth.POST("/user/change-password", app.NewUserHandler().ChangePassword) // 修改密码(已登录)
|
||||
webAuth.POST("/user/bind-wechat", app.NewUserHandler().BindWechat) // 绑定微信(已登录)
|
||||
|
||||
// 日历聚合数据
|
||||
webAuth.POST("/calendar/data", app.NewCalendarHandler().GetCalendarData)
|
||||
|
||||
// 待办
|
||||
webAuth.POST("/todo/add", app.NewTodoHandler().AddTodo)
|
||||
webAuth.POST("/todo/list", app.NewTodoHandler().TodoList)
|
||||
webAuth.POST("/todo/delete", app.NewTodoHandler().DeleteTodo)
|
||||
webAuth.POST("/todo/done", app.NewTodoHandler().DoneTodo)
|
||||
webAuth.POST("/todo/edit", app.NewTodoHandler().EditTodo)
|
||||
|
||||
// 账单
|
||||
webAuth.POST("/bill/add", app.NewBillHandler().AddBill)
|
||||
webAuth.POST("/bill/list", app.NewBillHandler().BillList)
|
||||
webAuth.POST("/bill/edit", app.NewBillHandler().EditBill)
|
||||
webAuth.POST("/bill/delete", app.NewBillHandler().DeleteBill)
|
||||
|
||||
// 心情
|
||||
webAuth.POST("/mood/get", app.NewMoodHandler().GetMoodByDate)
|
||||
webAuth.POST("/mood/save", app.NewMoodHandler().SaveMood)
|
||||
webAuth.POST("/mood/list", app.NewMoodHandler().GetMoodList)
|
||||
webAuth.POST("/mood/delete", app.NewMoodHandler().DeleteMood)
|
||||
|
||||
// 复盘
|
||||
webAuth.POST("/review/save", app.NewReviewHandler().SaveReview)
|
||||
webAuth.POST("/review/get", app.NewReviewHandler().GetReview)
|
||||
webAuth.POST("/review/list", app.NewReviewHandler().ReviewList)
|
||||
webAuth.POST("/review/delete", app.NewReviewHandler().DeleteReview)
|
||||
|
||||
// 成长(GET获取)
|
||||
webAuth.GET("/growth/info", app.NewGrowthHandler().GetGrowthInfo)
|
||||
webAuth.GET("/growth/achievements", app.NewGrowthHandler().GetAchievements)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// routes/pages.go
|
||||
// HTML页面路由
|
||||
package routes
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// registerPageRoutes 注册HTML页面路由
|
||||
func registerPageRoutes(r *gin.Engine) {
|
||||
staticPath := getStaticPath()
|
||||
htmlPath := filepath.Join(staticPath, "html")
|
||||
|
||||
// 公开页面(无需登录)- 普通头部
|
||||
r.StaticFile("/", filepath.Join(htmlPath, "index.html"))
|
||||
r.StaticFile("/login", filepath.Join(htmlPath, "login.html"))
|
||||
r.StaticFile("/about", filepath.Join(htmlPath, "about.html"))
|
||||
r.StaticFile("/agreement", filepath.Join(htmlPath, "agreement.html"))
|
||||
r.StaticFile("/privacy", filepath.Join(htmlPath, "privacy.html"))
|
||||
r.StaticFile("/growth-rules", filepath.Join(htmlPath, "growth-rules.html"))
|
||||
|
||||
// Web端页面路由(需登录)- 工作台头部
|
||||
r.StaticFile("/web/calendar", filepath.Join(htmlPath, "calendar.html"))
|
||||
r.StaticFile("/web/profile", filepath.Join(htmlPath, "profile.html"))
|
||||
r.StaticFile("/web/growth", filepath.Join(htmlPath, "growth.html"))
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// routes/routes.go
|
||||
// 路由注册器 - 统一管理所有路由
|
||||
package routes
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// RegisterRoutes 注册所有路由
|
||||
func RegisterRoutes(r *gin.Engine) {
|
||||
// 注册静态资源路由
|
||||
registerStaticRoutes(r)
|
||||
|
||||
// 注册页面路由
|
||||
registerPageRoutes(r)
|
||||
|
||||
// 注册API路由
|
||||
registerAPIAppRoutes(r)
|
||||
registerAPIWebRoutes(r)
|
||||
|
||||
// 404页面处理 - 所有未匹配的路由都返回404页面
|
||||
r.NoRoute(func(c *gin.Context) {
|
||||
staticPath := getStaticPath()
|
||||
c.File(filepath.Join(staticPath, "html", "404.html"))
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// routes/static.go
|
||||
// 静态资源路由
|
||||
package routes
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// getStaticPath 获取静态资源目录路径
|
||||
func getStaticPath() string {
|
||||
exeDir, _ := os.Getwd()
|
||||
return filepath.Join(exeDir, "..", "static")
|
||||
}
|
||||
|
||||
// registerStaticRoutes 注册静态资源路由
|
||||
func registerStaticRoutes(r *gin.Engine) {
|
||||
staticPath := getStaticPath()
|
||||
|
||||
// 静态资源目录
|
||||
r.Static("/static", staticPath)
|
||||
}
|
||||
Reference in New Issue
Block a user