fix(chat): 分销站点客服会话按归属租户可见

This commit is contained in:
2026-11-21 14:30:06 +08:00
parent 9d542af51f
commit 2c59085de3
14 changed files with 474 additions and 16 deletions
@@ -1,6 +1,7 @@
package chat
import (
"context"
"encoding/json"
"testing"
"time"
@@ -49,8 +50,9 @@ func TestAdminConversationCountsUsesFreshSnapshot(t *testing.T) {
ctx := tenancy.WithScope(t.Context(), tenancy.Scope{TenantID: 1})
principal := Principal{Type: "admin", ID: admin.ID}
cacheKey := repo.adminChatCountsCacheKey(ctx, principal, adminChatFilterMine, adminChatStageAll, "")
_ = client.Del(context.Background(), cacheKey).Err()
t.Cleanup(func() {
_ = client.Del(t.Context(), cacheKey).Err()
_ = client.Del(context.Background(), cacheKey).Err()
})
first, err := repo.AdminConversationCounts(ctx, principal, adminChatFilterMine, adminChatStageAll, "")