add checkout verify code

This commit is contained in:
daniel.w 2024-08-26 16:33:28 +08:00
parent 80c8bb63a7
commit 4f06c8038a
4 changed files with 19 additions and 2 deletions

View File

@ -169,6 +169,7 @@ message ListUserInfoResp {
message VerifyAuthResultReq { message VerifyAuthResultReq {
string token = 1; string token = 1;
optional string account = 2;
} }
message VerifyAuthResultResp { message VerifyAuthResultResp {
@ -204,7 +205,11 @@ service Account {
rpc GenerateRefreshCode(GenerateRefreshCodeReq) returns(GenerateRefreshCodeResp); rpc GenerateRefreshCode(GenerateRefreshCodeReq) returns(GenerateRefreshCodeResp);
// VerifyRefreshCode token // VerifyRefreshCode token
rpc VerifyRefreshCode(VerifyRefreshCodeReq) returns(OKResp); rpc VerifyRefreshCode(VerifyRefreshCodeReq) returns(OKResp);
// CheckRefreshCode token )
rpc CheckRefreshCode(VerifyRefreshCodeReq) returns(OKResp);
// VerifyGoogleAuthResult google // VerifyGoogleAuthResult google
rpc VerifyGoogleAuthResult(VerifyAuthResultReq)returns(VerifyAuthResultResp); rpc VerifyGoogleAuthResult(VerifyAuthResultReq)returns(VerifyAuthResultResp);
// VerifyPlatformAuthResult google
rpc VerifyPlatformAuthResult(VerifyAuthResultReq)returns(VerifyAuthResultResp);
} }
// ================ account ================ // ================ account ================

View File

@ -5,7 +5,6 @@ import "time"
const ( const (
DefaultPageSize = 100 DefaultPageSize = 100
DefaultPageIndex = 1 DefaultPageIndex = 1
Scope = 10
) )
const InitAutoId = 10000000 const InitAutoId = 10000000

View File

@ -94,8 +94,20 @@ func (s *AccountServer) VerifyRefreshCode(ctx context.Context, in *member.Verify
return l.VerifyRefreshCode(in) 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 登入是否有效 // VerifyGoogleAuthResult 驗證 google 登入是否有效
func (s *AccountServer) VerifyGoogleAuthResult(ctx context.Context, in *member.VerifyAuthResultReq) (*member.VerifyAuthResultResp, error) { func (s *AccountServer) VerifyGoogleAuthResult(ctx context.Context, in *member.VerifyAuthResultReq) (*member.VerifyAuthResultResp, error) {
l := accountlogic.NewVerifyGoogleAuthResultLogic(ctx, s.svcCtx) l := accountlogic.NewVerifyGoogleAuthResultLogic(ctx, s.svcCtx)
return l.VerifyGoogleAuthResult(in) 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)
}

View File

@ -8,6 +8,7 @@ import (
mgo "app-cloudep-member-server/internal/model/mongo" mgo "app-cloudep-member-server/internal/model/mongo"
"app-cloudep-member-server/internal/usecase" "app-cloudep-member-server/internal/usecase"
ers "code.30cm.net/digimon/library-go/errors" ers "code.30cm.net/digimon/library-go/errors"
"code.30cm.net/digimon/library-go/errors/code"
vi "code.30cm.net/digimon/library-go/validator" vi "code.30cm.net/digimon/library-go/validator"
"fmt" "fmt"
"github.com/zeromicro/go-zero/core/stores/cache" "github.com/zeromicro/go-zero/core/stores/cache"
@ -28,7 +29,7 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext { func NewServiceContext(c config.Config) *ServiceContext {
// 設置 // 設置
ers.Scope = domain.Scope ers.Scope = code.CloudEPMember
// TODO 可優化項目,將連線數量以及 timeout 都便可設定 // TODO 可優化項目,將連線數量以及 timeout 都便可設定
sqlConn := sqlx.NewMysql(c.DB.DsnString) sqlConn := sqlx.NewMysql(c.DB.DsnString)