Skip to content

Commit

Permalink
对接双 token 刷新 (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
flycash authored Mar 26, 2024
1 parent acad751 commit 4a9aa72
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ module github.com/ecodeclub/webook

go 1.21.0

toolchain go1.22.0

require (
github.com/ecodeclub/ecache v0.0.0-20240111145855-75679834beca
github.com/ecodeclub/ekit v0.0.9-0.20240211145635-ea42c17ffeb0
github.com/ecodeclub/ginx v0.0.0-20240314125411-2c593de9a48d
github.com/ecodeclub/ginx v0.0.0-20240326145355-0c3345eabf73
github.com/ecodeclub/mq-api v0.0.0-20231030023724-b3c489cdada2
github.com/ego-component/egorm v1.1.1
github.com/gin-contrib/cors v1.5.0
Expand All @@ -19,7 +17,7 @@ require (
github.com/lithammer/shortuuid/v4 v4.0.0
github.com/redis/go-redis/v9 v9.4.0
github.com/robfig/cron/v3 v3.0.1
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20231121073521-dd65d8941a16
golang.org/x/sync v0.6.0
gorm.io/gorm v1.25.1
Expand Down Expand Up @@ -86,7 +84,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
Expand Down
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ github.com/ecodeclub/ecache v0.0.0-20240111145855-75679834beca h1:qksXJxULYYX+3Z
github.com/ecodeclub/ecache v0.0.0-20240111145855-75679834beca/go.mod h1:faDaVWB0J1EfgyY6e7Z40EWv65Asu4FrtlWVDAOBRiM=
github.com/ecodeclub/ekit v0.0.9-0.20240211145635-ea42c17ffeb0 h1:z10DfuwTEQusqNbUY04KWv1BNpaEniHToLXNU4mGGJ0=
github.com/ecodeclub/ekit v0.0.9-0.20240211145635-ea42c17ffeb0/go.mod h1:rEGubThvxoIQT/qnbVBkZgSvYwgKrY/dtwEWKRTmgeY=
github.com/ecodeclub/ginx v0.0.0-20240314125411-2c593de9a48d h1:p4EwjfMr3r4oyYPMaLZkxlaI4vTF1uBcsEtDzBNex+E=
github.com/ecodeclub/ginx v0.0.0-20240314125411-2c593de9a48d/go.mod h1:PCGcpNNuknwamOKIEkRwfwKngqg4syGydrONSIxb08w=
github.com/ecodeclub/ginx v0.0.0-20240326145355-0c3345eabf73 h1:Tb1rJcAySspgPbP4aRWkaPL5SsCnFX6YXTHj1i8dKtA=
github.com/ecodeclub/ginx v0.0.0-20240326145355-0c3345eabf73/go.mod h1:PCGcpNNuknwamOKIEkRwfwKngqg4syGydrONSIxb08w=
github.com/ecodeclub/mq-api v0.0.0-20231030023724-b3c489cdada2 h1:qTDaGwQeYTEgFCOfDBDC4bkpDYYXvyTDRu8cq316g5Y=
github.com/ecodeclub/mq-api v0.0.0-20231030023724-b3c489cdada2/go.mod h1:mRlnirjJILt4xJ6WaG6XdwNq8HyEVK3v/4bOlIb96ts=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
Expand Down Expand Up @@ -513,8 +513,8 @@ github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI=
github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeBAsoHo=
github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
Expand Down Expand Up @@ -614,8 +614,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
Expand All @@ -625,8 +626,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20231121073521-dd65d8941a16 h1:YaOIyT5tLaIcAUqZhI9vVaKQ1MuYIdouxxFUDkZ8KkM=
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20231121073521-dd65d8941a16/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw=
github.com/tklauser/go-sysconf v0.3.6 h1:oc1sJWvKkmvIxhDHeKWvZS4f6AW+YcoguSfRF2/Hmo4=
Expand Down
3 changes: 2 additions & 1 deletion internal/user/internal/service/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ func (svc *userService) FindOrCreateByWechat(ctx context.Context,
WechatInfo: info,
})
return domain.User{
Id: id,
Id: id,
WechatInfo: info,
}, err
}

Expand Down
5 changes: 3 additions & 2 deletions internal/user/internal/web/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ func (h *Handler) Profile(ctx *ginx.Context, sess session.Session) (ginx.Result,
}
return ginx.Result{
Data: Profile{
Nickname: u.Nickname,
Avatar: u.Avatar,
IsCreator: sess.Claims().Get("creator").StringOrDefault("") == "true",
Nickname: u.Nickname,
Avatar: u.Avatar,
},
}, nil
}
Expand Down

0 comments on commit 4a9aa72

Please sign in to comment.