feat(checkin): P2 一键借鉴打卡功能落地(test-0415 反馈5-2)
最小修改方案,零 DB 表结构变动: 前端 checkin-publish.vue: - onLoad 识别 sourcePostId + sourceType=learn → 调 getCommunityDetail 拉原帖 - 预填 selectedImages / selectedMealType / remark(带「[借鉴自 @xxx]」前缀) - 顶部新增黄色徽章「借鉴自 @xxx」 - handlePublish 提交时透传 sourcePostId 到后端 后端 ToolCheckinServiceImpl.submit: - 检测 data.sourcePostId,若 notes 没有「借鉴自」字样则追加 [借鉴自 post#id] 标记 - 不新增 UserSign 列,引用关系记录在 notes,便于后续查询展示 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -141,6 +141,17 @@ public class ToolCheckinServiceImpl implements ToolCheckinService {
|
||||
if (data.containsKey("notes") && StrUtil.isNotBlank((String) data.get("notes"))) {
|
||||
userSign.setNotes((String) data.get("notes"));
|
||||
}
|
||||
// test-0415 P2 反馈5-2:一键借鉴打卡——若客户端附带 sourcePostId,则在 notes 末尾追加引用标记,
|
||||
// 避免新增 DB 列;同时保证查询/检索时可以通过 notes 正则定位「借鉴自 @xxx」徽章
|
||||
if (data.containsKey("sourcePostId") && ObjectUtil.isNotNull(data.get("sourcePostId"))) {
|
||||
String sourcePostId = data.get("sourcePostId").toString();
|
||||
String existingNotes = userSign.getNotes() == null ? "" : userSign.getNotes();
|
||||
// 如果备注里已经包含「借鉴自」字样(前端已写),不再重复追加;否则补一条标记
|
||||
if (!existingNotes.contains("借鉴自")) {
|
||||
String marker = "[借鉴自 post#" + sourcePostId + "]";
|
||||
userSign.setNotes(StrUtil.isBlank(existingNotes) ? marker : (existingNotes + " " + marker));
|
||||
}
|
||||
}
|
||||
if (data.containsKey("voiceUrl") && StrUtil.isNotBlank((String) data.get("voiceUrl"))) {
|
||||
userSign.setVoiceUrl((String) data.get("voiceUrl"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user