From 1d8f9e3be41fc5d247411f68a0c7c28fb8638214 Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 8 Oct 2026 20:25:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E7=B3=BB=E7=BB=9F=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=B7=BB=E5=8A=A0=E6=98=8E=E7=A1=AE=E7=9A=84=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E7=BB=93=E6=9E=9C=E6=91=98=E8=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为风险挑战确认和好友申请处理场景添加对应操作结果的中文摘要,替代原有的状态文本,让用户能更清晰地理解系统通知内容。 --- server/db/mysql/tenant_adapter.go | 8 ++++++-- server/im_http.go | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/server/db/mysql/tenant_adapter.go b/server/db/mysql/tenant_adapter.go index a3ec1b0..2214828 100644 --- a/server/db/mysql/tenant_adapter.go +++ b/server/db/mysql/tenant_adapter.go @@ -6887,7 +6887,7 @@ func (a *adapter) TenantFriendRequestAccept(id t.TenantID, requestID string, act eventType := "friend.request." + t.FriendRequestAccepted applicantEventID := t.StableEventID("relation", row.RequestID+":"+t.FriendRequestAccepted, eventType, applicant.UserId()) if err = insertSystemNotificationTx(tx, id, applicant, t.StableEventID(applicantEventID, "notification"), eventType, - "好友申请已处理", t.FriendRequestAccepted, map[string]any{"type": "friend_request", "request_id": row.RequestID, "user_id": actor.UserId(), "topic": topic}); err != nil { + "好友申请已处理", "对方已同意你的好友申请", map[string]any{"type": "friend_request", "request_id": row.RequestID, "user_id": actor.UserId(), "topic": topic}); err != nil { return nil, err } if err = tx.Commit(); err != nil { @@ -6939,8 +6939,12 @@ func (a *adapter) TenantFriendRequestResolve(id t.TenantID, requestID string, ac } eventType := "friend.request." + status eventID := t.StableEventID("relation", req.RequestID+":"+status, eventType, req.ApplicantID.UserId()) + summary := "对方已婉拒你的好友申请" + if status == t.FriendRequestAccepted { + summary = "对方已同意你的好友申请" + } if err = insertSystemNotificationTx(tx, id, req.ApplicantID, t.StableEventID(eventID, "notification"), eventType, - "好友申请已处理", status, map[string]any{"type": "friend_request", "request_id": req.RequestID, "user_id": actor.UserId()}); err != nil { + "好友申请已处理", summary, map[string]any{"type": "friend_request", "request_id": req.RequestID, "user_id": actor.UserId()}); err != nil { return nil, err } if err = tx.Commit(); err != nil { diff --git a/server/im_http.go b/server/im_http.go index c1e42ad..a0bbeb0 100644 --- a/server/im_http.go +++ b/server/im_http.go @@ -1494,8 +1494,12 @@ func serveIMRiskChallengeConfirm(wrt http.ResponseWriter, req *http.Request) { if imReliableHTTPEventsEnabled(req) { eventType := "security.risk." + decision eventID := stableIMEventID("risk", challengeID, decision, challenge.State) + summary := "你已取消本次操作" + if decision == "continue" { + summary = "你已确认继续执行该操作" + } if err = createIMSystemNotification(principal.TenantID, principal.Uid, - stableIMEventID(eventID, "notification"), eventType, "安全操作确认", decision, + stableIMEventID(eventID, "notification"), eventType, "安全操作确认", summary, types.KVMap{"risk_challenge_id": challengeID}); err != nil { writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil) return @@ -6410,11 +6414,13 @@ func serveIMFriendRequestAction(wrt http.ResponseWriter, req *http.Request) { if imReliableHTTPEventsEnabled(req) { eventType := "friend.request." + status action := types.KVMap{} + summary := "对方已婉拒你的好友申请" if status == types.FriendRequestAccepted { action["topic"] = updated.ApplicantID.P2PName(updated.TargetID) + summary = "对方已同意你的好友申请" } if err = publishIMRelationEventWithAction(principal.TenantID, principal.Uid, updated.ApplicantID, - updated.RequestID+":"+status, eventType, "好友申请已处理", status, action); err != nil { + updated.RequestID+":"+status, eventType, "好友申请已处理", summary, action); err != nil { writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil) return }