add checkout verify code

This commit is contained in:
daniel.w 2024-08-26 15:00:29 +08:00
parent 3899ef10d8
commit 4a87e93fd2
2 changed files with 78 additions and 32 deletions

View File

@ -1936,7 +1936,7 @@ var file_generate_protobuf_member_proto_rawDesc = []byte{
0x4c, 0x45, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x45, 0x4c, 0x45, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x45,
0x4d, 0x41, 0x49, 0x4c, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x4d, 0x41, 0x49, 0x4c, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53,
0x5f, 0x50, 0x48, 0x4f, 0x4e, 0x45, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x54, 0x41, 0x54, 0x5f, 0x50, 0x48, 0x4f, 0x4e, 0x45, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x54, 0x41, 0x54,
0x55, 0x53, 0x5f, 0x47, 0x41, 0x10, 0x06, 0x32, 0xd8, 0x07, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x55, 0x53, 0x5f, 0x47, 0x41, 0x10, 0x06, 0x32, 0x9a, 0x08, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x75, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65,
0x72, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65,
0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x55, 0x73, 0x65,
@ -1987,19 +1987,23 @@ var file_generate_protobuf_member_proto_rawDesc = []byte{
0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65,
0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43,
0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e,
0x4f, 0x4b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x53, 0x0a, 0x16, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x4f, 0x4b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x40, 0x0a, 0x10, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52,
0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d,
0x12, 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x62, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73,
0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x68, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65,
0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x75, 0x74, 0x72, 0x2e, 0x4f, 0x4b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x53, 0x0a, 0x16, 0x56, 0x65, 0x72, 0x69,
0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x55, 0x0a, 0x18, 0x56, 0x66, 0x79, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x75,
0x65, 0x72, 0x69, 0x66, 0x79, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x41, 0x75, 0x74, 0x6c, 0x74, 0x12, 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69,
0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x66, 0x79, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x1a,
0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41,
0x74, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x55, 0x0a,
0x72, 0x69, 0x66, 0x79, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x18, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x41,
0x73, 0x70, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x62, 0x06, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x62,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73,
0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e,
0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74,
0x52, 0x65, 0x73, 0x70, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -2077,24 +2081,26 @@ var file_generate_protobuf_member_proto_depIdxs = []int32{
23, // 27: member.Account.ListMember:input_type -> member.ListUserInfoReq 23, // 27: member.Account.ListMember:input_type -> member.ListUserInfoReq
15, // 28: member.Account.GenerateRefreshCode:input_type -> member.GenerateRefreshCodeReq 15, // 28: member.Account.GenerateRefreshCode:input_type -> member.GenerateRefreshCodeReq
18, // 29: member.Account.VerifyRefreshCode:input_type -> member.VerifyRefreshCodeReq 18, // 29: member.Account.VerifyRefreshCode:input_type -> member.VerifyRefreshCodeReq
25, // 30: member.Account.VerifyGoogleAuthResult:input_type -> member.VerifyAuthResultReq 18, // 30: member.Account.CheckRefreshCode:input_type -> member.VerifyRefreshCodeReq
25, // 31: member.Account.VerifyPlatformAuthResult:input_type -> member.VerifyAuthResultReq 25, // 31: member.Account.VerifyGoogleAuthResult:input_type -> member.VerifyAuthResultReq
3, // 32: member.Account.CreateUserAccount:output_type -> member.OKResp 25, // 32: member.Account.VerifyPlatformAuthResult:input_type -> member.VerifyAuthResultReq
10, // 33: member.Account.GetUserAccountInfo:output_type -> member.GetAccountInfoResp 3, // 33: member.Account.CreateUserAccount:output_type -> member.OKResp
3, // 34: member.Account.UpdateUserToken:output_type -> member.OKResp 10, // 34: member.Account.GetUserAccountInfo:output_type -> member.GetAccountInfoResp
13, // 35: member.Account.GetUidByAccount:output_type -> member.GetUidByAccountResp 3, // 35: member.Account.UpdateUserToken:output_type -> member.OKResp
8, // 36: member.Account.BindAccount:output_type -> member.BindingUserResp 13, // 36: member.Account.GetUidByAccount:output_type -> member.GetUidByAccountResp
3, // 37: member.Account.BindUserInfo:output_type -> member.OKResp 8, // 37: member.Account.BindAccount:output_type -> member.BindingUserResp
3, // 38: member.Account.UpdateUserInfo:output_type -> member.OKResp 3, // 38: member.Account.BindUserInfo:output_type -> member.OKResp
3, // 39: member.Account.UpdateStatus:output_type -> member.OKResp 3, // 39: member.Account.UpdateUserInfo:output_type -> member.OKResp
22, // 40: member.Account.GetUserInfo:output_type -> member.GetUserInfoResp 3, // 40: member.Account.UpdateStatus:output_type -> member.OKResp
24, // 41: member.Account.ListMember:output_type -> member.ListUserInfoResp 22, // 41: member.Account.GetUserInfo:output_type -> member.GetUserInfoResp
17, // 42: member.Account.GenerateRefreshCode:output_type -> member.GenerateRefreshCodeResp 24, // 42: member.Account.ListMember:output_type -> member.ListUserInfoResp
3, // 43: member.Account.VerifyRefreshCode:output_type -> member.OKResp 17, // 43: member.Account.GenerateRefreshCode:output_type -> member.GenerateRefreshCodeResp
26, // 44: member.Account.VerifyGoogleAuthResult:output_type -> member.VerifyAuthResultResp 3, // 44: member.Account.VerifyRefreshCode:output_type -> member.OKResp
26, // 45: member.Account.VerifyPlatformAuthResult:output_type -> member.VerifyAuthResultResp 3, // 45: member.Account.CheckRefreshCode:output_type -> member.OKResp
32, // [32:46] is the sub-list for method output_type 26, // 46: member.Account.VerifyGoogleAuthResult:output_type -> member.VerifyAuthResultResp
18, // [18:32] is the sub-list for method input_type 26, // 47: member.Account.VerifyPlatformAuthResult:output_type -> member.VerifyAuthResultResp
33, // [33:48] is the sub-list for method output_type
18, // [18:33] is the sub-list for method input_type
18, // [18:18] is the sub-list for extension type_name 18, // [18:18] is the sub-list for extension type_name
18, // [18:18] is the sub-list for extension extendee 18, // [18:18] is the sub-list for extension extendee
0, // [0:18] is the sub-list for field type_name 0, // [0:18] is the sub-list for field type_name

View File

@ -31,6 +31,7 @@ const (
Account_ListMember_FullMethodName = "/member.Account/ListMember" Account_ListMember_FullMethodName = "/member.Account/ListMember"
Account_GenerateRefreshCode_FullMethodName = "/member.Account/GenerateRefreshCode" Account_GenerateRefreshCode_FullMethodName = "/member.Account/GenerateRefreshCode"
Account_VerifyRefreshCode_FullMethodName = "/member.Account/VerifyRefreshCode" Account_VerifyRefreshCode_FullMethodName = "/member.Account/VerifyRefreshCode"
Account_CheckRefreshCode_FullMethodName = "/member.Account/CheckRefreshCode"
Account_VerifyGoogleAuthResult_FullMethodName = "/member.Account/VerifyGoogleAuthResult" Account_VerifyGoogleAuthResult_FullMethodName = "/member.Account/VerifyGoogleAuthResult"
Account_VerifyPlatformAuthResult_FullMethodName = "/member.Account/VerifyPlatformAuthResult" Account_VerifyPlatformAuthResult_FullMethodName = "/member.Account/VerifyPlatformAuthResult"
) )
@ -63,6 +64,8 @@ type AccountClient interface {
GenerateRefreshCode(ctx context.Context, in *GenerateRefreshCodeReq, opts ...grpc.CallOption) (*GenerateRefreshCodeResp, error) GenerateRefreshCode(ctx context.Context, in *GenerateRefreshCodeReq, opts ...grpc.CallOption) (*GenerateRefreshCodeResp, error)
// VerifyRefreshCode 驗證忘記密碼 token // VerifyRefreshCode 驗證忘記密碼 token
VerifyRefreshCode(ctx context.Context, in *VerifyRefreshCodeReq, opts ...grpc.CallOption) (*OKResp, error) VerifyRefreshCode(ctx context.Context, in *VerifyRefreshCodeReq, opts ...grpc.CallOption) (*OKResp, error)
// CheckRefreshCode 驗證忘記密碼 token 不刪除,只確認)
CheckRefreshCode(ctx context.Context, in *VerifyRefreshCodeReq, opts ...grpc.CallOption) (*OKResp, error)
// VerifyGoogleAuthResult 驗證 google 登入是否有效 // VerifyGoogleAuthResult 驗證 google 登入是否有效
VerifyGoogleAuthResult(ctx context.Context, in *VerifyAuthResultReq, opts ...grpc.CallOption) (*VerifyAuthResultResp, error) VerifyGoogleAuthResult(ctx context.Context, in *VerifyAuthResultReq, opts ...grpc.CallOption) (*VerifyAuthResultResp, error)
// VerifyPlatformAuthResult 驗證 google 登入是否有效 // VerifyPlatformAuthResult 驗證 google 登入是否有效
@ -197,6 +200,16 @@ func (c *accountClient) VerifyRefreshCode(ctx context.Context, in *VerifyRefresh
return out, nil return out, nil
} }
func (c *accountClient) CheckRefreshCode(ctx context.Context, in *VerifyRefreshCodeReq, opts ...grpc.CallOption) (*OKResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(OKResp)
err := c.cc.Invoke(ctx, Account_CheckRefreshCode_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountClient) VerifyGoogleAuthResult(ctx context.Context, in *VerifyAuthResultReq, opts ...grpc.CallOption) (*VerifyAuthResultResp, error) { func (c *accountClient) VerifyGoogleAuthResult(ctx context.Context, in *VerifyAuthResultReq, opts ...grpc.CallOption) (*VerifyAuthResultResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(VerifyAuthResultResp) out := new(VerifyAuthResultResp)
@ -245,6 +258,8 @@ type AccountServer interface {
GenerateRefreshCode(context.Context, *GenerateRefreshCodeReq) (*GenerateRefreshCodeResp, error) GenerateRefreshCode(context.Context, *GenerateRefreshCodeReq) (*GenerateRefreshCodeResp, error)
// VerifyRefreshCode 驗證忘記密碼 token // VerifyRefreshCode 驗證忘記密碼 token
VerifyRefreshCode(context.Context, *VerifyRefreshCodeReq) (*OKResp, error) VerifyRefreshCode(context.Context, *VerifyRefreshCodeReq) (*OKResp, error)
// CheckRefreshCode 驗證忘記密碼 token 不刪除,只確認)
CheckRefreshCode(context.Context, *VerifyRefreshCodeReq) (*OKResp, error)
// VerifyGoogleAuthResult 驗證 google 登入是否有效 // VerifyGoogleAuthResult 驗證 google 登入是否有效
VerifyGoogleAuthResult(context.Context, *VerifyAuthResultReq) (*VerifyAuthResultResp, error) VerifyGoogleAuthResult(context.Context, *VerifyAuthResultReq) (*VerifyAuthResultResp, error)
// VerifyPlatformAuthResult 驗證 google 登入是否有效 // VerifyPlatformAuthResult 驗證 google 登入是否有效
@ -292,6 +307,9 @@ func (UnimplementedAccountServer) GenerateRefreshCode(context.Context, *Generate
func (UnimplementedAccountServer) VerifyRefreshCode(context.Context, *VerifyRefreshCodeReq) (*OKResp, error) { func (UnimplementedAccountServer) VerifyRefreshCode(context.Context, *VerifyRefreshCodeReq) (*OKResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method VerifyRefreshCode not implemented") return nil, status.Errorf(codes.Unimplemented, "method VerifyRefreshCode not implemented")
} }
func (UnimplementedAccountServer) CheckRefreshCode(context.Context, *VerifyRefreshCodeReq) (*OKResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckRefreshCode not implemented")
}
func (UnimplementedAccountServer) VerifyGoogleAuthResult(context.Context, *VerifyAuthResultReq) (*VerifyAuthResultResp, error) { func (UnimplementedAccountServer) VerifyGoogleAuthResult(context.Context, *VerifyAuthResultReq) (*VerifyAuthResultResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method VerifyGoogleAuthResult not implemented") return nil, status.Errorf(codes.Unimplemented, "method VerifyGoogleAuthResult not implemented")
} }
@ -527,6 +545,24 @@ func _Account_VerifyRefreshCode_Handler(srv interface{}, ctx context.Context, de
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Account_CheckRefreshCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VerifyRefreshCodeReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServer).CheckRefreshCode(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Account_CheckRefreshCode_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServer).CheckRefreshCode(ctx, req.(*VerifyRefreshCodeReq))
}
return interceptor(ctx, in, info, handler)
}
func _Account_VerifyGoogleAuthResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Account_VerifyGoogleAuthResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VerifyAuthResultReq) in := new(VerifyAuthResultReq)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -618,6 +654,10 @@ var Account_ServiceDesc = grpc.ServiceDesc{
MethodName: "VerifyRefreshCode", MethodName: "VerifyRefreshCode",
Handler: _Account_VerifyRefreshCode_Handler, Handler: _Account_VerifyRefreshCode_Handler,
}, },
{
MethodName: "CheckRefreshCode",
Handler: _Account_CheckRefreshCode_Handler,
},
{ {
MethodName: "VerifyGoogleAuthResult", MethodName: "VerifyGoogleAuthResult",
Handler: _Account_VerifyGoogleAuthResult_Handler, Handler: _Account_VerifyGoogleAuthResult_Handler,