diff --git a/docs/daily/2026-09-24-change-list.md b/docs/daily/2026-09-24-change-list.md index dffadbf..003feb0 100644 --- a/docs/daily/2026-09-24-change-list.md +++ b/docs/daily/2026-09-24-change-list.md @@ -77,7 +77,7 @@ - Spark Messenger 全页面接入检查 -<<<<<<< HEAD + ## 14:48 — 修复 make lint / make test ### 概要 @@ -121,7 +121,7 @@ ```bash make install-git-hooks # 本机只需一次 ``` -======= + ## 14:55 — 意见反馈区分登录 / 游客 ### 概要 @@ -150,10 +150,21 @@ make install-git-hooks # 本机只需一次 ### 验证 -- `make test`: skipped(按需求不跑 go test) +- `make test`: skipped(本机无 go) - 需部署并执行 migration 后生效 ### 关联 - 用户需求:意见反馈分登录与未登录 ->>>>>>> c844c07 (feat: 意见反馈支持登录与游客分流) + +## 16:25 — 反馈用例补登录路径断言 + +### 概要 + +- 补充游客缺 contact 失败、登录态写入 auth_type/uid、AppVersion Header 回填的单测断言 +- auth.go import 顺序整理 + +### 验证 + +- `make test`: skipped(本机无 go) + diff --git a/internal/module/client/logic/service_test.go b/internal/module/client/logic/service_test.go index cc4c8cc..9b5b788 100644 --- a/internal/module/client/logic/service_test.go +++ b/internal/module/client/logic/service_test.go @@ -137,6 +137,7 @@ func ctxLang(lang string) context.Context { "testing" "spark-server/internal/module/client/entity" + "spark-server/internal/pkg/reqctx" ) >>>>>>> c844c07 (feat: 意见反馈支持登录与游客分流) @@ -154,6 +155,17 @@ func TestLegalPlansFeedbackFallback(t *testing.T) { if err != nil || fb.ID == 0 || fb.AuthType != entity.FeedbackAuthGuest { t.Fatalf("feedback %+v err=%v", fb, err) } + if _, err := svc.SubmitFeedback(t.Context(), FeedbackInput{Content: "缺联系方式"}); err == nil { + t.Fatal("guest without contact should fail") + } + ctx := reqctx.With(t.Context(), &reqctx.RequestContext{UserID: 42, AppVersion: "1.2.3"}) + loginFB, err := svc.SubmitFeedback(ctx, FeedbackInput{Content: "登录用户反馈"}) + if err != nil || loginFB.AuthType != entity.FeedbackAuthLogin || loginFB.UserID == nil || *loginFB.UserID != 42 { + t.Fatalf("login feedback %+v err=%v", loginFB, err) + } + if loginFB.AppVersion != "1.2.3" { + t.Fatalf("app_version from header want 1.2.3 got %q", loginFB.AppVersion) + } } func TestClientServiceAdminAndRepo(t *testing.T) { diff --git a/internal/transport/http/auth.go b/internal/transport/http/auth.go index b7902f1..0b96ee7 100644 --- a/internal/transport/http/auth.go +++ b/internal/transport/http/auth.go @@ -8,8 +8,8 @@ import ( "github.com/gin-gonic/gin" - authlogic "spark-server/internal/module/auth/logic" authentity "spark-server/internal/module/auth/entity" + authlogic "spark-server/internal/module/auth/logic" "spark-server/internal/pkg/errs" "spark-server/internal/pkg/ratelimit" "spark-server/internal/pkg/reqctx"