From 4f06c8038afa74b8d7bf15c841e0bf7f5570ad00 Mon Sep 17 00:00:00 2001 From: "daniel.w" Date: Mon, 26 Aug 2024 16:33:28 +0800 Subject: [PATCH] add checkout verify code --- generate/protobuf/member.proto | 5 +++++ internal/domain/const.go | 1 - internal/server/account/account_server.go | 12 ++++++++++++ internal/svc/service_context.go | 3 ++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/generate/protobuf/member.proto b/generate/protobuf/member.proto index 94b372b..a8e8905 100644 --- a/generate/protobuf/member.proto +++ b/generate/protobuf/member.proto @@ -169,6 +169,7 @@ message ListUserInfoResp { message VerifyAuthResultReq { string token = 1; + optional string account = 2; } message VerifyAuthResultResp { @@ -204,7 +205,11 @@ service Account { rpc GenerateRefreshCode(GenerateRefreshCodeReq) returns(GenerateRefreshCodeResp); // VerifyRefreshCode 驗證忘記密碼 token rpc VerifyRefreshCode(VerifyRefreshCodeReq) returns(OKResp); + // CheckRefreshCode 驗證忘記密碼 token 不刪除,只確認) + rpc CheckRefreshCode(VerifyRefreshCodeReq) returns(OKResp); // VerifyGoogleAuthResult 驗證 google 登入是否有效 rpc VerifyGoogleAuthResult(VerifyAuthResultReq)returns(VerifyAuthResultResp); + // VerifyPlatformAuthResult 驗證 google 登入是否有效 + rpc VerifyPlatformAuthResult(VerifyAuthResultReq)returns(VerifyAuthResultResp); } // ================ account ================ \ No newline at end of file diff --git a/internal/domain/const.go b/internal/domain/const.go index e4af3d0..3602f3a 100644 --- a/internal/domain/const.go +++ b/internal/domain/const.go @@ -5,7 +5,6 @@ import "time" const ( DefaultPageSize = 100 DefaultPageIndex = 1 - Scope = 10 ) const InitAutoId = 10000000 diff --git a/internal/server/account/account_server.go b/internal/server/account/account_server.go index 281a47a..d846c21 100644 --- a/internal/server/account/account_server.go +++ b/internal/server/account/account_server.go @@ -94,8 +94,20 @@ func (s *AccountServer) VerifyRefreshCode(ctx context.Context, in *member.Verify return l.VerifyRefreshCode(in) } +// CheckRefreshCode 驗證忘記密碼 token 不刪除,只確認) +func (s *AccountServer) CheckRefreshCode(ctx context.Context, in *member.VerifyRefreshCodeReq) (*member.OKResp, error) { + l := accountlogic.NewCheckRefreshCodeLogic(ctx, s.svcCtx) + return l.CheckRefreshCode(in) +} + // VerifyGoogleAuthResult 驗證 google 登入是否有效 func (s *AccountServer) VerifyGoogleAuthResult(ctx context.Context, in *member.VerifyAuthResultReq) (*member.VerifyAuthResultResp, error) { l := accountlogic.NewVerifyGoogleAuthResultLogic(ctx, s.svcCtx) return l.VerifyGoogleAuthResult(in) } + +// VerifyPlatformAuthResult 驗證 google 登入是否有效 +func (s *AccountServer) VerifyPlatformAuthResult(ctx context.Context, in *member.VerifyAuthResultReq) (*member.VerifyAuthResultResp, error) { + l := accountlogic.NewVerifyPlatformAuthResultLogic(ctx, s.svcCtx) + return l.VerifyPlatformAuthResult(in) +} diff --git a/internal/svc/service_context.go b/internal/svc/service_context.go index 4537cbd..089e7c6 100644 --- a/internal/svc/service_context.go +++ b/internal/svc/service_context.go @@ -8,6 +8,7 @@ import ( mgo "app-cloudep-member-server/internal/model/mongo" "app-cloudep-member-server/internal/usecase" ers "code.30cm.net/digimon/library-go/errors" + "code.30cm.net/digimon/library-go/errors/code" vi "code.30cm.net/digimon/library-go/validator" "fmt" "github.com/zeromicro/go-zero/core/stores/cache" @@ -28,7 +29,7 @@ type ServiceContext struct { func NewServiceContext(c config.Config) *ServiceContext { // 設置 - ers.Scope = domain.Scope + ers.Scope = code.CloudEPMember // TODO 可優化項目,將連線數量以及 timeout 都便可設定 sqlConn := sqlx.NewMysql(c.DB.DsnString)