docs(website): 添加简记memo产品原型和UI设计规范文档

- 新增「简记memo」一体化小程序产品原型设计文档
- 新增简记memo完整版UI视觉设计规范和界面细节
- 添加IDEA项目配置文件.gitignore
- 创建404页面HTML文件,包含响应式布局和错误提示
- 添加关于页面HTML文件,展示品牌介绍和团队信息
- 实现AES加解密工具函数,支持请求体加密
- 添加用户协议页面基础框架
This commit is contained in:
sunct
2026-07-31 14:12:32 +08:00
commit 3c3bf53ae4
115 changed files with 21304 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
package app
import (
"simple-memo/utils"
"github.com/gin-gonic/gin"
"github.com/mojocn/base64Captcha"
)
// CaptchaHandler 验证码接口定义
type CaptchaHandler interface {
GenerateDigitCaptcha(c *gin.Context) // 生成数字验证码
VerifyDigitCaptcha(c *gin.Context) // 验证数字验证码
}
type captchaHandler struct{}
func NewCaptchaHandler() CaptchaHandler {
return &captchaHandler{}
}
// 存储配置(使用内存存储,生产环境建议使用 Redis)
var store = base64Captcha.DefaultMemStore
// GenerateDigitCaptcha 生成数字验证码
func (h *captchaHandler) GenerateDigitCaptcha(c *gin.Context) {
// 配置数字验证码参数
driver := base64Captcha.NewDriverDigit(
80, // 高度
240, // 宽度
4, // 验证码长度
0.7, // 干扰线概率
8, // 干扰线数量
)
captcha := base64Captcha.NewCaptcha(driver, store)
id, b64s, err := captcha.Generate()
if err != nil {
utils.Fail(c, "生成验证码失败")
return
}
utils.Ok(c, gin.H{
"captchaId": id,
"image": b64s,
})
}
// VerifyDigitCaptcha 验证数字验证码
func (h *captchaHandler) VerifyDigitCaptcha(c *gin.Context) {
var req struct {
CaptchaId string `json:"captchaId" binding:"required"`
Answer string `json:"answer" binding:"required"`
}
if err := c.ShouldBindJSON(&req); err != nil {
utils.Fail(c, "参数错误")
return
}
if store.Verify(req.CaptchaId, req.Answer, true) {
utils.Ok(c, "验证通过")
} else {
utils.Fail(c, "验证码错误")
}
}