dcsunny 4 anni fa
parent
commit
981a6e09d8
1 ha cambiato i file con 13 aggiunte e 0 eliminazioni
  1. 13 0
      common/context.go

+ 13 - 0
common/context.go

@@ -0,0 +1,13 @@
+package common
+
+import (
+	"context"
+
+	context2 "git.ikuban.com/server/kratos-utils/http/context"
+)
+
+func NewContext(userID int64) context.Context {
+	ctx := context.Background()
+	ctx = context2.AppendToContext(ctx, "user_id", userID)
+	return ctx
+}