simple-starter/.workbuddy/memory/2026-11-04.md
2026-11-12 21:21:51 +08:00

12 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2026-11-04
## simple-starter 新增 tianai-captcha 验证码模块
- 新增子模块 `simple-starter-captcha/simple-starter-captcha-tianai`(artifactId `simple-starter-captcha-tianai`),与现有 `-graphic`(easy-captcha)、`-behavior`(AJ-Captcha)并列。
- 依赖 `cloud.tianai.captcha:tianai-captcha:1.5.6` 核心库(**不用官方 springboot-starter**,其基于 Spring Boot 2.2/javax,与项目 SB3 不兼容),`simple-starter-cache-redisson` 为 optional。
- 代码结构:`reliable.simple.starter.captcha.tianai.{autoconfigure, autoconfigure.cache, enums}`;Properties 前缀 `simple-starter.captcha.tianai`(`PropertiesConstants.CAPTCHA_TIANAI` 新增)。
- 热插拔:`enabled` 默认 false,需显式 `simple-starter.captcha.tianai.enabled=true` 才装配,可与 behavior 模块共存互不干扰。
- 缓存:`cache-type = default | redis | custom`;Redis 适配 `TianaiRedisCacheStore`(JSON 字符串存储,规避 Redisson TypedJsonJackson3Codec 反序列化丢失 AnyMap 类型)。
- 版本管理加在 `simple-starter-dependencies`(`tianai-captcha.version`),BOM 增加 artifact。
- 实测结论:`addDefaultTemplate()` 只注册模板不含底图,必须额外 `addResource(type, classpath:META-INF/cut-image/resource/1.jpg)`;内置模板仅覆盖 SLIDER / ROTATE,CONCAT / WORD_IMAGE_CLICK 需自备模板与底图。
- 验证:`mvn -pl ... -am compile` 与全量 `mvn -DskipTests compile` 均通过;冒烟测试 SLIDER、ROTATE 生成成功,错误轨迹校验正常返回失败。