Commit Graph

496 Commits

Author SHA1 Message Date
peanut 4884099b9b fix: 收藏 toggle 用原生 SQL 绕过逻辑删除,彻底解决重新收藏冲突 2026-07-19 23:59:54 +08:00
peanut c0245d37fb fix: 收藏 toggle 支持重新收藏(修复逻辑删除与 unique key 冲突) 2026-07-19 23:56:41 +08:00
peanut 3666c3d530 fix: 收藏 toggle 增加实体存在性和权限校验(IDOR 修复) 2026-07-19 23:42:53 +08:00
peanut 33b24450db feat: 人生事件和剧本收藏从 localStorage 切换为真实 API
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 23:24:04 +08:00
peanut dd11cfae73 feat: 人生事件和剧本收藏从 localStorage 切换为真实 API
- 后端:新增 t_event_favorite 表(UNIQUE KEY + MyBatis-Plus Entity)
- 后端:LifeEventController 新增 /favorite/toggle、/favorite/page、/favorite/check 三个真实端点
- 后端:EventFavoriteService 完整 CRUD,含 toggle/分页/批量查询/状态检查
- 后端:删除旧的 favorite-placeholder mock 端点
- 前端:life-event/detail.vue 从 localStorage 假收藏切换为真实 API + localStorage 缓存防闪烁
- 前端:ScriptLibraryView.vue 从 localFavorites 切换为 checkFavoriteScript 真实 API
- 前端:stores/app.js 新增 toggleEventFavorite / checkEventFavorite 方法
- 修复:审核发现的 UNIQUE 约束缺失、未使用 watch 导入、Controller 参数注解遗漏、Controller 委托 Service 构造 Response

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 23:23:40 +08:00
peanut a3bfad099a docs: 收藏功能真实 API 化实施计划 2026-07-19 22:25:39 +08:00
peanut bebb7f1667 docs: 收藏功能真实 API 化设计文档 v2(沿用独立收藏表架构) 2026-07-19 22:16:15 +08:00
peanut ce9c9a8dc5 chore: 撤回旧收藏设计文档,改用独立收藏表方案 2026-07-19 22:13:17 +08:00
peanut 10d3c72082 docs: 收藏功能真实 API 化设计文档 2026-07-19 22:07:34 +08:00
peanut 05ea918ee1 feat(script-favorite): update toggleFavorite to use backend API
- Import toggleFavoriteScript from epicScript service
- Change toggleFavorite from sync local-only to async with API call
- Implement optimistic update pattern: update local cache first, then call backend
- Rollback on API failure with error toast
- Preserves localFavorites for offline/fast-render scenarios
2026-07-19 21:51:20 +08:00
peanut 50f1bdba38 feat(script-favorite): add favorite API wrappers to epicScript.js
- toggleFavoriteScript: POST /epicScript/favorite/toggle
- getFavoriteScriptPage: GET /epicScript/favorite/page
- checkFavoriteScript: GET /epicScript/favorite/check
- Added to default export object
2026-07-19 21:48:00 +08:00
peanut 74fa304cd9 feat(script-favorite): add 3 favorite endpoints to EpicScriptController
- POST /epicScript/favorite/toggle: toggle favorite for a script
- GET /epicScript/favorite/page: paginated favorite list
- GET /epicScript/favorite/check: check if script is favorited
- Add ScriptFavoriteToggleRequest, ScriptFavoriteResponse, ScriptFavoriteService imports
- Inject ScriptFavoriteService via @Autowired
2026-07-19 21:43:46 +08:00
peanut 9d352f40a0 feat(script-favorite): add ScriptFavoriteServiceImpl
- toggleFavorite: upsert via logical-delete check + save, @Transactional
- getFavoritePage: paginate favorites then fetch EpicScript details
- getFavoritedScriptIds: batch IN query for checking multiple scripts
- isFavorited: count > 0 check for single script
- getFavoriteCount: total count for current user
- Uses UserContextHolder for userId, consistent with project pattern
2026-07-19 21:41:54 +08:00
peanut 674188f471 feat(script-favorite): add ScriptFavoriteService interface
- toggleFavorite: toggle favorite status for a script
- getFavoritePage: paginated list of user's favorite scripts
- getFavoritedScriptIds: batch check which scripts are favorited
- isFavorited: check single script favorite status
- getFavoriteCount: count user's total favorites
2026-07-19 21:41:28 +08:00
peanut 62ca1730b9 feat(script-favorite): add ScriptFavoriteResponse DTO
- Fields: scriptId, isFavorited, favoriteTime
- Used by toggle/check endpoints to return favorite status
2026-07-19 21:41:14 +08:00
peanut 0d27d1a072 feat(script-favorite): add ScriptFavoriteToggleRequest DTO
- Single field: scriptId with @NotBlank validation
- Uses javax.validation.constraints.NotBlank matching project convention
2026-07-19 21:41:02 +08:00
peanut d74d8b22c6 feat(script-favorite): add ScriptFavoriteMapper
- Extends BaseMapper<ScriptFavorite>
- Standard MyBatis-Plus mapper pattern matching project convention
2026-07-19 21:40:06 +08:00
peanut 489131a04b feat(script-favorite): add ScriptFavorite entity
- Extends BaseEntity for id, createTime, updateTime, isDeleted
- Maps to t_script_favorite table via MyBatis-Plus @TableName
- Fields: userId, scriptId
2026-07-19 21:39:47 +08:00
peanut 43ac037f5b feat(script-favorite): add t_script_favorite migration SQL
- Create t_script_favorite table with user_id, script_id
- Add unique key uk_user_script (user_id, script_id)
- Add indexes idx_user_id and idx_script_id
- Support logical delete via is_deleted flag
2026-07-19 21:39:27 +08:00
peanut b20f30f91b feat(script-favorite): add database migration and backend service
- Add t_script_favorite table migration SQL
- Add ScriptFavorite entity, mapper, service interface and impl
- Add toggle/page/check endpoints in EpicScriptController
- Add toggleFavorite/getFavoritePage/checkFavorite in epicScript.js
- Update ScriptLibraryView with backend-backed toggleFavorite
2026-07-19 21:38:53 +08:00
peanut 7e52bb9ffb fix: .chat-send-btn 设 height:60rpx 与输入框等高 2026-07-19 21:04:50 +08:00
peanut 8a2001af3d docs: Chat 视图发送按钮等高修复设计文档 2026-07-19 21:04:04 +08:00
peanut 35b4f97527 fix: .chat-scroll-content padding-bottom 改回 40rpx 避免与父级 padding 叠加 2026-07-19 20:49:16 +08:00
peanut f5b26c2fc7 refactor: .chat-page 改为 height: 100% 让父级 padding 生效 2026-07-19 20:49:05 +08:00
peanut cb965fadff docs: Chat 视图底部遮挡架构层修复实施计划 2026-07-19 20:46:10 +08:00
peanut cafa8717ab docs: Chat 视图底部遮挡架构层修复设计文档 2026-07-19 20:45:09 +08:00
peanut 283914690a fix: .chat-page 增加 safe-area-inset-bottom + .chat-scroll-content padding-bottom 增至 120rpx 2026-07-19 20:21:41 +08:00
peanut 04ffa2dceb docs: Chat 视图底部内边距修复实施计划 2026-07-19 20:17:26 +08:00
peanut 0a9ea60795 docs: Chat 视图底部内边距修复设计文档 2026-07-19 19:57:57 +08:00
peanut 118d20914d fix: 修复 openScriptChat 设置 viewState='result' 导致页面空白的问题 2026-07-19 19:30:48 +08:00
peanut b194b343ad fix: 修复 mp-weixin 模板箭头函数和 TextDecoder 不兼容
- 微信小程序 wxml 模板不支持内联箭头函数
  @submit 改为方法引用,submitClarification 自己找未提交卡片
- TextDecoder 在 mp-weixin 不可用
  decodeChunk 改用纯 JS UTF-8 解码实现
2026-07-19 19:02:52 +08:00
peanut 7a0e729ab4 fix: chat-page 用 height: 100vh 替代 min-height: 100vh 修复真机滚动
根因:min-height: 100vh 允许容器超出视口增长,破坏 flex 布局,
导致 scroll-view 内部滚动层高度=内容高度(都不滚动)。

参考项目内已工作的 .result-page(height: 100% + min-height: 0)。
H5 实际验证:内容 1779px 滚动到底部后提交按钮 visibleInViewport: true
2026-07-19 18:50:57 +08:00
peanut f07817aaff fix: chat 视图 scroll-view 添加 height: 100% + min-height: 0
参考项目内已工作的 .result-view 模式:
- flex: 1 仅在 flex 布局父容器中生效
- 但 UniApp <scroll-view> 是原生组件,必须显式 height: 100%
- 同时 min-height: 0 确保 flex 子项可收缩

之前只设 flex: 1,真机上原生 scroll-view 无法计算可滚动区域。
2026-07-19 18:32:09 +08:00
peanut 30ecf9f4a3 fix: chat 视图 scroll-view 删除固定 height,改用 flex: 1 自适应真机高度
真机上状态栏/tab 栏/安全区域高度各不相同,
硬编码 calc(100vh - 220rpx) 导致 scroll-view 超出可视区域无法滚动。
2026-07-19 18:07:00 +08:00
peanut f6ef0222b3 fix: 修复 chat 视图无法滚动 + SSE 事件重复消费
- scrollResultToLatest 守卫条件兼容 chat 视图
- shortNovel.js 添加 chunkProcessed 标志位避免 H5 双重消费
2026-07-19 16:04:54 +08:00
peanut e109e59f1a feat(mini-program): sendChat 按 generationPhase 切换接口,消息进统一对话流 2026-07-19 15:24:49 +08:00
peanut e41266e6f4 feat(mini-program): 统一 chat 视图,删除 clarifying/outlining/result 独立视图 2026-07-19 15:21:43 +08:00
peanut b4fca0abfa refactor(mini-program): runGeneration+交互函数改为操作对话消息 2026-07-19 15:15:49 +08:00
peanut 84b6a77632 refactor(mini-program): handleShortNovelEvent 改为对话流追加消息 2026-07-19 15:10:42 +08:00
peanut c0adb48949 refactor(mini-program): 扩展 addResultMessage 消息模型 + 新增 generationPhase 2026-07-19 15:05:27 +08:00
peanut 25d8a9f8f2 docs:ScriptView 统一对话页改造实现计划
6 个任务:扩展消息模型、handleShortNovelEvent 改对话流、
runGeneration+交互函数改造、统一 chat 视图模板、
sendChat 接口切换、端到端浏览器验证
2026-07-19 14:55:27 +08:00
peanut b2df7d4de0 docs:ScriptView 统一对话页改造设计
将澄清/大纲/小说生成从独立视图改为统一对话流消息。
viewState 简化为 home+chat,扩展 resultMessages 消息模型
支持 kind: text/card/outline/novel,novel_done 后切换旧接口
做后续对话修改。
2026-07-19 14:45:45 +08:00
peanut 30e2836742 fix(mini-program): 修复心愿实现页接口报错 + .env 指向生产服务器
根因:.env.development 指向 localhost:19089,但本地未启动后端,
所有 API 请求 ERR_CONNECTION_REFUSED。

切换至 https://lifescript.happylifeos.com/api(生产服务器),
符合 CLAUDE.md 服务器端验收规则。

此修复与 generationDisplayText + 继续会话 一起完成完整心愿实现流程验证。
2026-07-19 14:17:11 +08:00
peanut c1293c28ac fix(mini-program): 修复心愿实现页用户消息不显示 + 支持继续会话
1. runGeneration 补赋值 generationDisplayText,修复用户输入心愿不显示
2. 识别外部服务 DAILY_GENERATION_IN_PROGRESS 错误码,保存 session_id
3. 失败态新增'继续创作'按钮,调用 followup action=retry 恢复中断会话
4. 新增 resumeSession 方法,重置状态后恢复流式生成
2026-07-19 13:58:16 +08:00
peanut d9a061a6bc fix(deploy): 使用 shlex.quote 防止 curl URL 命令注入 2026-07-19 13:27:03 +08:00
peanut e313086d9b fix(deploy): Windows 平台 curl 验证使用 NUL 替代 /dev/null
Windows cmd.exe 不支持 /dev/null(那是 Unix 概念),
导致 curl 写入失败返回 exit code 23,验证误报为'访问异常'。
改为根据 sys.platform 动态选择 null 设备。
2026-07-19 13:25:01 +08:00
peanut 1b566d574c fix(mini-program): ScriptView 模板闭合标签和 setupRecorder H5 兼容性 2026-07-19 12:56:38 +08:00
peanut 0190941df7 fix(mini-program): 短信验证码文案从 888888 改为 123456 2026-07-19 12:39:54 +08:00
peanut 34f443939e feat(mini-program): ScriptView 多阶段状态机改造 2026-07-19 12:39:50 +08:00
peanut b3a2f3a3d3 feat(mini-program): 澄清卡片组件 2026-07-19 12:36:11 +08:00