refactor: reorganize modules and add Linux build tooling

This commit is contained in:
2026-08-09 12:41:08 +08:00
parent 86024fa81d
commit 5cc5fd92ed
1461 changed files with 4054 additions and 4724 deletions

View File

@@ -0,0 +1,672 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: account.proto
package passport
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// 获取会员的完整信息
type GetFullReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` // 唯一标识
Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"` // 帐号
Phone string `protobuf:"bytes,3,opt,name=phone,proto3" json:"phone,omitempty"` // 手机号码 必填
Email string `protobuf:"bytes,4,opt,name=email,proto3" json:"email,omitempty"` // 验证码
Rights string `protobuf:"bytes,5,opt,name=rights,proto3" json:"rights,omitempty"` // 权限
Nickname string `protobuf:"bytes,6,opt,name=nickname,proto3" json:"nickname,omitempty"` // 昵称
Avatar string `protobuf:"bytes,7,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像
Birthday string `protobuf:"bytes,8,opt,name=birthday,proto3" json:"birthday,omitempty"` // 生日
Sex int32 `protobuf:"varint,9,opt,name=sex,proto3" json:"sex,omitempty"` // 性别1为男性2为女性
Country string `protobuf:"bytes,10,opt,name=country,proto3" json:"country,omitempty"` // 国家
Province string `protobuf:"bytes,11,opt,name=province,proto3" json:"province,omitempty"` // 省
City string `protobuf:"bytes,12,opt,name=city,proto3" json:"city,omitempty"` // 市
Area string `protobuf:"bytes,13,opt,name=area,proto3" json:"area,omitempty"` // 区
Sign string `protobuf:"bytes,14,opt,name=sign,proto3" json:"sign,omitempty"` // 签名
Cover string `protobuf:"bytes,15,opt,name=cover,proto3" json:"cover,omitempty"` // 背景&封面
Score int32 `protobuf:"varint,16,opt,name=score,proto3" json:"score,omitempty"` // 积分
Level int32 `protobuf:"varint,17,opt,name=level,proto3" json:"level,omitempty"` // 等级
VerifyStatus *VerifyStatus `protobuf:"bytes,18,opt,name=verify_status,json=verifyStatus,proto3" json:"verify_status,omitempty"` // 用户验证状态
Tags []*TagItem `protobuf:"bytes,19,rep,name=tags,proto3" json:"tags,omitempty"` // 用户标签
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetFullReply) Reset() {
*x = GetFullReply{}
mi := &file_account_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetFullReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetFullReply) ProtoMessage() {}
func (x *GetFullReply) ProtoReflect() protoreflect.Message {
mi := &file_account_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetFullReply.ProtoReflect.Descriptor instead.
func (*GetFullReply) Descriptor() ([]byte, []int) {
return file_account_proto_rawDescGZIP(), []int{0}
}
func (x *GetFullReply) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *GetFullReply) GetAccount() string {
if x != nil {
return x.Account
}
return ""
}
func (x *GetFullReply) GetPhone() string {
if x != nil {
return x.Phone
}
return ""
}
func (x *GetFullReply) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *GetFullReply) GetRights() string {
if x != nil {
return x.Rights
}
return ""
}
func (x *GetFullReply) GetNickname() string {
if x != nil {
return x.Nickname
}
return ""
}
func (x *GetFullReply) GetAvatar() string {
if x != nil {
return x.Avatar
}
return ""
}
func (x *GetFullReply) GetBirthday() string {
if x != nil {
return x.Birthday
}
return ""
}
func (x *GetFullReply) GetSex() int32 {
if x != nil {
return x.Sex
}
return 0
}
func (x *GetFullReply) GetCountry() string {
if x != nil {
return x.Country
}
return ""
}
func (x *GetFullReply) GetProvince() string {
if x != nil {
return x.Province
}
return ""
}
func (x *GetFullReply) GetCity() string {
if x != nil {
return x.City
}
return ""
}
func (x *GetFullReply) GetArea() string {
if x != nil {
return x.Area
}
return ""
}
func (x *GetFullReply) GetSign() string {
if x != nil {
return x.Sign
}
return ""
}
func (x *GetFullReply) GetCover() string {
if x != nil {
return x.Cover
}
return ""
}
func (x *GetFullReply) GetScore() int32 {
if x != nil {
return x.Score
}
return 0
}
func (x *GetFullReply) GetLevel() int32 {
if x != nil {
return x.Level
}
return 0
}
func (x *GetFullReply) GetVerifyStatus() *VerifyStatus {
if x != nil {
return x.VerifyStatus
}
return nil
}
func (x *GetFullReply) GetTags() []*TagItem {
if x != nil {
return x.Tags
}
return nil
}
type TagItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Icon string `protobuf:"bytes,2,opt,name=icon,proto3" json:"icon,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TagItem) Reset() {
*x = TagItem{}
mi := &file_account_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TagItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TagItem) ProtoMessage() {}
func (x *TagItem) ProtoReflect() protoreflect.Message {
mi := &file_account_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TagItem.ProtoReflect.Descriptor instead.
func (*TagItem) Descriptor() ([]byte, []int) {
return file_account_proto_rawDescGZIP(), []int{1}
}
func (x *TagItem) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *TagItem) GetIcon() string {
if x != nil {
return x.Icon
}
return ""
}
type SetDataRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Nickname string `protobuf:"bytes,1,opt,name=nickname,proto3" json:"nickname,omitempty"` //昵称
Avatar string `protobuf:"bytes,2,opt,name=avatar,proto3" json:"avatar,omitempty"` //头像
Birthday string `protobuf:"bytes,3,opt,name=birthday,proto3" json:"birthday,omitempty"` //生日
Sex int32 `protobuf:"varint,4,opt,name=sex,proto3" json:"sex,omitempty"` //性别1为男性2为女性
Country string `protobuf:"bytes,5,opt,name=country,proto3" json:"country,omitempty"` // 国家
Province string `protobuf:"bytes,6,opt,name=province,proto3" json:"province,omitempty"` //省
City string `protobuf:"bytes,7,opt,name=city,proto3" json:"city,omitempty"` //市
Area string `protobuf:"bytes,8,opt,name=area,proto3" json:"area,omitempty"` //区
Sign string `protobuf:"bytes,9,opt,name=sign,proto3" json:"sign,omitempty"` //签名
Cover string `protobuf:"bytes,10,opt,name=cover,proto3" json:"cover,omitempty"` // 背景&封面
Score int32 `protobuf:"varint,11,opt,name=score,proto3" json:"score,omitempty"` // 积分
Level int32 `protobuf:"varint,12,opt,name=level,proto3" json:"level,omitempty"` // 等级
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SetDataRequest) Reset() {
*x = SetDataRequest{}
mi := &file_account_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SetDataRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SetDataRequest) ProtoMessage() {}
func (x *SetDataRequest) ProtoReflect() protoreflect.Message {
mi := &file_account_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SetDataRequest.ProtoReflect.Descriptor instead.
func (*SetDataRequest) Descriptor() ([]byte, []int) {
return file_account_proto_rawDescGZIP(), []int{2}
}
func (x *SetDataRequest) GetNickname() string {
if x != nil {
return x.Nickname
}
return ""
}
func (x *SetDataRequest) GetAvatar() string {
if x != nil {
return x.Avatar
}
return ""
}
func (x *SetDataRequest) GetBirthday() string {
if x != nil {
return x.Birthday
}
return ""
}
func (x *SetDataRequest) GetSex() int32 {
if x != nil {
return x.Sex
}
return 0
}
func (x *SetDataRequest) GetCountry() string {
if x != nil {
return x.Country
}
return ""
}
func (x *SetDataRequest) GetProvince() string {
if x != nil {
return x.Province
}
return ""
}
func (x *SetDataRequest) GetCity() string {
if x != nil {
return x.City
}
return ""
}
func (x *SetDataRequest) GetArea() string {
if x != nil {
return x.Area
}
return ""
}
func (x *SetDataRequest) GetSign() string {
if x != nil {
return x.Sign
}
return ""
}
func (x *SetDataRequest) GetCover() string {
if x != nil {
return x.Cover
}
return ""
}
func (x *SetDataRequest) GetScore() int32 {
if x != nil {
return x.Score
}
return 0
}
func (x *SetDataRequest) GetLevel() int32 {
if x != nil {
return x.Level
}
return 0
}
type SetPasswordRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
OldPassword string `protobuf:"bytes,3,opt,name=old_password,json=oldPassword,proto3" json:"old_password,omitempty"` // 旧密码
NewPassword string `protobuf:"bytes,4,opt,name=new_password,json=newPassword,proto3" json:"new_password,omitempty"` // 新密码
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SetPasswordRequest) Reset() {
*x = SetPasswordRequest{}
mi := &file_account_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SetPasswordRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SetPasswordRequest) ProtoMessage() {}
func (x *SetPasswordRequest) ProtoReflect() protoreflect.Message {
mi := &file_account_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SetPasswordRequest.ProtoReflect.Descriptor instead.
func (*SetPasswordRequest) Descriptor() ([]byte, []int) {
return file_account_proto_rawDescGZIP(), []int{3}
}
func (x *SetPasswordRequest) GetOldPassword() string {
if x != nil {
return x.OldPassword
}
return ""
}
func (x *SetPasswordRequest) GetNewPassword() string {
if x != nil {
return x.NewPassword
}
return ""
}
type StatisticsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Field []string `protobuf:"bytes,1,rep,name=field,proto3" json:"field,omitempty"` //要获取的统计数据字段。
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StatisticsRequest) Reset() {
*x = StatisticsRequest{}
mi := &file_account_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StatisticsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatisticsRequest) ProtoMessage() {}
func (x *StatisticsRequest) ProtoReflect() protoreflect.Message {
mi := &file_account_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StatisticsRequest.ProtoReflect.Descriptor instead.
func (*StatisticsRequest) Descriptor() ([]byte, []int) {
return file_account_proto_rawDescGZIP(), []int{4}
}
func (x *StatisticsRequest) GetField() []string {
if x != nil {
return x.Field
}
return nil
}
type StatisticsReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Data map[string]int64 `protobuf:"bytes,1,rep,name=Data,proto3" json:"Data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` //数据以Map格式输出
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StatisticsReply) Reset() {
*x = StatisticsReply{}
mi := &file_account_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StatisticsReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatisticsReply) ProtoMessage() {}
func (x *StatisticsReply) ProtoReflect() protoreflect.Message {
mi := &file_account_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StatisticsReply.ProtoReflect.Descriptor instead.
func (*StatisticsReply) Descriptor() ([]byte, []int) {
return file_account_proto_rawDescGZIP(), []int{5}
}
func (x *StatisticsReply) GetData() map[string]int64 {
if x != nil {
return x.Data
}
return nil
}
var File_account_proto protoreflect.FileDescriptor
const file_account_proto_rawDesc = "" +
"\n" +
"\x1bbase/passport/account.proto\x12\bpassport\x1a\x15passport/blocks.proto\"\x82\x04\n" +
"\fGetFullReply\x12\x1a\n" +
"\bidentity\x18\x01 \x01(\tR\bidentity\x12\x18\n" +
"\aaccount\x18\x02 \x01(\tR\aaccount\x12\x14\n" +
"\x05phone\x18\x03 \x01(\tR\x05phone\x12\x14\n" +
"\x05email\x18\x04 \x01(\tR\x05email\x12\x16\n" +
"\x06rights\x18\x05 \x01(\tR\x06rights\x12\x1a\n" +
"\bnickname\x18\x06 \x01(\tR\bnickname\x12\x16\n" +
"\x06avatar\x18\a \x01(\tR\x06avatar\x12\x1a\n" +
"\bbirthday\x18\b \x01(\tR\bbirthday\x12\x10\n" +
"\x03sex\x18\t \x01(\x05R\x03sex\x12\x18\n" +
"\acountry\x18\n" +
" \x01(\tR\acountry\x12\x1a\n" +
"\bprovince\x18\v \x01(\tR\bprovince\x12\x12\n" +
"\x04city\x18\f \x01(\tR\x04city\x12\x12\n" +
"\x04area\x18\r \x01(\tR\x04area\x12\x12\n" +
"\x04sign\x18\x0e \x01(\tR\x04sign\x12\x14\n" +
"\x05cover\x18\x0f \x01(\tR\x05cover\x12\x14\n" +
"\x05score\x18\x10 \x01(\x05R\x05score\x12\x14\n" +
"\x05level\x18\x11 \x01(\x05R\x05level\x12;\n" +
"\rverify_status\x18\x12 \x01(\v2\x16.passport.VerifyStatusR\fverifyStatus\x12%\n" +
"\x04tags\x18\x13 \x03(\v2\x11.passport.TagItemR\x04tags\"1\n" +
"\aTagItem\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +
"\x04icon\x18\x02 \x01(\tR\x04icon\"\xa6\x02\n" +
"\x0eSetDataRequest\x12\x1a\n" +
"\bnickname\x18\x01 \x01(\tR\bnickname\x12\x16\n" +
"\x06avatar\x18\x02 \x01(\tR\x06avatar\x12\x1a\n" +
"\bbirthday\x18\x03 \x01(\tR\bbirthday\x12\x10\n" +
"\x03sex\x18\x04 \x01(\x05R\x03sex\x12\x18\n" +
"\acountry\x18\x05 \x01(\tR\acountry\x12\x1a\n" +
"\bprovince\x18\x06 \x01(\tR\bprovince\x12\x12\n" +
"\x04city\x18\a \x01(\tR\x04city\x12\x12\n" +
"\x04area\x18\b \x01(\tR\x04area\x12\x12\n" +
"\x04sign\x18\t \x01(\tR\x04sign\x12\x14\n" +
"\x05cover\x18\n" +
" \x01(\tR\x05cover\x12\x14\n" +
"\x05score\x18\v \x01(\x05R\x05score\x12\x14\n" +
"\x05level\x18\f \x01(\x05R\x05level\"Z\n" +
"\x12SetPasswordRequest\x12!\n" +
"\fold_password\x18\x03 \x01(\tR\voldPassword\x12!\n" +
"\fnew_password\x18\x04 \x01(\tR\vnewPassword\")\n" +
"\x11StatisticsRequest\x12\x14\n" +
"\x05field\x18\x01 \x03(\tR\x05field\"\x83\x01\n" +
"\x0fStatisticsReply\x127\n" +
"\x04Data\x18\x01 \x03(\v2#.passport.StatisticsReply.DataEntryR\x04Data\x1a7\n" +
"\tDataEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\x03R\x05value:\x028\x012\xfe\x02\n" +
"\aAccount\x120\n" +
"\x03Get\x12\x0f.passport.Empty\x1a\x16.passport.GetFullReply\"\x00\x12<\n" +
"\aSetData\x12\x18.passport.SetDataRequest\x1a\x15.passport.StatusReply\"\x00\x12D\n" +
"\vSetPassword\x12\x1c.passport.SetPasswordRequest\x1a\x15.passport.StatusReply\"\x00\x127\n" +
"\tTagCreate\x12\x11.passport.TagItem\x1a\x15.passport.StatusReply\"\x00\x12<\n" +
"\tTagRemove\x12\x16.passport.IdentRequest\x1a\x15.passport.StatusReply\"\x00\x12F\n" +
"\n" +
"Statistics\x12\x1b.passport.StatisticsRequest\x1a\x19.passport.StatisticsReply\"\x00B\fZ\n" +
".;passportb\x06proto3"
var (
file_account_proto_rawDescOnce sync.Once
file_account_proto_rawDescData []byte
)
func file_account_proto_rawDescGZIP() []byte {
file_account_proto_rawDescOnce.Do(func() {
file_account_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_account_proto_rawDesc), len(file_account_proto_rawDesc)))
})
return file_account_proto_rawDescData
}
var file_account_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_account_proto_goTypes = []any{
(*GetFullReply)(nil), // 0: passport.GetFullReply
(*TagItem)(nil), // 1: passport.TagItem
(*SetDataRequest)(nil), // 2: passport.SetDataRequest
(*SetPasswordRequest)(nil), // 3: passport.SetPasswordRequest
(*StatisticsRequest)(nil), // 4: passport.StatisticsRequest
(*StatisticsReply)(nil), // 5: passport.StatisticsReply
nil, // 6: passport.StatisticsReply.DataEntry
(*VerifyStatus)(nil), // 7: passport.VerifyStatus
(*Empty)(nil), // 8: passport.Empty
(*IdentRequest)(nil), // 9: passport.IdentRequest
(*StatusReply)(nil), // 10: passport.StatusReply
}
var file_account_proto_depIdxs = []int32{
7, // 0: passport.GetFullReply.verify_status:type_name -> passport.VerifyStatus
1, // 1: passport.GetFullReply.tags:type_name -> passport.TagItem
6, // 2: passport.StatisticsReply.Data:type_name -> passport.StatisticsReply.DataEntry
8, // 3: passport.Account.Get:input_type -> passport.Empty
2, // 4: passport.Account.SetData:input_type -> passport.SetDataRequest
3, // 5: passport.Account.SetPassword:input_type -> passport.SetPasswordRequest
1, // 6: passport.Account.TagCreate:input_type -> passport.TagItem
9, // 7: passport.Account.TagRemove:input_type -> passport.IdentRequest
4, // 8: passport.Account.Statistics:input_type -> passport.StatisticsRequest
0, // 9: passport.Account.Get:output_type -> passport.GetFullReply
10, // 10: passport.Account.SetData:output_type -> passport.StatusReply
10, // 11: passport.Account.SetPassword:output_type -> passport.StatusReply
10, // 12: passport.Account.TagCreate:output_type -> passport.StatusReply
10, // 13: passport.Account.TagRemove:output_type -> passport.StatusReply
5, // 14: passport.Account.Statistics:output_type -> passport.StatisticsReply
9, // [9:15] is the sub-list for method output_type
3, // [3:9] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_account_proto_init() }
func file_account_proto_init() {
if File_account_proto != nil {
return
}
file_blocks_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_account_proto_rawDesc), len(file_account_proto_rawDesc)),
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_account_proto_goTypes,
DependencyIndexes: file_account_proto_depIdxs,
MessageInfos: file_account_proto_msgTypes,
}.Build()
File_account_proto = out.File
file_account_proto_goTypes = nil
file_account_proto_depIdxs = nil
}

View File

@@ -0,0 +1,487 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: account.proto
/*
Package passport is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package passport
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Account_Get_0(ctx context.Context, marshaler runtime.Marshaler, client AccountClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Get(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Account_Get_0(ctx context.Context, marshaler runtime.Marshaler, server AccountServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Get(ctx, &protoReq)
return msg, metadata, err
}
func request_Account_SetData_0(ctx context.Context, marshaler runtime.Marshaler, client AccountClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SetDataRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.SetData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Account_SetData_0(ctx context.Context, marshaler runtime.Marshaler, server AccountServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SetDataRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.SetData(ctx, &protoReq)
return msg, metadata, err
}
func request_Account_SetPassword_0(ctx context.Context, marshaler runtime.Marshaler, client AccountClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SetPasswordRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.SetPassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Account_SetPassword_0(ctx context.Context, marshaler runtime.Marshaler, server AccountServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SetPasswordRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.SetPassword(ctx, &protoReq)
return msg, metadata, err
}
func request_Account_TagCreate_0(ctx context.Context, marshaler runtime.Marshaler, client AccountClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq TagItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.TagCreate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Account_TagCreate_0(ctx context.Context, marshaler runtime.Marshaler, server AccountServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq TagItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.TagCreate(ctx, &protoReq)
return msg, metadata, err
}
func request_Account_TagRemove_0(ctx context.Context, marshaler runtime.Marshaler, client AccountClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.TagRemove(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Account_TagRemove_0(ctx context.Context, marshaler runtime.Marshaler, server AccountServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.TagRemove(ctx, &protoReq)
return msg, metadata, err
}
func request_Account_Statistics_0(ctx context.Context, marshaler runtime.Marshaler, client AccountClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq StatisticsRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Statistics(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Account_Statistics_0(ctx context.Context, marshaler runtime.Marshaler, server AccountServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq StatisticsRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Statistics(ctx, &protoReq)
return msg, metadata, err
}
// RegisterAccountHandlerServer registers the http handlers for service Account to "mux".
// UnaryRPC :call AccountServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAccountHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterAccountHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServer) error {
mux.Handle(http.MethodPost, pattern_Account_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Account/Get", runtime.WithHTTPPathPattern("/passport.Account/Get"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Account_Get_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_Get_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Account_SetData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Account/SetData", runtime.WithHTTPPathPattern("/passport.Account/SetData"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Account_SetData_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_SetData_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Account_SetPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Account/SetPassword", runtime.WithHTTPPathPattern("/passport.Account/SetPassword"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Account_SetPassword_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_SetPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Account_TagCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Account/TagCreate", runtime.WithHTTPPathPattern("/passport.Account/TagCreate"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Account_TagCreate_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_TagCreate_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Account_TagRemove_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Account/TagRemove", runtime.WithHTTPPathPattern("/passport.Account/TagRemove"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Account_TagRemove_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_TagRemove_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Account_Statistics_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Account/Statistics", runtime.WithHTTPPathPattern("/passport.Account/Statistics"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Account_Statistics_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_Statistics_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterAccountHandlerFromEndpoint is same as RegisterAccountHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAccountHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterAccountHandler(ctx, mux, conn)
}
// RegisterAccountHandler registers the http handlers for service Account to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterAccountHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterAccountHandlerClient(ctx, mux, NewAccountClient(conn))
}
// RegisterAccountHandlerClient registers the http handlers for service Account
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AccountClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AccountClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "AccountClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterAccountHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountClient) error {
mux.Handle(http.MethodPost, pattern_Account_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Account/Get", runtime.WithHTTPPathPattern("/passport.Account/Get"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Account_Get_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_Get_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Account_SetData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Account/SetData", runtime.WithHTTPPathPattern("/passport.Account/SetData"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Account_SetData_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_SetData_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Account_SetPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Account/SetPassword", runtime.WithHTTPPathPattern("/passport.Account/SetPassword"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Account_SetPassword_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_SetPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Account_TagCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Account/TagCreate", runtime.WithHTTPPathPattern("/passport.Account/TagCreate"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Account_TagCreate_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_TagCreate_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Account_TagRemove_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Account/TagRemove", runtime.WithHTTPPathPattern("/passport.Account/TagRemove"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Account_TagRemove_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_TagRemove_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Account_Statistics_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Account/Statistics", runtime.WithHTTPPathPattern("/passport.Account/Statistics"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Account_Statistics_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Account_Statistics_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Account_Get_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Account", "Get"}, ""))
pattern_Account_SetData_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Account", "SetData"}, ""))
pattern_Account_SetPassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Account", "SetPassword"}, ""))
pattern_Account_TagCreate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Account", "TagCreate"}, ""))
pattern_Account_TagRemove_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Account", "TagRemove"}, ""))
pattern_Account_Statistics_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Account", "Statistics"}, ""))
)
var (
forward_Account_Get_0 = runtime.ForwardResponseMessage
forward_Account_SetData_0 = runtime.ForwardResponseMessage
forward_Account_SetPassword_0 = runtime.ForwardResponseMessage
forward_Account_TagCreate_0 = runtime.ForwardResponseMessage
forward_Account_TagRemove_0 = runtime.ForwardResponseMessage
forward_Account_Statistics_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,327 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: account.proto
package passport
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Account_Get_FullMethodName = "/passport.Account/Get"
Account_SetData_FullMethodName = "/passport.Account/SetData"
Account_SetPassword_FullMethodName = "/passport.Account/SetPassword"
Account_TagCreate_FullMethodName = "/passport.Account/TagCreate"
Account_TagRemove_FullMethodName = "/passport.Account/TagRemove"
Account_Statistics_FullMethodName = "/passport.Account/Statistics"
)
// AccountClient is the client API for Account service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// assport通行证模块-帐号数据
type AccountClient interface {
// 通过会员所有信息
Get(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetFullReply, error)
// 更新会员的信息数据,字段值为空或是0将不更新此数据
SetData(ctx context.Context, in *SetDataRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 更新会员的密码
SetPassword(ctx context.Context, in *SetPasswordRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 新增标签
TagCreate(ctx context.Context, in *TagItem, opts ...grpc.CallOption) (*StatusReply, error)
// 删除标签
TagRemove(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 获取会员的相关统计数据
Statistics(ctx context.Context, in *StatisticsRequest, opts ...grpc.CallOption) (*StatisticsReply, error)
}
type accountClient struct {
cc grpc.ClientConnInterface
}
func NewAccountClient(cc grpc.ClientConnInterface) AccountClient {
return &accountClient{cc}
}
func (c *accountClient) Get(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetFullReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetFullReply)
err := c.cc.Invoke(ctx, Account_Get_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountClient) SetData(ctx context.Context, in *SetDataRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Account_SetData_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountClient) SetPassword(ctx context.Context, in *SetPasswordRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Account_SetPassword_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountClient) TagCreate(ctx context.Context, in *TagItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Account_TagCreate_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountClient) TagRemove(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Account_TagRemove_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountClient) Statistics(ctx context.Context, in *StatisticsRequest, opts ...grpc.CallOption) (*StatisticsReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatisticsReply)
err := c.cc.Invoke(ctx, Account_Statistics_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AccountServer is the server API for Account service.
// All implementations must embed UnimplementedAccountServer
// for forward compatibility.
//
// assport通行证模块-帐号数据
type AccountServer interface {
// 通过会员所有信息
Get(context.Context, *Empty) (*GetFullReply, error)
// 更新会员的信息数据,字段值为空或是0将不更新此数据
SetData(context.Context, *SetDataRequest) (*StatusReply, error)
// 更新会员的密码
SetPassword(context.Context, *SetPasswordRequest) (*StatusReply, error)
// 新增标签
TagCreate(context.Context, *TagItem) (*StatusReply, error)
// 删除标签
TagRemove(context.Context, *IdentRequest) (*StatusReply, error)
// 获取会员的相关统计数据
Statistics(context.Context, *StatisticsRequest) (*StatisticsReply, error)
mustEmbedUnimplementedAccountServer()
}
// UnimplementedAccountServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAccountServer struct{}
func (UnimplementedAccountServer) Get(context.Context, *Empty) (*GetFullReply, error) {
return nil, status.Error(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedAccountServer) SetData(context.Context, *SetDataRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method SetData not implemented")
}
func (UnimplementedAccountServer) SetPassword(context.Context, *SetPasswordRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method SetPassword not implemented")
}
func (UnimplementedAccountServer) TagCreate(context.Context, *TagItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method TagCreate not implemented")
}
func (UnimplementedAccountServer) TagRemove(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method TagRemove not implemented")
}
func (UnimplementedAccountServer) Statistics(context.Context, *StatisticsRequest) (*StatisticsReply, error) {
return nil, status.Error(codes.Unimplemented, "method Statistics not implemented")
}
func (UnimplementedAccountServer) mustEmbedUnimplementedAccountServer() {}
func (UnimplementedAccountServer) testEmbeddedByValue() {}
// UnsafeAccountServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AccountServer will
// result in compilation errors.
type UnsafeAccountServer interface {
mustEmbedUnimplementedAccountServer()
}
func RegisterAccountServer(s grpc.ServiceRegistrar, srv AccountServer) {
// If the following call panics, it indicates UnimplementedAccountServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Account_ServiceDesc, srv)
}
func _Account_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServer).Get(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Account_Get_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServer).Get(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
func _Account_SetData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetDataRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServer).SetData(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Account_SetData_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServer).SetData(ctx, req.(*SetDataRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Account_SetPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetPasswordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServer).SetPassword(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Account_SetPassword_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServer).SetPassword(ctx, req.(*SetPasswordRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Account_TagCreate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TagItem)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServer).TagCreate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Account_TagCreate_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServer).TagCreate(ctx, req.(*TagItem))
}
return interceptor(ctx, in, info, handler)
}
func _Account_TagRemove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServer).TagRemove(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Account_TagRemove_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServer).TagRemove(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Account_Statistics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatisticsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServer).Statistics(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Account_Statistics_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServer).Statistics(ctx, req.(*StatisticsRequest))
}
return interceptor(ctx, in, info, handler)
}
// Account_ServiceDesc is the grpc.ServiceDesc for Account service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Account_ServiceDesc = grpc.ServiceDesc{
ServiceName: "passport.Account",
HandlerType: (*AccountServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Get",
Handler: _Account_Get_Handler,
},
{
MethodName: "SetData",
Handler: _Account_SetData_Handler,
},
{
MethodName: "SetPassword",
Handler: _Account_SetPassword_Handler,
},
{
MethodName: "TagCreate",
Handler: _Account_TagCreate_Handler,
},
{
MethodName: "TagRemove",
Handler: _Account_TagRemove_Handler,
},
{
MethodName: "Statistics",
Handler: _Account_Statistics_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "account.proto",
}

View File

@@ -0,0 +1,493 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: blocks.proto
package passport
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type FetchRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
PageNo int64 `protobuf:"varint,1,opt,name=page_no,json=pageNo,proto3" json:"page_no,omitempty"` // 页数
PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // 每页记录数
Params map[string]string `protobuf:"bytes,3,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // 条件参数,key=val,eg key:category_id=?,vlaue=11
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *FetchRequest) Reset() {
*x = FetchRequest{}
mi := &file_blocks_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *FetchRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FetchRequest) ProtoMessage() {}
func (x *FetchRequest) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FetchRequest.ProtoReflect.Descriptor instead.
func (*FetchRequest) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{0}
}
func (x *FetchRequest) GetPageNo() int64 {
if x != nil {
return x.PageNo
}
return 0
}
func (x *FetchRequest) GetPageSize() int64 {
if x != nil {
return x.PageSize
}
return 0
}
func (x *FetchRequest) GetParams() map[string]string {
if x != nil {
return x.Params
}
return nil
}
type IdentRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 唯一ID
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` // 唯一码
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *IdentRequest) Reset() {
*x = IdentRequest{}
mi := &file_blocks_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *IdentRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*IdentRequest) ProtoMessage() {}
func (x *IdentRequest) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use IdentRequest.ProtoReflect.Descriptor instead.
func (*IdentRequest) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{1}
}
func (x *IdentRequest) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *IdentRequest) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
type VersionRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` // 时序版本号
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *VersionRequest) Reset() {
*x = VersionRequest{}
mi := &file_blocks_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *VersionRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VersionRequest) ProtoMessage() {}
func (x *VersionRequest) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead.
func (*VersionRequest) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{2}
}
func (x *VersionRequest) GetVersion() int64 {
if x != nil {
return x.Version
}
return 0
}
type SearchRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Keyword string `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"` //关键词
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SearchRequest) Reset() {
*x = SearchRequest{}
mi := &file_blocks_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SearchRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SearchRequest) ProtoMessage() {}
func (x *SearchRequest) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.
func (*SearchRequest) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{3}
}
func (x *SearchRequest) GetKeyword() string {
if x != nil {
return x.Keyword
}
return ""
}
type StatusReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // 状态码
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // 状态说明
Details string `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"` // 数据
Timeseq int64 `protobuf:"varint,4,opt,name=timeseq,proto3" json:"timeseq,omitempty"` // 响应时间序列
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StatusReply) Reset() {
*x = StatusReply{}
mi := &file_blocks_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StatusReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatusReply) ProtoMessage() {}
func (x *StatusReply) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StatusReply.ProtoReflect.Descriptor instead.
func (*StatusReply) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{4}
}
func (x *StatusReply) GetCode() int32 {
if x != nil {
return x.Code
}
return 0
}
func (x *StatusReply) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *StatusReply) GetDetails() string {
if x != nil {
return x.Details
}
return ""
}
func (x *StatusReply) GetTimeseq() int64 {
if x != nil {
return x.Timeseq
}
return 0
}
type VerifyStatus struct {
state protoimpl.MessageState `protogen:"open.v1"`
EmailVerify int32 `protobuf:"varint,1,opt,name=email_verify,json=emailVerify,proto3" json:"email_verify,omitempty"` // 邮箱是否已验证
PhoneVerify int32 `protobuf:"varint,2,opt,name=phone_verify,json=phoneVerify,proto3" json:"phone_verify,omitempty"` // 手机是否已验证
FaceVerify int32 `protobuf:"varint,3,opt,name=face_verify,json=faceVerify,proto3" json:"face_verify,omitempty"` // 人脸或照片是否已验证
DocumentVerify int32 `protobuf:"varint,4,opt,name=document_verify,json=documentVerify,proto3" json:"document_verify,omitempty"` // 证件是否已验证
KycVerify int32 `protobuf:"varint,5,opt,name=kyc_verify,json=kycVerify,proto3" json:"kyc_verify,omitempty"` // 实名是否已验证
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *VerifyStatus) Reset() {
*x = VerifyStatus{}
mi := &file_blocks_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *VerifyStatus) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VerifyStatus) ProtoMessage() {}
func (x *VerifyStatus) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use VerifyStatus.ProtoReflect.Descriptor instead.
func (*VerifyStatus) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{5}
}
func (x *VerifyStatus) GetEmailVerify() int32 {
if x != nil {
return x.EmailVerify
}
return 0
}
func (x *VerifyStatus) GetPhoneVerify() int32 {
if x != nil {
return x.PhoneVerify
}
return 0
}
func (x *VerifyStatus) GetFaceVerify() int32 {
if x != nil {
return x.FaceVerify
}
return 0
}
func (x *VerifyStatus) GetDocumentVerify() int32 {
if x != nil {
return x.DocumentVerify
}
return 0
}
func (x *VerifyStatus) GetKycVerify() int32 {
if x != nil {
return x.KycVerify
}
return 0
}
type Empty struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Empty) Reset() {
*x = Empty{}
mi := &file_blocks_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Empty) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Empty) ProtoMessage() {}
func (x *Empty) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Empty.ProtoReflect.Descriptor instead.
func (*Empty) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{6}
}
var File_blocks_proto protoreflect.FileDescriptor
const file_blocks_proto_rawDesc = "" +
"\n" +
"\x15passport/blocks.proto\x12\bpassport\"\xbb\x01\n" +
"\fFetchRequest\x12\x17\n" +
"\apage_no\x18\x01 \x01(\x03R\x06pageNo\x12\x1b\n" +
"\tpage_size\x18\x02 \x01(\x03R\bpageSize\x12:\n" +
"\x06params\x18\x03 \x03(\v2\".passport.FetchRequest.ParamsEntryR\x06params\x1a9\n" +
"\vParamsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\":\n" +
"\fIdentRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" +
"\bidentity\x18\x02 \x01(\tR\bidentity\"*\n" +
"\x0eVersionRequest\x12\x18\n" +
"\aversion\x18\x01 \x01(\x03R\aversion\")\n" +
"\rSearchRequest\x12\x18\n" +
"\akeyword\x18\x01 \x01(\tR\akeyword\"o\n" +
"\vStatusReply\x12\x12\n" +
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage\x12\x18\n" +
"\adetails\x18\x03 \x01(\tR\adetails\x12\x18\n" +
"\atimeseq\x18\x04 \x01(\x03R\atimeseq\"\xbd\x01\n" +
"\fVerifyStatus\x12!\n" +
"\femail_verify\x18\x01 \x01(\x05R\vemailVerify\x12!\n" +
"\fphone_verify\x18\x02 \x01(\x05R\vphoneVerify\x12\x1f\n" +
"\vface_verify\x18\x03 \x01(\x05R\n" +
"faceVerify\x12'\n" +
"\x0fdocument_verify\x18\x04 \x01(\x05R\x0edocumentVerify\x12\x1d\n" +
"\n" +
"kyc_verify\x18\x05 \x01(\x05R\tkycVerify\"\a\n" +
"\x05EmptyB\fZ\n" +
".;passportb\x06proto3"
var (
file_blocks_proto_rawDescOnce sync.Once
file_blocks_proto_rawDescData []byte
)
func file_blocks_proto_rawDescGZIP() []byte {
file_blocks_proto_rawDescOnce.Do(func() {
file_blocks_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_blocks_proto_rawDesc), len(file_blocks_proto_rawDesc)))
})
return file_blocks_proto_rawDescData
}
var file_blocks_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_blocks_proto_goTypes = []any{
(*FetchRequest)(nil), // 0: passport.FetchRequest
(*IdentRequest)(nil), // 1: passport.IdentRequest
(*VersionRequest)(nil), // 2: passport.VersionRequest
(*SearchRequest)(nil), // 3: passport.SearchRequest
(*StatusReply)(nil), // 4: passport.StatusReply
(*VerifyStatus)(nil), // 5: passport.VerifyStatus
(*Empty)(nil), // 6: passport.Empty
nil, // 7: passport.FetchRequest.ParamsEntry
}
var file_blocks_proto_depIdxs = []int32{
7, // 0: passport.FetchRequest.params:type_name -> passport.FetchRequest.ParamsEntry
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_blocks_proto_init() }
func file_blocks_proto_init() {
if File_blocks_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_blocks_proto_rawDesc), len(file_blocks_proto_rawDesc)),
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_blocks_proto_goTypes,
DependencyIndexes: file_blocks_proto_depIdxs,
MessageInfos: file_blocks_proto_msgTypes,
}.Build()
File_blocks_proto = out.File
file_blocks_proto_goTypes = nil
file_blocks_proto_depIdxs = nil
}

View File

@@ -0,0 +1,197 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: forget.proto
package passport
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ForgetVerifyRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Phone string `protobuf:"bytes,1,opt,name=phone,proto3" json:"phone,omitempty"` //手机号
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` // 验证码
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ForgetVerifyRequest) Reset() {
*x = ForgetVerifyRequest{}
mi := &file_forget_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ForgetVerifyRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ForgetVerifyRequest) ProtoMessage() {}
func (x *ForgetVerifyRequest) ProtoReflect() protoreflect.Message {
mi := &file_forget_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ForgetVerifyRequest.ProtoReflect.Descriptor instead.
func (*ForgetVerifyRequest) Descriptor() ([]byte, []int) {
return file_forget_proto_rawDescGZIP(), []int{0}
}
func (x *ForgetVerifyRequest) GetPhone() string {
if x != nil {
return x.Phone
}
return ""
}
func (x *ForgetVerifyRequest) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
type ForgetResetRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` //唯一码
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // 密码
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ForgetResetRequest) Reset() {
*x = ForgetResetRequest{}
mi := &file_forget_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ForgetResetRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ForgetResetRequest) ProtoMessage() {}
func (x *ForgetResetRequest) ProtoReflect() protoreflect.Message {
mi := &file_forget_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ForgetResetRequest.ProtoReflect.Descriptor instead.
func (*ForgetResetRequest) Descriptor() ([]byte, []int) {
return file_forget_proto_rawDescGZIP(), []int{1}
}
func (x *ForgetResetRequest) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *ForgetResetRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
var File_forget_proto protoreflect.FileDescriptor
const file_forget_proto_rawDesc = "" +
"\n" +
"\x1abase/passport/forget.proto\x12\bpassport\x1a\x15passport/blocks.proto\"?\n" +
"\x13ForgetVerifyRequest\x12\x14\n" +
"\x05phone\x18\x01 \x01(\tR\x05phone\x12\x12\n" +
"\x04code\x18\x02 \x01(\tR\x04code\"L\n" +
"\x12ForgetResetRequest\x12\x1a\n" +
"\bidentity\x18\x01 \x01(\tR\bidentity\x12\x1a\n" +
"\bpassword\x18\x02 \x01(\tR\bpassword2\x8a\x01\n" +
"\x06Forget\x12@\n" +
"\x06Verify\x12\x1d.passport.ForgetVerifyRequest\x1a\x15.passport.StatusReply\"\x00\x12>\n" +
"\x05Reset\x12\x1c.passport.ForgetResetRequest\x1a\x15.passport.StatusReply\"\x00B\fZ\n" +
".;passportb\x06proto3"
var (
file_forget_proto_rawDescOnce sync.Once
file_forget_proto_rawDescData []byte
)
func file_forget_proto_rawDescGZIP() []byte {
file_forget_proto_rawDescOnce.Do(func() {
file_forget_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_forget_proto_rawDesc), len(file_forget_proto_rawDesc)))
})
return file_forget_proto_rawDescData
}
var file_forget_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_forget_proto_goTypes = []any{
(*ForgetVerifyRequest)(nil), // 0: passport.ForgetVerifyRequest
(*ForgetResetRequest)(nil), // 1: passport.ForgetResetRequest
(*StatusReply)(nil), // 2: passport.StatusReply
}
var file_forget_proto_depIdxs = []int32{
0, // 0: passport.Forget.Verify:input_type -> passport.ForgetVerifyRequest
1, // 1: passport.Forget.Reset:input_type -> passport.ForgetResetRequest
2, // 2: passport.Forget.Verify:output_type -> passport.StatusReply
2, // 3: passport.Forget.Reset:output_type -> passport.StatusReply
2, // [2:4] is the sub-list for method output_type
0, // [0:2] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_forget_proto_init() }
func file_forget_proto_init() {
if File_forget_proto != nil {
return
}
file_blocks_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_forget_proto_rawDesc), len(file_forget_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_forget_proto_goTypes,
DependencyIndexes: file_forget_proto_depIdxs,
MessageInfos: file_forget_proto_msgTypes,
}.Build()
File_forget_proto = out.File
file_forget_proto_goTypes = nil
file_forget_proto_depIdxs = nil
}

View File

@@ -0,0 +1,223 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: forget.proto
/*
Package passport is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package passport
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Forget_Verify_0(ctx context.Context, marshaler runtime.Marshaler, client ForgetClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ForgetVerifyRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Verify(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Forget_Verify_0(ctx context.Context, marshaler runtime.Marshaler, server ForgetServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ForgetVerifyRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Verify(ctx, &protoReq)
return msg, metadata, err
}
func request_Forget_Reset_0(ctx context.Context, marshaler runtime.Marshaler, client ForgetClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ForgetResetRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Reset(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Forget_Reset_0(ctx context.Context, marshaler runtime.Marshaler, server ForgetServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ForgetResetRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Reset(ctx, &protoReq)
return msg, metadata, err
}
// RegisterForgetHandlerServer registers the http handlers for service Forget to "mux".
// UnaryRPC :call ForgetServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterForgetHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterForgetHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ForgetServer) error {
mux.Handle(http.MethodPost, pattern_Forget_Verify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Forget/Verify", runtime.WithHTTPPathPattern("/passport.Forget/Verify"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Forget_Verify_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Forget_Verify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Forget_Reset_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Forget/Reset", runtime.WithHTTPPathPattern("/passport.Forget/Reset"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Forget_Reset_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Forget_Reset_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterForgetHandlerFromEndpoint is same as RegisterForgetHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterForgetHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterForgetHandler(ctx, mux, conn)
}
// RegisterForgetHandler registers the http handlers for service Forget to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterForgetHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterForgetHandlerClient(ctx, mux, NewForgetClient(conn))
}
// RegisterForgetHandlerClient registers the http handlers for service Forget
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ForgetClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ForgetClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "ForgetClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterForgetHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ForgetClient) error {
mux.Handle(http.MethodPost, pattern_Forget_Verify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Forget/Verify", runtime.WithHTTPPathPattern("/passport.Forget/Verify"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Forget_Verify_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Forget_Verify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Forget_Reset_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Forget/Reset", runtime.WithHTTPPathPattern("/passport.Forget/Reset"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Forget_Reset_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Forget_Reset_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Forget_Verify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Forget", "Verify"}, ""))
pattern_Forget_Reset_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Forget", "Reset"}, ""))
)
var (
forward_Forget_Verify_0 = runtime.ForwardResponseMessage
forward_Forget_Reset_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,167 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: forget.proto
package passport
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Forget_Verify_FullMethodName = "/passport.Forget/Verify"
Forget_Reset_FullMethodName = "/passport.Forget/Reset"
)
// ForgetClient is the client API for Forget service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Passport通行证模块-找回密码
type ForgetClient interface {
// 验证手机号和验证码
Verify(ctx context.Context, in *ForgetVerifyRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 重罢密码
Reset(ctx context.Context, in *ForgetResetRequest, opts ...grpc.CallOption) (*StatusReply, error)
}
type forgetClient struct {
cc grpc.ClientConnInterface
}
func NewForgetClient(cc grpc.ClientConnInterface) ForgetClient {
return &forgetClient{cc}
}
func (c *forgetClient) Verify(ctx context.Context, in *ForgetVerifyRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Forget_Verify_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *forgetClient) Reset(ctx context.Context, in *ForgetResetRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Forget_Reset_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ForgetServer is the server API for Forget service.
// All implementations must embed UnimplementedForgetServer
// for forward compatibility.
//
// Passport通行证模块-找回密码
type ForgetServer interface {
// 验证手机号和验证码
Verify(context.Context, *ForgetVerifyRequest) (*StatusReply, error)
// 重罢密码
Reset(context.Context, *ForgetResetRequest) (*StatusReply, error)
mustEmbedUnimplementedForgetServer()
}
// UnimplementedForgetServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedForgetServer struct{}
func (UnimplementedForgetServer) Verify(context.Context, *ForgetVerifyRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Verify not implemented")
}
func (UnimplementedForgetServer) Reset(context.Context, *ForgetResetRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Reset not implemented")
}
func (UnimplementedForgetServer) mustEmbedUnimplementedForgetServer() {}
func (UnimplementedForgetServer) testEmbeddedByValue() {}
// UnsafeForgetServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ForgetServer will
// result in compilation errors.
type UnsafeForgetServer interface {
mustEmbedUnimplementedForgetServer()
}
func RegisterForgetServer(s grpc.ServiceRegistrar, srv ForgetServer) {
// If the following call panics, it indicates UnimplementedForgetServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Forget_ServiceDesc, srv)
}
func _Forget_Verify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ForgetVerifyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ForgetServer).Verify(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Forget_Verify_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ForgetServer).Verify(ctx, req.(*ForgetVerifyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Forget_Reset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ForgetResetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ForgetServer).Reset(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Forget_Reset_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ForgetServer).Reset(ctx, req.(*ForgetResetRequest))
}
return interceptor(ctx, in, info, handler)
}
// Forget_ServiceDesc is the grpc.ServiceDesc for Forget service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Forget_ServiceDesc = grpc.ServiceDesc{
ServiceName: "passport.Forget",
HandlerType: (*ForgetServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Verify",
Handler: _Forget_Verify_Handler,
},
{
MethodName: "Reset",
Handler: _Forget_Reset_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "forget.proto",
}

View File

@@ -0,0 +1,335 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: login.proto
package passport
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type LoginByPwdRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` // 账号 必填
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // 密码 必填
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LoginByPwdRequest) Reset() {
*x = LoginByPwdRequest{}
mi := &file_login_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LoginByPwdRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginByPwdRequest) ProtoMessage() {}
func (x *LoginByPwdRequest) ProtoReflect() protoreflect.Message {
mi := &file_login_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginByPwdRequest.ProtoReflect.Descriptor instead.
func (*LoginByPwdRequest) Descriptor() ([]byte, []int) {
return file_login_proto_rawDescGZIP(), []int{0}
}
func (x *LoginByPwdRequest) GetAccount() string {
if x != nil {
return x.Account
}
return ""
}
func (x *LoginByPwdRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
type LoginByCodeRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Country string `protobuf:"bytes,1,opt,name=country,proto3" json:"country,omitempty"` // 国家
Phone string `protobuf:"bytes,2,opt,name=phone,proto3" json:"phone,omitempty"` // 手机号码
Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"` // 验证码
AgencyId int64 `protobuf:"varint,4,opt,name=agency_id,json=agencyId,proto3" json:"agency_id,omitempty"` // 代理ID
StaffId int64 `protobuf:"varint,5,opt,name=staff_id,json=staffId,proto3" json:"staff_id,omitempty"` // 工作人员ID
OwnerId int64 `protobuf:"varint,6,opt,name=owner_id,proto3" json:"owner_id,omitempty"` // 所属ID
OwnerIdentity string `protobuf:"bytes,7,opt,name=owner_identity,proto3" json:"owner_identity,omitempty"` // 所属唯一码
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LoginByCodeRequest) Reset() {
*x = LoginByCodeRequest{}
mi := &file_login_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LoginByCodeRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginByCodeRequest) ProtoMessage() {}
func (x *LoginByCodeRequest) ProtoReflect() protoreflect.Message {
mi := &file_login_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginByCodeRequest.ProtoReflect.Descriptor instead.
func (*LoginByCodeRequest) Descriptor() ([]byte, []int) {
return file_login_proto_rawDescGZIP(), []int{1}
}
func (x *LoginByCodeRequest) GetCountry() string {
if x != nil {
return x.Country
}
return ""
}
func (x *LoginByCodeRequest) GetPhone() string {
if x != nil {
return x.Phone
}
return ""
}
func (x *LoginByCodeRequest) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *LoginByCodeRequest) GetAgencyId() int64 {
if x != nil {
return x.AgencyId
}
return 0
}
func (x *LoginByCodeRequest) GetStaffId() int64 {
if x != nil {
return x.StaffId
}
return 0
}
func (x *LoginByCodeRequest) GetOwnerId() int64 {
if x != nil {
return x.OwnerId
}
return 0
}
func (x *LoginByCodeRequest) GetOwnerIdentity() string {
if x != nil {
return x.OwnerIdentity
}
return ""
}
type LoginReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` //用户唯一码
Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` //用户凭证
Extend map[string]string `protobuf:"bytes,4,rep,name=extend,proto3" json:"extend,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` //扩展字段
VerifyStatus *VerifyStatus `protobuf:"bytes,5,opt,name=verify_status,json=verifyStatus,proto3" json:"verify_status,omitempty"` // 用户验证状态
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LoginReply) Reset() {
*x = LoginReply{}
mi := &file_login_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LoginReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginReply) ProtoMessage() {}
func (x *LoginReply) ProtoReflect() protoreflect.Message {
mi := &file_login_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginReply.ProtoReflect.Descriptor instead.
func (*LoginReply) Descriptor() ([]byte, []int) {
return file_login_proto_rawDescGZIP(), []int{2}
}
func (x *LoginReply) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *LoginReply) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *LoginReply) GetToken() string {
if x != nil {
return x.Token
}
return ""
}
func (x *LoginReply) GetExtend() map[string]string {
if x != nil {
return x.Extend
}
return nil
}
func (x *LoginReply) GetVerifyStatus() *VerifyStatus {
if x != nil {
return x.VerifyStatus
}
return nil
}
var File_login_proto protoreflect.FileDescriptor
const file_login_proto_rawDesc = "" +
"\n" +
"\x19base/passport/login.proto\x12\bpassport\x1a\x15passport/blocks.proto\"I\n" +
"\x11LoginByPwdRequest\x12\x18\n" +
"\aaccount\x18\x01 \x01(\tR\aaccount\x12\x1a\n" +
"\bpassword\x18\x02 \x01(\tR\bpassword\"\xd4\x01\n" +
"\x12LoginByCodeRequest\x12\x18\n" +
"\acountry\x18\x01 \x01(\tR\acountry\x12\x14\n" +
"\x05phone\x18\x02 \x01(\tR\x05phone\x12\x12\n" +
"\x04code\x18\x03 \x01(\tR\x04code\x12\x1b\n" +
"\tagency_id\x18\x04 \x01(\x03R\bagencyId\x12\x19\n" +
"\bstaff_id\x18\x05 \x01(\x03R\astaffId\x12\x1a\n" +
"\bowner_id\x18\x06 \x01(\x03R\bowner_id\x12&\n" +
"\x0eowner_identity\x18\a \x01(\tR\x0eowner_identity\"\x80\x02\n" +
"\n" +
"LoginReply\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" +
"\bidentity\x18\x02 \x01(\tR\bidentity\x12\x14\n" +
"\x05token\x18\x03 \x01(\tR\x05token\x128\n" +
"\x06extend\x18\x04 \x03(\v2 .passport.LoginReply.ExtendEntryR\x06extend\x12;\n" +
"\rverify_status\x18\x05 \x01(\v2\x16.passport.VerifyStatusR\fverifyStatus\x1a9\n" +
"\vExtendEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x012\xc0\x01\n" +
"\x05Login\x12:\n" +
"\x03Pwd\x12\x1b.passport.LoginByPwdRequest\x1a\x14.passport.LoginReply\"\x00\x12<\n" +
"\x04Code\x12\x1c.passport.LoginByCodeRequest\x1a\x14.passport.LoginReply\"\x00\x12=\n" +
"\x05Quick\x12\x1c.passport.LoginByCodeRequest\x1a\x14.passport.LoginReply\"\x00B\fZ\n" +
".;passportb\x06proto3"
var (
file_login_proto_rawDescOnce sync.Once
file_login_proto_rawDescData []byte
)
func file_login_proto_rawDescGZIP() []byte {
file_login_proto_rawDescOnce.Do(func() {
file_login_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_login_proto_rawDesc), len(file_login_proto_rawDesc)))
})
return file_login_proto_rawDescData
}
var file_login_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_login_proto_goTypes = []any{
(*LoginByPwdRequest)(nil), // 0: passport.LoginByPwdRequest
(*LoginByCodeRequest)(nil), // 1: passport.LoginByCodeRequest
(*LoginReply)(nil), // 2: passport.LoginReply
nil, // 3: passport.LoginReply.ExtendEntry
(*VerifyStatus)(nil), // 4: passport.VerifyStatus
}
var file_login_proto_depIdxs = []int32{
3, // 0: passport.LoginReply.extend:type_name -> passport.LoginReply.ExtendEntry
4, // 1: passport.LoginReply.verify_status:type_name -> passport.VerifyStatus
0, // 2: passport.Login.Pwd:input_type -> passport.LoginByPwdRequest
1, // 3: passport.Login.Code:input_type -> passport.LoginByCodeRequest
1, // 4: passport.Login.Quick:input_type -> passport.LoginByCodeRequest
2, // 5: passport.Login.Pwd:output_type -> passport.LoginReply
2, // 6: passport.Login.Code:output_type -> passport.LoginReply
2, // 7: passport.Login.Quick:output_type -> passport.LoginReply
5, // [5:8] is the sub-list for method output_type
2, // [2:5] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_login_proto_init() }
func file_login_proto_init() {
if File_login_proto != nil {
return
}
file_blocks_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_login_proto_rawDesc), len(file_login_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_login_proto_goTypes,
DependencyIndexes: file_login_proto_depIdxs,
MessageInfos: file_login_proto_msgTypes,
}.Build()
File_login_proto = out.File
file_login_proto_goTypes = nil
file_login_proto_depIdxs = nil
}

View File

@@ -0,0 +1,289 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: login.proto
/*
Package passport is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package passport
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Login_Pwd_0(ctx context.Context, marshaler runtime.Marshaler, client LoginClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq LoginByPwdRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Pwd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Login_Pwd_0(ctx context.Context, marshaler runtime.Marshaler, server LoginServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq LoginByPwdRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Pwd(ctx, &protoReq)
return msg, metadata, err
}
func request_Login_Code_0(ctx context.Context, marshaler runtime.Marshaler, client LoginClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq LoginByCodeRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Code(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Login_Code_0(ctx context.Context, marshaler runtime.Marshaler, server LoginServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq LoginByCodeRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Code(ctx, &protoReq)
return msg, metadata, err
}
func request_Login_Quick_0(ctx context.Context, marshaler runtime.Marshaler, client LoginClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq LoginByCodeRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Quick(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Login_Quick_0(ctx context.Context, marshaler runtime.Marshaler, server LoginServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq LoginByCodeRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Quick(ctx, &protoReq)
return msg, metadata, err
}
// RegisterLoginHandlerServer registers the http handlers for service Login to "mux".
// UnaryRPC :call LoginServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterLoginHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterLoginHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LoginServer) error {
mux.Handle(http.MethodPost, pattern_Login_Pwd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Login/Pwd", runtime.WithHTTPPathPattern("/passport.Login/Pwd"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Login_Pwd_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Login_Pwd_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Login_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Login/Code", runtime.WithHTTPPathPattern("/passport.Login/Code"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Login_Code_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Login_Code_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Login_Quick_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Login/Quick", runtime.WithHTTPPathPattern("/passport.Login/Quick"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Login_Quick_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Login_Quick_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterLoginHandlerFromEndpoint is same as RegisterLoginHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterLoginHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterLoginHandler(ctx, mux, conn)
}
// RegisterLoginHandler registers the http handlers for service Login to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterLoginHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterLoginHandlerClient(ctx, mux, NewLoginClient(conn))
}
// RegisterLoginHandlerClient registers the http handlers for service Login
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LoginClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LoginClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "LoginClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterLoginHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LoginClient) error {
mux.Handle(http.MethodPost, pattern_Login_Pwd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Login/Pwd", runtime.WithHTTPPathPattern("/passport.Login/Pwd"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Login_Pwd_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Login_Pwd_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Login_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Login/Code", runtime.WithHTTPPathPattern("/passport.Login/Code"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Login_Code_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Login_Code_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Login_Quick_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Login/Quick", runtime.WithHTTPPathPattern("/passport.Login/Quick"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Login_Quick_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Login_Quick_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Login_Pwd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Login", "Pwd"}, ""))
pattern_Login_Code_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Login", "Code"}, ""))
pattern_Login_Quick_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Login", "Quick"}, ""))
)
var (
forward_Login_Pwd_0 = runtime.ForwardResponseMessage
forward_Login_Code_0 = runtime.ForwardResponseMessage
forward_Login_Quick_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,207 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: login.proto
package passport
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Login_Pwd_FullMethodName = "/passport.Login/Pwd"
Login_Code_FullMethodName = "/passport.Login/Code"
Login_Quick_FullMethodName = "/passport.Login/Quick"
)
// LoginClient is the client API for Login service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Passport-通行证模块-登录
type LoginClient interface {
// 通过密码登录
Pwd(ctx context.Context, in *LoginByPwdRequest, opts ...grpc.CallOption) (*LoginReply, error)
// 通过验证码登录
Code(ctx context.Context, in *LoginByCodeRequest, opts ...grpc.CallOption) (*LoginReply, error)
// 通过验证码快捷登录并注册
Quick(ctx context.Context, in *LoginByCodeRequest, opts ...grpc.CallOption) (*LoginReply, error)
}
type loginClient struct {
cc grpc.ClientConnInterface
}
func NewLoginClient(cc grpc.ClientConnInterface) LoginClient {
return &loginClient{cc}
}
func (c *loginClient) Pwd(ctx context.Context, in *LoginByPwdRequest, opts ...grpc.CallOption) (*LoginReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LoginReply)
err := c.cc.Invoke(ctx, Login_Pwd_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *loginClient) Code(ctx context.Context, in *LoginByCodeRequest, opts ...grpc.CallOption) (*LoginReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LoginReply)
err := c.cc.Invoke(ctx, Login_Code_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *loginClient) Quick(ctx context.Context, in *LoginByCodeRequest, opts ...grpc.CallOption) (*LoginReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LoginReply)
err := c.cc.Invoke(ctx, Login_Quick_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// LoginServer is the server API for Login service.
// All implementations must embed UnimplementedLoginServer
// for forward compatibility.
//
// Passport-通行证模块-登录
type LoginServer interface {
// 通过密码登录
Pwd(context.Context, *LoginByPwdRequest) (*LoginReply, error)
// 通过验证码登录
Code(context.Context, *LoginByCodeRequest) (*LoginReply, error)
// 通过验证码快捷登录并注册
Quick(context.Context, *LoginByCodeRequest) (*LoginReply, error)
mustEmbedUnimplementedLoginServer()
}
// UnimplementedLoginServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedLoginServer struct{}
func (UnimplementedLoginServer) Pwd(context.Context, *LoginByPwdRequest) (*LoginReply, error) {
return nil, status.Error(codes.Unimplemented, "method Pwd not implemented")
}
func (UnimplementedLoginServer) Code(context.Context, *LoginByCodeRequest) (*LoginReply, error) {
return nil, status.Error(codes.Unimplemented, "method Code not implemented")
}
func (UnimplementedLoginServer) Quick(context.Context, *LoginByCodeRequest) (*LoginReply, error) {
return nil, status.Error(codes.Unimplemented, "method Quick not implemented")
}
func (UnimplementedLoginServer) mustEmbedUnimplementedLoginServer() {}
func (UnimplementedLoginServer) testEmbeddedByValue() {}
// UnsafeLoginServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to LoginServer will
// result in compilation errors.
type UnsafeLoginServer interface {
mustEmbedUnimplementedLoginServer()
}
func RegisterLoginServer(s grpc.ServiceRegistrar, srv LoginServer) {
// If the following call panics, it indicates UnimplementedLoginServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Login_ServiceDesc, srv)
}
func _Login_Pwd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginByPwdRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LoginServer).Pwd(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Login_Pwd_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LoginServer).Pwd(ctx, req.(*LoginByPwdRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Login_Code_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginByCodeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LoginServer).Code(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Login_Code_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LoginServer).Code(ctx, req.(*LoginByCodeRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Login_Quick_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginByCodeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LoginServer).Quick(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Login_Quick_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LoginServer).Quick(ctx, req.(*LoginByCodeRequest))
}
return interceptor(ctx, in, info, handler)
}
// Login_ServiceDesc is the grpc.ServiceDesc for Login service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Login_ServiceDesc = grpc.ServiceDesc{
ServiceName: "passport.Login",
HandlerType: (*LoginServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Pwd",
Handler: _Login_Pwd_Handler,
},
{
MethodName: "Code",
Handler: _Login_Code_Handler,
},
{
MethodName: "Quick",
Handler: _Login_Quick_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "login.proto",
}

View File

@@ -0,0 +1,303 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: register.proto
package passport
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type RegisterRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Country string `protobuf:"bytes,1,opt,name=country,proto3" json:"country,omitempty"` // 国家码,eg CN US
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` //邮箱
Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` //帐号
Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"` //手机号
Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"` //密码
Code string `protobuf:"bytes,6,opt,name=code,proto3" json:"code,omitempty"` //验证码
AgencyId int64 `protobuf:"varint,7,opt,name=agency_id,json=agencyId,proto3" json:"agency_id,omitempty"` // 代理ID
StaffId int64 `protobuf:"varint,8,opt,name=staff_id,json=staffId,proto3" json:"staff_id,omitempty"` // 工作人员ID
OwnerId int64 `protobuf:"varint,9,opt,name=owner_id,proto3" json:"owner_id,omitempty"` // 所属ID
OwnerIdentity string `protobuf:"bytes,10,opt,name=owner_identity,proto3" json:"owner_identity,omitempty"` // 所属唯一码
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RegisterRequest) Reset() {
*x = RegisterRequest{}
mi := &file_register_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *RegisterRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RegisterRequest) ProtoMessage() {}
func (x *RegisterRequest) ProtoReflect() protoreflect.Message {
mi := &file_register_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead.
func (*RegisterRequest) Descriptor() ([]byte, []int) {
return file_register_proto_rawDescGZIP(), []int{0}
}
func (x *RegisterRequest) GetCountry() string {
if x != nil {
return x.Country
}
return ""
}
func (x *RegisterRequest) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *RegisterRequest) GetAccount() string {
if x != nil {
return x.Account
}
return ""
}
func (x *RegisterRequest) GetPhone() string {
if x != nil {
return x.Phone
}
return ""
}
func (x *RegisterRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
func (x *RegisterRequest) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *RegisterRequest) GetAgencyId() int64 {
if x != nil {
return x.AgencyId
}
return 0
}
func (x *RegisterRequest) GetStaffId() int64 {
if x != nil {
return x.StaffId
}
return 0
}
func (x *RegisterRequest) GetOwnerId() int64 {
if x != nil {
return x.OwnerId
}
return 0
}
func (x *RegisterRequest) GetOwnerIdentity() string {
if x != nil {
return x.OwnerIdentity
}
return ""
}
type RegisterReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` //用户唯一码
Token string `protobuf:"bytes,4,opt,name=token,proto3" json:"token,omitempty"` //用户Header所需Token
Extend map[string]string `protobuf:"bytes,5,rep,name=extend,proto3" json:"extend,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` //扩展字段
VerifyStatus *VerifyStatus `protobuf:"bytes,6,opt,name=verify_status,json=verifyStatus,proto3" json:"verify_status,omitempty"` // 用户验证状态
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RegisterReply) Reset() {
*x = RegisterReply{}
mi := &file_register_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *RegisterReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RegisterReply) ProtoMessage() {}
func (x *RegisterReply) ProtoReflect() protoreflect.Message {
mi := &file_register_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RegisterReply.ProtoReflect.Descriptor instead.
func (*RegisterReply) Descriptor() ([]byte, []int) {
return file_register_proto_rawDescGZIP(), []int{1}
}
func (x *RegisterReply) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *RegisterReply) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *RegisterReply) GetToken() string {
if x != nil {
return x.Token
}
return ""
}
func (x *RegisterReply) GetExtend() map[string]string {
if x != nil {
return x.Extend
}
return nil
}
func (x *RegisterReply) GetVerifyStatus() *VerifyStatus {
if x != nil {
return x.VerifyStatus
}
return nil
}
var File_register_proto protoreflect.FileDescriptor
const file_register_proto_rawDesc = "" +
"\n" +
"\x1cbase/passport/register.proto\x12\bpassport\x1a\x15passport/blocks.proto\"\x9d\x02\n" +
"\x0fRegisterRequest\x12\x18\n" +
"\acountry\x18\x01 \x01(\tR\acountry\x12\x14\n" +
"\x05email\x18\x02 \x01(\tR\x05email\x12\x18\n" +
"\aaccount\x18\x03 \x01(\tR\aaccount\x12\x14\n" +
"\x05phone\x18\x04 \x01(\tR\x05phone\x12\x1a\n" +
"\bpassword\x18\x05 \x01(\tR\bpassword\x12\x12\n" +
"\x04code\x18\x06 \x01(\tR\x04code\x12\x1b\n" +
"\tagency_id\x18\a \x01(\x03R\bagencyId\x12\x19\n" +
"\bstaff_id\x18\b \x01(\x03R\astaffId\x12\x1a\n" +
"\bowner_id\x18\t \x01(\x03R\bowner_id\x12&\n" +
"\x0eowner_identity\x18\n" +
" \x01(\tR\x0eowner_identity\"\x86\x02\n" +
"\rRegisterReply\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" +
"\bidentity\x18\x02 \x01(\tR\bidentity\x12\x14\n" +
"\x05token\x18\x04 \x01(\tR\x05token\x12;\n" +
"\x06extend\x18\x05 \x03(\v2#.passport.RegisterReply.ExtendEntryR\x06extend\x12;\n" +
"\rverify_status\x18\x06 \x01(\v2\x16.passport.VerifyStatusR\fverifyStatus\x1a9\n" +
"\vExtendEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x012\x85\x01\n" +
"\bRegister\x12;\n" +
"\x03Pwd\x12\x19.passport.RegisterRequest\x1a\x17.passport.RegisterReply\"\x00\x12<\n" +
"\x04Code\x12\x19.passport.RegisterRequest\x1a\x17.passport.RegisterReply\"\x00B\fZ\n" +
".;passportb\x06proto3"
var (
file_register_proto_rawDescOnce sync.Once
file_register_proto_rawDescData []byte
)
func file_register_proto_rawDescGZIP() []byte {
file_register_proto_rawDescOnce.Do(func() {
file_register_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_register_proto_rawDesc), len(file_register_proto_rawDesc)))
})
return file_register_proto_rawDescData
}
var file_register_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_register_proto_goTypes = []any{
(*RegisterRequest)(nil), // 0: passport.RegisterRequest
(*RegisterReply)(nil), // 1: passport.RegisterReply
nil, // 2: passport.RegisterReply.ExtendEntry
(*VerifyStatus)(nil), // 3: passport.VerifyStatus
}
var file_register_proto_depIdxs = []int32{
2, // 0: passport.RegisterReply.extend:type_name -> passport.RegisterReply.ExtendEntry
3, // 1: passport.RegisterReply.verify_status:type_name -> passport.VerifyStatus
0, // 2: passport.Register.Pwd:input_type -> passport.RegisterRequest
0, // 3: passport.Register.Code:input_type -> passport.RegisterRequest
1, // 4: passport.Register.Pwd:output_type -> passport.RegisterReply
1, // 5: passport.Register.Code:output_type -> passport.RegisterReply
4, // [4:6] is the sub-list for method output_type
2, // [2:4] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_register_proto_init() }
func file_register_proto_init() {
if File_register_proto != nil {
return
}
file_blocks_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_register_proto_rawDesc), len(file_register_proto_rawDesc)),
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_register_proto_goTypes,
DependencyIndexes: file_register_proto_depIdxs,
MessageInfos: file_register_proto_msgTypes,
}.Build()
File_register_proto = out.File
file_register_proto_goTypes = nil
file_register_proto_depIdxs = nil
}

View File

@@ -0,0 +1,223 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: register.proto
/*
Package passport is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package passport
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Register_Pwd_0(ctx context.Context, marshaler runtime.Marshaler, client RegisterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq RegisterRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Pwd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Register_Pwd_0(ctx context.Context, marshaler runtime.Marshaler, server RegisterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq RegisterRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Pwd(ctx, &protoReq)
return msg, metadata, err
}
func request_Register_Code_0(ctx context.Context, marshaler runtime.Marshaler, client RegisterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq RegisterRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Code(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Register_Code_0(ctx context.Context, marshaler runtime.Marshaler, server RegisterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq RegisterRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Code(ctx, &protoReq)
return msg, metadata, err
}
// RegisterRegisterHandlerServer registers the http handlers for service Register to "mux".
// UnaryRPC :call RegisterServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterRegisterHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterRegisterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RegisterServer) error {
mux.Handle(http.MethodPost, pattern_Register_Pwd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Register/Pwd", runtime.WithHTTPPathPattern("/passport.Register/Pwd"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Register_Pwd_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Register_Pwd_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Register_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Register/Code", runtime.WithHTTPPathPattern("/passport.Register/Code"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Register_Code_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Register_Code_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterRegisterHandlerFromEndpoint is same as RegisterRegisterHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterRegisterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterRegisterHandler(ctx, mux, conn)
}
// RegisterRegisterHandler registers the http handlers for service Register to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterRegisterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterRegisterHandlerClient(ctx, mux, NewRegisterClient(conn))
}
// RegisterRegisterHandlerClient registers the http handlers for service Register
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RegisterClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RegisterClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "RegisterClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterRegisterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RegisterClient) error {
mux.Handle(http.MethodPost, pattern_Register_Pwd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Register/Pwd", runtime.WithHTTPPathPattern("/passport.Register/Pwd"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Register_Pwd_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Register_Pwd_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Register_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Register/Code", runtime.WithHTTPPathPattern("/passport.Register/Code"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Register_Code_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Register_Code_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Register_Pwd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Register", "Pwd"}, ""))
pattern_Register_Code_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Register", "Code"}, ""))
)
var (
forward_Register_Pwd_0 = runtime.ForwardResponseMessage
forward_Register_Code_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,167 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: register.proto
package passport
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Register_Pwd_FullMethodName = "/passport.Register/Pwd"
Register_Code_FullMethodName = "/passport.Register/Code"
)
// RegisterClient is the client API for Register service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Passport-通行证模块-注册
type RegisterClient interface {
// 帐号密码注册
Pwd(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterReply, error)
// 手机验证码注册
Code(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterReply, error)
}
type registerClient struct {
cc grpc.ClientConnInterface
}
func NewRegisterClient(cc grpc.ClientConnInterface) RegisterClient {
return &registerClient{cc}
}
func (c *registerClient) Pwd(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RegisterReply)
err := c.cc.Invoke(ctx, Register_Pwd_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *registerClient) Code(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RegisterReply)
err := c.cc.Invoke(ctx, Register_Code_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// RegisterServer is the server API for Register service.
// All implementations must embed UnimplementedRegisterServer
// for forward compatibility.
//
// Passport-通行证模块-注册
type RegisterServer interface {
// 帐号密码注册
Pwd(context.Context, *RegisterRequest) (*RegisterReply, error)
// 手机验证码注册
Code(context.Context, *RegisterRequest) (*RegisterReply, error)
mustEmbedUnimplementedRegisterServer()
}
// UnimplementedRegisterServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedRegisterServer struct{}
func (UnimplementedRegisterServer) Pwd(context.Context, *RegisterRequest) (*RegisterReply, error) {
return nil, status.Error(codes.Unimplemented, "method Pwd not implemented")
}
func (UnimplementedRegisterServer) Code(context.Context, *RegisterRequest) (*RegisterReply, error) {
return nil, status.Error(codes.Unimplemented, "method Code not implemented")
}
func (UnimplementedRegisterServer) mustEmbedUnimplementedRegisterServer() {}
func (UnimplementedRegisterServer) testEmbeddedByValue() {}
// UnsafeRegisterServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RegisterServer will
// result in compilation errors.
type UnsafeRegisterServer interface {
mustEmbedUnimplementedRegisterServer()
}
func RegisterRegisterServer(s grpc.ServiceRegistrar, srv RegisterServer) {
// If the following call panics, it indicates UnimplementedRegisterServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Register_ServiceDesc, srv)
}
func _Register_Pwd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RegisterRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RegisterServer).Pwd(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Register_Pwd_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RegisterServer).Pwd(ctx, req.(*RegisterRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Register_Code_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RegisterRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RegisterServer).Code(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Register_Code_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RegisterServer).Code(ctx, req.(*RegisterRequest))
}
return interceptor(ctx, in, info, handler)
}
// Register_ServiceDesc is the grpc.ServiceDesc for Register service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Register_ServiceDesc = grpc.ServiceDesc{
ServiceName: "passport.Register",
HandlerType: (*RegisterServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Pwd",
Handler: _Register_Pwd_Handler,
},
{
MethodName: "Code",
Handler: _Register_Code_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "register.proto",
}

View File

@@ -0,0 +1,524 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: verify.proto
package passport
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type VerifyRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` // 服务提供商
Args map[string]string `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // 参数
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *VerifyRequest) Reset() {
*x = VerifyRequest{}
mi := &file_verify_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *VerifyRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VerifyRequest) ProtoMessage() {}
func (x *VerifyRequest) ProtoReflect() protoreflect.Message {
mi := &file_verify_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use VerifyRequest.ProtoReflect.Descriptor instead.
func (*VerifyRequest) Descriptor() ([]byte, []int) {
return file_verify_proto_rawDescGZIP(), []int{0}
}
func (x *VerifyRequest) GetProvider() string {
if x != nil {
return x.Provider
}
return ""
}
func (x *VerifyRequest) GetArgs() map[string]string {
if x != nil {
return x.Args
}
return nil
}
type JumioCallbackPayload struct {
state protoimpl.MessageState `protogen:"open.v1"`
ScanReference string `protobuf:"bytes,1,opt,name=scan_reference,json=scanReference,proto3" json:"scan_reference,omitempty"`
CustomerInternalReference string `protobuf:"bytes,2,opt,name=customer_internal_reference,json=customerInternalReference,proto3" json:"customer_internal_reference,omitempty"`
VerificationStatus *VerificationStatus `protobuf:"bytes,3,opt,name=verification_status,json=verificationStatus,proto3" json:"verification_status,omitempty"`
Document *Document `protobuf:"bytes,4,opt,name=document,proto3" json:"document,omitempty"`
// 其他可选字段
PersonalInformation *PersonalInformation `protobuf:"bytes,5,opt,name=personal_information,json=personalInformation,proto3" json:"personal_information,omitempty"`
FaceMap *FaceMap `protobuf:"bytes,6,opt,name=face_map,json=faceMap,proto3" json:"face_map,omitempty"`
CallbackDate string `protobuf:"bytes,7,opt,name=callback_date,json=callbackDate,proto3" json:"callback_date,omitempty"`
ClientIp string `protobuf:"bytes,8,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *JumioCallbackPayload) Reset() {
*x = JumioCallbackPayload{}
mi := &file_verify_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *JumioCallbackPayload) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JumioCallbackPayload) ProtoMessage() {}
func (x *JumioCallbackPayload) ProtoReflect() protoreflect.Message {
mi := &file_verify_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use JumioCallbackPayload.ProtoReflect.Descriptor instead.
func (*JumioCallbackPayload) Descriptor() ([]byte, []int) {
return file_verify_proto_rawDescGZIP(), []int{1}
}
func (x *JumioCallbackPayload) GetScanReference() string {
if x != nil {
return x.ScanReference
}
return ""
}
func (x *JumioCallbackPayload) GetCustomerInternalReference() string {
if x != nil {
return x.CustomerInternalReference
}
return ""
}
func (x *JumioCallbackPayload) GetVerificationStatus() *VerificationStatus {
if x != nil {
return x.VerificationStatus
}
return nil
}
func (x *JumioCallbackPayload) GetDocument() *Document {
if x != nil {
return x.Document
}
return nil
}
func (x *JumioCallbackPayload) GetPersonalInformation() *PersonalInformation {
if x != nil {
return x.PersonalInformation
}
return nil
}
func (x *JumioCallbackPayload) GetFaceMap() *FaceMap {
if x != nil {
return x.FaceMap
}
return nil
}
func (x *JumioCallbackPayload) GetCallbackDate() string {
if x != nil {
return x.CallbackDate
}
return ""
}
func (x *JumioCallbackPayload) GetClientIp() string {
if x != nil {
return x.ClientIp
}
return ""
}
type VerificationStatus struct {
state protoimpl.MessageState `protogen:"open.v1"`
State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` // "PENDING", "DONE", "FAILED"
Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` // 可选字段,失败原因
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *VerificationStatus) Reset() {
*x = VerificationStatus{}
mi := &file_verify_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *VerificationStatus) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VerificationStatus) ProtoMessage() {}
func (x *VerificationStatus) ProtoReflect() protoreflect.Message {
mi := &file_verify_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use VerificationStatus.ProtoReflect.Descriptor instead.
func (*VerificationStatus) Descriptor() ([]byte, []int) {
return file_verify_proto_rawDescGZIP(), []int{2}
}
func (x *VerificationStatus) GetState() string {
if x != nil {
return x.State
}
return ""
}
func (x *VerificationStatus) GetReason() string {
if x != nil {
return x.Reason
}
return ""
}
type Document struct {
state protoimpl.MessageState `protogen:"open.v1"`
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // "APPROVED_VERIFIED", "DENIED_FRAUD", etc.
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // "PASSPORT", "DRIVER_LICENSE", etc.
IssuingCountry string `protobuf:"bytes,3,opt,name=issuing_country,json=issuingCountry,proto3" json:"issuing_country,omitempty"`
Number string `protobuf:"bytes,4,opt,name=number,proto3" json:"number,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Document) Reset() {
*x = Document{}
mi := &file_verify_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Document) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Document) ProtoMessage() {}
func (x *Document) ProtoReflect() protoreflect.Message {
mi := &file_verify_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Document.ProtoReflect.Descriptor instead.
func (*Document) Descriptor() ([]byte, []int) {
return file_verify_proto_rawDescGZIP(), []int{3}
}
func (x *Document) GetStatus() string {
if x != nil {
return x.Status
}
return ""
}
func (x *Document) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *Document) GetIssuingCountry() string {
if x != nil {
return x.IssuingCountry
}
return ""
}
func (x *Document) GetNumber() string {
if x != nil {
return x.Number
}
return ""
}
type PersonalInformation struct {
state protoimpl.MessageState `protogen:"open.v1"`
FirstName string `protobuf:"bytes,1,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`
LastName string `protobuf:"bytes,2,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"`
DateOfBirth string `protobuf:"bytes,3,opt,name=date_of_birth,json=dateOfBirth,proto3" json:"date_of_birth,omitempty"`
Nationality string `protobuf:"bytes,4,opt,name=nationality,proto3" json:"nationality,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *PersonalInformation) Reset() {
*x = PersonalInformation{}
mi := &file_verify_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PersonalInformation) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PersonalInformation) ProtoMessage() {}
func (x *PersonalInformation) ProtoReflect() protoreflect.Message {
mi := &file_verify_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PersonalInformation.ProtoReflect.Descriptor instead.
func (*PersonalInformation) Descriptor() ([]byte, []int) {
return file_verify_proto_rawDescGZIP(), []int{4}
}
func (x *PersonalInformation) GetFirstName() string {
if x != nil {
return x.FirstName
}
return ""
}
func (x *PersonalInformation) GetLastName() string {
if x != nil {
return x.LastName
}
return ""
}
func (x *PersonalInformation) GetDateOfBirth() string {
if x != nil {
return x.DateOfBirth
}
return ""
}
func (x *PersonalInformation) GetNationality() string {
if x != nil {
return x.Nationality
}
return ""
}
type FaceMap struct {
state protoimpl.MessageState `protogen:"open.v1"`
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
Similarity float32 `protobuf:"fixed32,2,opt,name=similarity,proto3" json:"similarity,omitempty"` // 人脸比对相似度
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *FaceMap) Reset() {
*x = FaceMap{}
mi := &file_verify_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *FaceMap) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FaceMap) ProtoMessage() {}
func (x *FaceMap) ProtoReflect() protoreflect.Message {
mi := &file_verify_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FaceMap.ProtoReflect.Descriptor instead.
func (*FaceMap) Descriptor() ([]byte, []int) {
return file_verify_proto_rawDescGZIP(), []int{5}
}
func (x *FaceMap) GetStatus() string {
if x != nil {
return x.Status
}
return ""
}
func (x *FaceMap) GetSimilarity() float32 {
if x != nil {
return x.Similarity
}
return 0
}
var File_verify_proto protoreflect.FileDescriptor
const file_verify_proto_rawDesc = "" +
"\n" +
"\x1abase/passport/verify.proto\x12\bpassport\x1a\x15passport/blocks.proto\"\x9b\x01\n" +
"\rVerifyRequest\x12\x1a\n" +
"\bprovider\x18\x01 \x01(\tR\bprovider\x125\n" +
"\x04args\x18\x02 \x03(\v2!.passport.VerifyRequest.ArgsEntryR\x04args\x1a7\n" +
"\tArgsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xbe\x03\n" +
"\x14JumioCallbackPayload\x12%\n" +
"\x0escan_reference\x18\x01 \x01(\tR\rscanReference\x12>\n" +
"\x1bcustomer_internal_reference\x18\x02 \x01(\tR\x19customerInternalReference\x12M\n" +
"\x13verification_status\x18\x03 \x01(\v2\x1c.passport.VerificationStatusR\x12verificationStatus\x12.\n" +
"\bdocument\x18\x04 \x01(\v2\x12.passport.DocumentR\bdocument\x12P\n" +
"\x14personal_information\x18\x05 \x01(\v2\x1d.passport.PersonalInformationR\x13personalInformation\x12,\n" +
"\bface_map\x18\x06 \x01(\v2\x11.passport.FaceMapR\afaceMap\x12#\n" +
"\rcallback_date\x18\a \x01(\tR\fcallbackDate\x12\x1b\n" +
"\tclient_ip\x18\b \x01(\tR\bclientIp\"B\n" +
"\x12VerificationStatus\x12\x14\n" +
"\x05state\x18\x01 \x01(\tR\x05state\x12\x16\n" +
"\x06reason\x18\x02 \x01(\tR\x06reason\"w\n" +
"\bDocument\x12\x16\n" +
"\x06status\x18\x01 \x01(\tR\x06status\x12\x12\n" +
"\x04type\x18\x02 \x01(\tR\x04type\x12'\n" +
"\x0fissuing_country\x18\x03 \x01(\tR\x0eissuingCountry\x12\x16\n" +
"\x06number\x18\x04 \x01(\tR\x06number\"\x97\x01\n" +
"\x13PersonalInformation\x12\x1d\n" +
"\n" +
"first_name\x18\x01 \x01(\tR\tfirstName\x12\x1b\n" +
"\tlast_name\x18\x02 \x01(\tR\blastName\x12\"\n" +
"\rdate_of_birth\x18\x03 \x01(\tR\vdateOfBirth\x12 \n" +
"\vnationality\x18\x04 \x01(\tR\vnationality\"A\n" +
"\aFaceMap\x12\x16\n" +
"\x06status\x18\x01 \x01(\tR\x06status\x12\x1e\n" +
"\n" +
"similarity\x18\x02 \x01(\x02R\n" +
"similarity2\x8f\x01\n" +
"\x06Verify\x12;\n" +
"\aRequest\x12\x17.passport.VerifyRequest\x1a\x15.passport.StatusReply\"\x00\x12H\n" +
"\rJumioCallback\x12\x1e.passport.JumioCallbackPayload\x1a\x15.passport.StatusReply\"\x00B\fZ\n" +
".;passportb\x06proto3"
var (
file_verify_proto_rawDescOnce sync.Once
file_verify_proto_rawDescData []byte
)
func file_verify_proto_rawDescGZIP() []byte {
file_verify_proto_rawDescOnce.Do(func() {
file_verify_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_verify_proto_rawDesc), len(file_verify_proto_rawDesc)))
})
return file_verify_proto_rawDescData
}
var file_verify_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_verify_proto_goTypes = []any{
(*VerifyRequest)(nil), // 0: passport.VerifyRequest
(*JumioCallbackPayload)(nil), // 1: passport.JumioCallbackPayload
(*VerificationStatus)(nil), // 2: passport.VerificationStatus
(*Document)(nil), // 3: passport.Document
(*PersonalInformation)(nil), // 4: passport.PersonalInformation
(*FaceMap)(nil), // 5: passport.FaceMap
nil, // 6: passport.VerifyRequest.ArgsEntry
(*StatusReply)(nil), // 7: passport.StatusReply
}
var file_verify_proto_depIdxs = []int32{
6, // 0: passport.VerifyRequest.args:type_name -> passport.VerifyRequest.ArgsEntry
2, // 1: passport.JumioCallbackPayload.verification_status:type_name -> passport.VerificationStatus
3, // 2: passport.JumioCallbackPayload.document:type_name -> passport.Document
4, // 3: passport.JumioCallbackPayload.personal_information:type_name -> passport.PersonalInformation
5, // 4: passport.JumioCallbackPayload.face_map:type_name -> passport.FaceMap
0, // 5: passport.Verify.Request:input_type -> passport.VerifyRequest
1, // 6: passport.Verify.JumioCallback:input_type -> passport.JumioCallbackPayload
7, // 7: passport.Verify.Request:output_type -> passport.StatusReply
7, // 8: passport.Verify.JumioCallback:output_type -> passport.StatusReply
7, // [7:9] is the sub-list for method output_type
5, // [5:7] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_verify_proto_init() }
func file_verify_proto_init() {
if File_verify_proto != nil {
return
}
file_blocks_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_verify_proto_rawDesc), len(file_verify_proto_rawDesc)),
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_verify_proto_goTypes,
DependencyIndexes: file_verify_proto_depIdxs,
MessageInfos: file_verify_proto_msgTypes,
}.Build()
File_verify_proto = out.File
file_verify_proto_goTypes = nil
file_verify_proto_depIdxs = nil
}

View File

@@ -0,0 +1,223 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: verify.proto
/*
Package passport is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package passport
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Verify_Request_0(ctx context.Context, marshaler runtime.Marshaler, client VerifyClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq VerifyRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Request(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Verify_Request_0(ctx context.Context, marshaler runtime.Marshaler, server VerifyServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq VerifyRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Request(ctx, &protoReq)
return msg, metadata, err
}
func request_Verify_JumioCallback_0(ctx context.Context, marshaler runtime.Marshaler, client VerifyClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq JumioCallbackPayload
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.JumioCallback(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Verify_JumioCallback_0(ctx context.Context, marshaler runtime.Marshaler, server VerifyServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq JumioCallbackPayload
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.JumioCallback(ctx, &protoReq)
return msg, metadata, err
}
// RegisterVerifyHandlerServer registers the http handlers for service Verify to "mux".
// UnaryRPC :call VerifyServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterVerifyHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterVerifyHandlerServer(ctx context.Context, mux *runtime.ServeMux, server VerifyServer) error {
mux.Handle(http.MethodPost, pattern_Verify_Request_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Verify/Request", runtime.WithHTTPPathPattern("/passport.Verify/Request"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Verify_Request_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Verify_Request_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Verify_JumioCallback_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/passport.Verify/JumioCallback", runtime.WithHTTPPathPattern("/passport.Verify/JumioCallback"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Verify_JumioCallback_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Verify_JumioCallback_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterVerifyHandlerFromEndpoint is same as RegisterVerifyHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterVerifyHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterVerifyHandler(ctx, mux, conn)
}
// RegisterVerifyHandler registers the http handlers for service Verify to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterVerifyHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterVerifyHandlerClient(ctx, mux, NewVerifyClient(conn))
}
// RegisterVerifyHandlerClient registers the http handlers for service Verify
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "VerifyClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "VerifyClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "VerifyClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterVerifyHandlerClient(ctx context.Context, mux *runtime.ServeMux, client VerifyClient) error {
mux.Handle(http.MethodPost, pattern_Verify_Request_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Verify/Request", runtime.WithHTTPPathPattern("/passport.Verify/Request"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Verify_Request_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Verify_Request_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Verify_JumioCallback_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/passport.Verify/JumioCallback", runtime.WithHTTPPathPattern("/passport.Verify/JumioCallback"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Verify_JumioCallback_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Verify_JumioCallback_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Verify_Request_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Verify", "Request"}, ""))
pattern_Verify_JumioCallback_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"passport.Verify", "JumioCallback"}, ""))
)
var (
forward_Verify_Request_0 = runtime.ForwardResponseMessage
forward_Verify_JumioCallback_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,167 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: verify.proto
package passport
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Verify_Request_FullMethodName = "/passport.Verify/Request"
Verify_JumioCallback_FullMethodName = "/passport.Verify/JumioCallback"
)
// VerifyClient is the client API for Verify service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Passport(会员通行证)-验证
type VerifyClient interface {
// 认证请求
Request(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*StatusReply, error)
// KYC 认证回调
JumioCallback(ctx context.Context, in *JumioCallbackPayload, opts ...grpc.CallOption) (*StatusReply, error)
}
type verifyClient struct {
cc grpc.ClientConnInterface
}
func NewVerifyClient(cc grpc.ClientConnInterface) VerifyClient {
return &verifyClient{cc}
}
func (c *verifyClient) Request(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Verify_Request_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *verifyClient) JumioCallback(ctx context.Context, in *JumioCallbackPayload, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Verify_JumioCallback_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// VerifyServer is the server API for Verify service.
// All implementations must embed UnimplementedVerifyServer
// for forward compatibility.
//
// Passport(会员通行证)-验证
type VerifyServer interface {
// 认证请求
Request(context.Context, *VerifyRequest) (*StatusReply, error)
// KYC 认证回调
JumioCallback(context.Context, *JumioCallbackPayload) (*StatusReply, error)
mustEmbedUnimplementedVerifyServer()
}
// UnimplementedVerifyServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedVerifyServer struct{}
func (UnimplementedVerifyServer) Request(context.Context, *VerifyRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Request not implemented")
}
func (UnimplementedVerifyServer) JumioCallback(context.Context, *JumioCallbackPayload) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method JumioCallback not implemented")
}
func (UnimplementedVerifyServer) mustEmbedUnimplementedVerifyServer() {}
func (UnimplementedVerifyServer) testEmbeddedByValue() {}
// UnsafeVerifyServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to VerifyServer will
// result in compilation errors.
type UnsafeVerifyServer interface {
mustEmbedUnimplementedVerifyServer()
}
func RegisterVerifyServer(s grpc.ServiceRegistrar, srv VerifyServer) {
// If the following call panics, it indicates UnimplementedVerifyServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Verify_ServiceDesc, srv)
}
func _Verify_Request_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VerifyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VerifyServer).Request(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Verify_Request_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VerifyServer).Request(ctx, req.(*VerifyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Verify_JumioCallback_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(JumioCallbackPayload)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VerifyServer).JumioCallback(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Verify_JumioCallback_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VerifyServer).JumioCallback(ctx, req.(*JumioCallbackPayload))
}
return interceptor(ctx, in, info, handler)
}
// Verify_ServiceDesc is the grpc.ServiceDesc for Verify service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Verify_ServiceDesc = grpc.ServiceDesc{
ServiceName: "passport.Verify",
HandlerType: (*VerifyServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Request",
Handler: _Verify_Request_Handler,
},
{
MethodName: "JumioCallback",
Handler: _Verify_JumioCallback_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "verify.proto",
}