feat 协议

This commit is contained in:
2026-01-13 17:54:15 +08:00
parent 7812a3c669
commit 34b2e45e3d
2 changed files with 258 additions and 80 deletions

View File

@@ -22,8 +22,8 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// ---------- Login ----------
type LoginReq struct {
// ---------- PhoneLogin ----------
type PhoneLoginReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@@ -32,8 +32,8 @@ type LoginReq struct {
Code string `protobuf:"bytes,2,opt,name=Code,json=code,proto3" json:"Code,omitempty"` // 验证码
}
func (x *LoginReq) Reset() {
*x = LoginReq{}
func (x *PhoneLoginReq) Reset() {
*x = PhoneLoginReq{}
if protoimpl.UnsafeEnabled {
mi := &file_service_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -41,13 +41,13 @@ func (x *LoginReq) Reset() {
}
}
func (x *LoginReq) String() string {
func (x *PhoneLoginReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginReq) ProtoMessage() {}
func (*PhoneLoginReq) ProtoMessage() {}
func (x *LoginReq) ProtoReflect() protoreflect.Message {
func (x *PhoneLoginReq) ProtoReflect() protoreflect.Message {
mi := &file_service_user_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -59,26 +59,26 @@ func (x *LoginReq) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use LoginReq.ProtoReflect.Descriptor instead.
func (*LoginReq) Descriptor() ([]byte, []int) {
// Deprecated: Use PhoneLoginReq.ProtoReflect.Descriptor instead.
func (*PhoneLoginReq) Descriptor() ([]byte, []int) {
return file_service_user_proto_rawDescGZIP(), []int{0}
}
func (x *LoginReq) GetPhone() string {
func (x *PhoneLoginReq) GetPhone() string {
if x != nil {
return x.Phone
}
return ""
}
func (x *LoginReq) GetCode() string {
func (x *PhoneLoginReq) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
type LoginResp struct {
type PhoneLoginResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@@ -87,8 +87,8 @@ type LoginResp struct {
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
}
func (x *LoginResp) Reset() {
*x = LoginResp{}
func (x *PhoneLoginResp) Reset() {
*x = PhoneLoginResp{}
if protoimpl.UnsafeEnabled {
mi := &file_service_user_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -96,13 +96,13 @@ func (x *LoginResp) Reset() {
}
}
func (x *LoginResp) String() string {
func (x *PhoneLoginResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginResp) ProtoMessage() {}
func (*PhoneLoginResp) ProtoMessage() {}
func (x *LoginResp) ProtoReflect() protoreflect.Message {
func (x *PhoneLoginResp) ProtoReflect() protoreflect.Message {
mi := &file_service_user_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -114,19 +114,122 @@ func (x *LoginResp) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use LoginResp.ProtoReflect.Descriptor instead.
func (*LoginResp) Descriptor() ([]byte, []int) {
// Deprecated: Use PhoneLoginResp.ProtoReflect.Descriptor instead.
func (*PhoneLoginResp) Descriptor() ([]byte, []int) {
return file_service_user_proto_rawDescGZIP(), []int{1}
}
func (x *LoginResp) GetUSN() string {
func (x *PhoneLoginResp) GetUSN() string {
if x != nil {
return x.USN
}
return ""
}
func (x *LoginResp) GetName() string {
func (x *PhoneLoginResp) GetName() string {
if x != nil {
return x.Name
}
return ""
}
// ---------- WxMiniLogin ----------
type WxMiniLoginReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code string `protobuf:"bytes,1,opt,name=Code,json=code,proto3" json:"Code,omitempty"` // 微信小程序登录凭证
}
func (x *WxMiniLoginReq) Reset() {
*x = WxMiniLoginReq{}
if protoimpl.UnsafeEnabled {
mi := &file_service_user_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *WxMiniLoginReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WxMiniLoginReq) ProtoMessage() {}
func (x *WxMiniLoginReq) ProtoReflect() protoreflect.Message {
mi := &file_service_user_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WxMiniLoginReq.ProtoReflect.Descriptor instead.
func (*WxMiniLoginReq) Descriptor() ([]byte, []int) {
return file_service_user_proto_rawDescGZIP(), []int{2}
}
func (x *WxMiniLoginReq) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
type WxMiniLoginResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
}
func (x *WxMiniLoginResp) Reset() {
*x = WxMiniLoginResp{}
if protoimpl.UnsafeEnabled {
mi := &file_service_user_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *WxMiniLoginResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WxMiniLoginResp) ProtoMessage() {}
func (x *WxMiniLoginResp) ProtoReflect() protoreflect.Message {
mi := &file_service_user_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WxMiniLoginResp.ProtoReflect.Descriptor instead.
func (*WxMiniLoginResp) Descriptor() ([]byte, []int) {
return file_service_user_proto_rawDescGZIP(), []int{3}
}
func (x *WxMiniLoginResp) GetUSN() string {
if x != nil {
return x.USN
}
return ""
}
func (x *WxMiniLoginResp) GetName() string {
if x != nil {
return x.Name
}
@@ -145,7 +248,7 @@ type GetUserInfoReq struct {
func (x *GetUserInfoReq) Reset() {
*x = GetUserInfoReq{}
if protoimpl.UnsafeEnabled {
mi := &file_service_user_proto_msgTypes[2]
mi := &file_service_user_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -158,7 +261,7 @@ func (x *GetUserInfoReq) String() string {
func (*GetUserInfoReq) ProtoMessage() {}
func (x *GetUserInfoReq) ProtoReflect() protoreflect.Message {
mi := &file_service_user_proto_msgTypes[2]
mi := &file_service_user_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -171,7 +274,7 @@ func (x *GetUserInfoReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetUserInfoReq.ProtoReflect.Descriptor instead.
func (*GetUserInfoReq) Descriptor() ([]byte, []int) {
return file_service_user_proto_rawDescGZIP(), []int{2}
return file_service_user_proto_rawDescGZIP(), []int{4}
}
func (x *GetUserInfoReq) GetUSN() string {
@@ -193,7 +296,7 @@ type GetUserInfoResp struct {
func (x *GetUserInfoResp) Reset() {
*x = GetUserInfoResp{}
if protoimpl.UnsafeEnabled {
mi := &file_service_user_proto_msgTypes[3]
mi := &file_service_user_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -206,7 +309,7 @@ func (x *GetUserInfoResp) String() string {
func (*GetUserInfoResp) ProtoMessage() {}
func (x *GetUserInfoResp) ProtoReflect() protoreflect.Message {
mi := &file_service_user_proto_msgTypes[3]
mi := &file_service_user_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -219,7 +322,7 @@ func (x *GetUserInfoResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetUserInfoResp.ProtoReflect.Descriptor instead.
func (*GetUserInfoResp) Descriptor() ([]byte, []int) {
return file_service_user_proto_rawDescGZIP(), []int{3}
return file_service_user_proto_rawDescGZIP(), []int{5}
}
func (x *GetUserInfoResp) GetUSN() string {
@@ -243,30 +346,41 @@ var file_service_user_proto_rawDesc = []byte{
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12,
0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x31, 0x0a, 0x09, 0x4c, 0x6f, 0x67,
0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x0e,
0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10,
0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e,
0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x71, 0x0a, 0x04, 0x55, 0x73, 0x65,
0x72, 0x12, 0x20, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x09, 0x2e, 0x4c, 0x6f, 0x67,
0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73,
0x70, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e,
0x66, 0x6f, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66,
0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a,
0x22, 0x0a, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x36, 0x5a, 0x34,
0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d,
0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70,
0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69,
0x6e, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f,
0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x36,
0x0a, 0x0e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69,
0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x37, 0x0a, 0x0f,
0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73,
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74,
0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03,
0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12,
0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x32, 0xb4, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x0a, 0x50,
0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x2e, 0x50, 0x68, 0x6f, 0x6e,
0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x50, 0x68, 0x6f, 0x6e,
0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x0b,
0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0f, 0x2e, 0x57, 0x78,
0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x57,
0x78, 0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00,
0x12, 0x47, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12,
0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65,
0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a, 0x22, 0x0a, 0x2f,
0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74,
0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70,
0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -281,20 +395,24 @@ func file_service_user_proto_rawDescGZIP() []byte {
return file_service_user_proto_rawDescData
}
var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_service_user_proto_goTypes = []interface{}{
(*LoginReq)(nil), // 0: LoginReq
(*LoginResp)(nil), // 1: LoginResp
(*GetUserInfoReq)(nil), // 2: GetUserInfoReq
(*GetUserInfoResp)(nil), // 3: GetUserInfoResp
(*PhoneLoginReq)(nil), // 0: PhoneLoginReq
(*PhoneLoginResp)(nil), // 1: PhoneLoginResp
(*WxMiniLoginReq)(nil), // 2: WxMiniLoginReq
(*WxMiniLoginResp)(nil), // 3: WxMiniLoginResp
(*GetUserInfoReq)(nil), // 4: GetUserInfoReq
(*GetUserInfoResp)(nil), // 5: GetUserInfoResp
}
var file_service_user_proto_depIdxs = []int32{
0, // 0: User.Login:input_type -> LoginReq
2, // 1: User.GetUserInfo:input_type -> GetUserInfoReq
1, // 2: User.Login:output_type -> LoginResp
3, // 3: User.GetUserInfo:output_type -> GetUserInfoResp
2, // [2:4] is the sub-list for method output_type
0, // [0:2] is the sub-list for method input_type
0, // 0: User.PhoneLogin:input_type -> PhoneLoginReq
2, // 1: User.WxMiniLogin:input_type -> WxMiniLoginReq
4, // 2: User.GetUserInfo:input_type -> GetUserInfoReq
1, // 3: User.PhoneLogin:output_type -> PhoneLoginResp
3, // 4: User.WxMiniLogin:output_type -> WxMiniLoginResp
5, // 5: User.GetUserInfo:output_type -> GetUserInfoResp
3, // [3:6] is the sub-list for method output_type
0, // [0:3] 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
@@ -307,7 +425,7 @@ func file_service_user_proto_init() {
}
if !protoimpl.UnsafeEnabled {
file_service_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoginReq); i {
switch v := v.(*PhoneLoginReq); i {
case 0:
return &v.state
case 1:
@@ -319,7 +437,7 @@ func file_service_user_proto_init() {
}
}
file_service_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoginResp); i {
switch v := v.(*PhoneLoginResp); i {
case 0:
return &v.state
case 1:
@@ -331,7 +449,7 @@ func file_service_user_proto_init() {
}
}
file_service_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserInfoReq); i {
switch v := v.(*WxMiniLoginReq); i {
case 0:
return &v.state
case 1:
@@ -343,6 +461,30 @@ func file_service_user_proto_init() {
}
}
file_service_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WxMiniLoginResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserInfoReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserInfoResp); i {
case 0:
return &v.state
@@ -361,7 +503,7 @@ func file_service_user_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_service_user_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},

View File

@@ -22,7 +22,8 @@ const _ = grpc.SupportPackageIsVersion7
//
// 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.
type UserClient interface {
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error)
PhoneLogin(ctx context.Context, in *PhoneLoginReq, opts ...grpc.CallOption) (*PhoneLoginResp, error)
WxMiniLogin(ctx context.Context, in *WxMiniLoginReq, opts ...grpc.CallOption) (*WxMiniLoginResp, error)
// 获取用户信息
GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error)
}
@@ -35,9 +36,18 @@ func NewUserClient(cc grpc.ClientConnInterface) UserClient {
return &userClient{cc}
}
func (c *userClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
out := new(LoginResp)
err := c.cc.Invoke(ctx, "/User/Login", in, out, opts...)
func (c *userClient) PhoneLogin(ctx context.Context, in *PhoneLoginReq, opts ...grpc.CallOption) (*PhoneLoginResp, error) {
out := new(PhoneLoginResp)
err := c.cc.Invoke(ctx, "/User/PhoneLogin", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userClient) WxMiniLogin(ctx context.Context, in *WxMiniLoginReq, opts ...grpc.CallOption) (*WxMiniLoginResp, error) {
out := new(WxMiniLoginResp)
err := c.cc.Invoke(ctx, "/User/WxMiniLogin", in, out, opts...)
if err != nil {
return nil, err
}
@@ -57,7 +67,8 @@ func (c *userClient) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts .
// All implementations must embed UnimplementedUserServer
// for forward compatibility
type UserServer interface {
Login(context.Context, *LoginReq) (*LoginResp, error)
PhoneLogin(context.Context, *PhoneLoginReq) (*PhoneLoginResp, error)
WxMiniLogin(context.Context, *WxMiniLoginReq) (*WxMiniLoginResp, error)
// 获取用户信息
GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error)
mustEmbedUnimplementedUserServer()
@@ -67,8 +78,11 @@ type UserServer interface {
type UnimplementedUserServer struct {
}
func (UnimplementedUserServer) Login(context.Context, *LoginReq) (*LoginResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
func (UnimplementedUserServer) PhoneLogin(context.Context, *PhoneLoginReq) (*PhoneLoginResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method PhoneLogin not implemented")
}
func (UnimplementedUserServer) WxMiniLogin(context.Context, *WxMiniLoginReq) (*WxMiniLoginResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method WxMiniLogin not implemented")
}
func (UnimplementedUserServer) GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented")
@@ -86,20 +100,38 @@ func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer) {
s.RegisterService(&User_ServiceDesc, srv)
}
func _User_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginReq)
func _User_PhoneLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PhoneLoginReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServer).Login(ctx, in)
return srv.(UserServer).PhoneLogin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/User/Login",
FullMethod: "/User/PhoneLogin",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServer).Login(ctx, req.(*LoginReq))
return srv.(UserServer).PhoneLogin(ctx, req.(*PhoneLoginReq))
}
return interceptor(ctx, in, info, handler)
}
func _User_WxMiniLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(WxMiniLoginReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServer).WxMiniLogin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/User/WxMiniLogin",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServer).WxMiniLogin(ctx, req.(*WxMiniLoginReq))
}
return interceptor(ctx, in, info, handler)
}
@@ -130,8 +162,12 @@ var User_ServiceDesc = grpc.ServiceDesc{
HandlerType: (*UserServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Login",
Handler: _User_Login_Handler,
MethodName: "PhoneLogin",
Handler: _User_PhoneLogin_Handler,
},
{
MethodName: "WxMiniLogin",
Handler: _User_WxMiniLogin_Handler,
},
{
MethodName: "GetUserInfo",