build
This commit is contained in:
commit
0772e8d0da
871
api/exhibition/exhibition.pb.go
Normal file
871
api/exhibition/exhibition.pb.go
Normal file
@ -0,0 +1,871 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.0
|
||||
// protoc v3.21.1
|
||||
// source: pb/exhibition.proto
|
||||
|
||||
package exhibition
|
||||
|
||||
import (
|
||||
_ "github.com/mwitkow/go-proto-validators"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
_ "google.golang.org/protobuf/types/descriptorpb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
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 RegisterInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
|
||||
Uuid string `protobuf:"bytes,2,opt,name=uuid,proto3" json:"uuid"`
|
||||
ArtistName string `protobuf:"bytes,3,opt,name=artistName,proto3" json:"artistName"`
|
||||
Gender int32 `protobuf:"varint,4,opt,name=gender,proto3" json:"gender"`
|
||||
PhoneNum string `protobuf:"bytes,5,opt,name=phoneNum,proto3" json:"phoneNum"`
|
||||
IdCard string `protobuf:"bytes,6,opt,name=idCard,proto3" json:"idCard"`
|
||||
Address string `protobuf:"bytes,7,opt,name=address,proto3" json:"address"`
|
||||
IdCardPhoto string `protobuf:"bytes,8,opt,name=idCardPhoto,proto3" json:"idCardPhoto"`
|
||||
ArtistPhoto string `protobuf:"bytes,9,opt,name=artistPhoto,proto3" json:"artistPhoto"`
|
||||
CreatedAt string `protobuf:"bytes,10,opt,name=createdAt,proto3" json:"createdAt"`
|
||||
UpdatedAt string `protobuf:"bytes,11,opt,name=updatedAt,proto3" json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) Reset() {
|
||||
*x = RegisterInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RegisterInfo) ProtoMessage() {}
|
||||
|
||||
func (x *RegisterInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[0]
|
||||
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 RegisterInfo.ProtoReflect.Descriptor instead.
|
||||
func (*RegisterInfo) Descriptor() ([]byte, []int) {
|
||||
return file_pb_exhibition_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetId() int32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetUuid() string {
|
||||
if x != nil {
|
||||
return x.Uuid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetArtistName() string {
|
||||
if x != nil {
|
||||
return x.ArtistName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetGender() int32 {
|
||||
if x != nil {
|
||||
return x.Gender
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetPhoneNum() string {
|
||||
if x != nil {
|
||||
return x.PhoneNum
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetIdCard() string {
|
||||
if x != nil {
|
||||
return x.IdCard
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetAddress() string {
|
||||
if x != nil {
|
||||
return x.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetIdCardPhoto() string {
|
||||
if x != nil {
|
||||
return x.IdCardPhoto
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetArtistPhoto() string {
|
||||
if x != nil {
|
||||
return x.ArtistPhoto
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetCreatedAt() string {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterInfo) GetUpdatedAt() string {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SaveRegisterRecordResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg"`
|
||||
}
|
||||
|
||||
func (x *SaveRegisterRecordResp) Reset() {
|
||||
*x = SaveRegisterRecordResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SaveRegisterRecordResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SaveRegisterRecordResp) ProtoMessage() {}
|
||||
|
||||
func (x *SaveRegisterRecordResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[1]
|
||||
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 SaveRegisterRecordResp.ProtoReflect.Descriptor instead.
|
||||
func (*SaveRegisterRecordResp) Descriptor() ([]byte, []int) {
|
||||
return file_pb_exhibition_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *SaveRegisterRecordResp) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CheckPhoneResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
IsExist bool `protobuf:"varint,1,opt,name=isExist,proto3" json:"isExist"`
|
||||
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
|
||||
Data *RegisterInfo `protobuf:"bytes,3,opt,name=data,proto3" json:"data"`
|
||||
}
|
||||
|
||||
func (x *CheckPhoneResp) Reset() {
|
||||
*x = CheckPhoneResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CheckPhoneResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CheckPhoneResp) ProtoMessage() {}
|
||||
|
||||
func (x *CheckPhoneResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_exhibition_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 CheckPhoneResp.ProtoReflect.Descriptor instead.
|
||||
func (*CheckPhoneResp) Descriptor() ([]byte, []int) {
|
||||
return file_pb_exhibition_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *CheckPhoneResp) GetIsExist() bool {
|
||||
if x != nil {
|
||||
return x.IsExist
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *CheckPhoneResp) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CheckPhoneResp) GetData() *RegisterInfo {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type RecordListReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Keyword string `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword"`
|
||||
Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page"`
|
||||
PageSize int32 `protobuf:"varint,3,opt,name=pageSize,proto3" json:"pageSize"`
|
||||
}
|
||||
|
||||
func (x *RecordListReq) Reset() {
|
||||
*x = RecordListReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RecordListReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RecordListReq) ProtoMessage() {}
|
||||
|
||||
func (x *RecordListReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_exhibition_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 RecordListReq.ProtoReflect.Descriptor instead.
|
||||
func (*RecordListReq) Descriptor() ([]byte, []int) {
|
||||
return file_pb_exhibition_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *RecordListReq) GetKeyword() string {
|
||||
if x != nil {
|
||||
return x.Keyword
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RecordListReq) GetPage() int32 {
|
||||
if x != nil {
|
||||
return x.Page
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RecordListReq) GetPageSize() int32 {
|
||||
if x != nil {
|
||||
return x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type RecordListResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data []*RegisterInfo `protobuf:"bytes,1,rep,name=data,proto3" json:"data"`
|
||||
Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count"`
|
||||
Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page"`
|
||||
PageSize int32 `protobuf:"varint,4,opt,name=pageSize,proto3" json:"pageSize"`
|
||||
Msg string `protobuf:"bytes,5,opt,name=msg,proto3" json:"msg"`
|
||||
}
|
||||
|
||||
func (x *RecordListResp) Reset() {
|
||||
*x = RecordListResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RecordListResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RecordListResp) ProtoMessage() {}
|
||||
|
||||
func (x *RecordListResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[4]
|
||||
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 RecordListResp.ProtoReflect.Descriptor instead.
|
||||
func (*RecordListResp) Descriptor() ([]byte, []int) {
|
||||
return file_pb_exhibition_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *RecordListResp) GetData() []*RegisterInfo {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RecordListResp) GetCount() int32 {
|
||||
if x != nil {
|
||||
return x.Count
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RecordListResp) GetPage() int32 {
|
||||
if x != nil {
|
||||
return x.Page
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RecordListResp) GetPageSize() int32 {
|
||||
if x != nil {
|
||||
return x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RecordListResp) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ExportRecordReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *ExportRecordReq) Reset() {
|
||||
*x = ExportRecordReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ExportRecordReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExportRecordReq) ProtoMessage() {}
|
||||
|
||||
func (x *ExportRecordReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[5]
|
||||
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 ExportRecordReq.ProtoReflect.Descriptor instead.
|
||||
func (*ExportRecordReq) Descriptor() ([]byte, []int) {
|
||||
return file_pb_exhibition_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
type ExportInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ArtistName string `protobuf:"bytes,3,opt,name=artistName,proto3" json:"artistName"`
|
||||
Gender int32 `protobuf:"varint,4,opt,name=gender,proto3" json:"gender"`
|
||||
PhoneNum string `protobuf:"bytes,5,opt,name=phoneNum,proto3" json:"phoneNum"`
|
||||
IdCard string `protobuf:"bytes,6,opt,name=idCard,proto3" json:"idCard"`
|
||||
Address string `protobuf:"bytes,7,opt,name=address,proto3" json:"address"`
|
||||
IdCardPhoto string `protobuf:"bytes,8,opt,name=idCardPhoto,proto3" json:"idCardPhoto"`
|
||||
ArtistPhoto string `protobuf:"bytes,9,opt,name=artistPhoto,proto3" json:"artistPhoto"`
|
||||
CreatedAt string `protobuf:"bytes,10,opt,name=createdAt,proto3" json:"createdAt"`
|
||||
UpdatedAt string `protobuf:"bytes,11,opt,name=updatedAt,proto3" json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (x *ExportInfo) Reset() {
|
||||
*x = ExportInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ExportInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExportInfo) ProtoMessage() {}
|
||||
|
||||
func (x *ExportInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[6]
|
||||
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 ExportInfo.ProtoReflect.Descriptor instead.
|
||||
func (*ExportInfo) Descriptor() ([]byte, []int) {
|
||||
return file_pb_exhibition_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *ExportInfo) GetArtistName() string {
|
||||
if x != nil {
|
||||
return x.ArtistName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ExportInfo) GetGender() int32 {
|
||||
if x != nil {
|
||||
return x.Gender
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ExportInfo) GetPhoneNum() string {
|
||||
if x != nil {
|
||||
return x.PhoneNum
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ExportInfo) GetIdCard() string {
|
||||
if x != nil {
|
||||
return x.IdCard
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ExportInfo) GetAddress() string {
|
||||
if x != nil {
|
||||
return x.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ExportInfo) GetIdCardPhoto() string {
|
||||
if x != nil {
|
||||
return x.IdCardPhoto
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ExportInfo) GetArtistPhoto() string {
|
||||
if x != nil {
|
||||
return x.ArtistPhoto
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ExportInfo) GetCreatedAt() string {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ExportInfo) GetUpdatedAt() string {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ExportRecordResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data []*ExportInfo `protobuf:"bytes,1,rep,name=data,proto3" json:"data"`
|
||||
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
|
||||
}
|
||||
|
||||
func (x *ExportRecordResp) Reset() {
|
||||
*x = ExportRecordResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ExportRecordResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExportRecordResp) ProtoMessage() {}
|
||||
|
||||
func (x *ExportRecordResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_exhibition_proto_msgTypes[7]
|
||||
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 ExportRecordResp.ProtoReflect.Descriptor instead.
|
||||
func (*ExportRecordResp) Descriptor() ([]byte, []int) {
|
||||
return file_pb_exhibition_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *ExportRecordResp) GetData() []*ExportInfo {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ExportRecordResp) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_pb_exhibition_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_pb_exhibition_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x70, 0x62, 0x2f, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x1a, 0x12, 0x70, 0x62, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x70, 0x62, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
|
||||
0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb8, 0x02, 0x0a, 0x0c, 0x52,
|
||||
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75,
|
||||
0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12,
|
||||
0x1e, 0x0a, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65,
|
||||
0x4e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65,
|
||||
0x4e, 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x18, 0x06, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64,
|
||||
0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x50,
|
||||
0x68, 0x6f, 0x74, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x64, 0x43, 0x61,
|
||||
0x72, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x72, 0x74, 0x69, 0x73,
|
||||
0x74, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x72,
|
||||
0x74, 0x69, 0x73, 0x74, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65,
|
||||
0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72,
|
||||
0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74,
|
||||
0x65, 0x64, 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x2a, 0x0a, 0x16, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x67,
|
||||
0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73,
|
||||
0x67, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52,
|
||||
0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x45, 0x78, 0x69, 0x73, 0x74, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x45, 0x78, 0x69, 0x73, 0x74, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12,
|
||||
0x2c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e,
|
||||
0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73,
|
||||
0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x59, 0x0a,
|
||||
0x0d, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
|
||||
0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x0e, 0x52, 0x65, 0x63,
|
||||
0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x04, 0x64,
|
||||
0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x78, 0x68, 0x69,
|
||||
0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70,
|
||||
0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73,
|
||||
0x67, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
||||
0x64, 0x52, 0x65, 0x71, 0x22, 0x92, 0x02, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e,
|
||||
0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70,
|
||||
0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70,
|
||||
0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x64, 0x43, 0x61, 0x72,
|
||||
0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x64, 0x43,
|
||||
0x61, 0x72, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
|
||||
0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x61,
|
||||
0x72, 0x74, 0x69, 0x73, 0x74, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0b, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x0a,
|
||||
0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x75,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
|
||||
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x50, 0x0a, 0x10, 0x45, 0x78, 0x70,
|
||||
0x6f, 0x72, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, 0x0a,
|
||||
0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x78,
|
||||
0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x32, 0xc4, 0x02, 0x0a, 0x0a,
|
||||
0x45, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x0a, 0x43, 0x68,
|
||||
0x65, 0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x18, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62,
|
||||
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x1a, 0x1a, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
|
||||
0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x52,
|
||||
0x0a, 0x12, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65,
|
||||
0x63, 0x6f, 0x72, 0x64, 0x12, 0x18, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x22,
|
||||
0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x61, 0x76, 0x65,
|
||||
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65,
|
||||
0x73, 0x70, 0x12, 0x4b, 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65,
|
||||
0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x19, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62,
|
||||
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74,
|
||||
0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x51, 0x0a, 0x14, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
|
||||
0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
||||
0x64, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65,
|
||||
0x73, 0x70, 0x42, 0x11, 0x5a, 0x0f, 0x2e, 0x2f, 0x70, 0x62, 0x2f, 0x65, 0x78, 0x68, 0x69, 0x62,
|
||||
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_pb_exhibition_proto_rawDescOnce sync.Once
|
||||
file_pb_exhibition_proto_rawDescData = file_pb_exhibition_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_pb_exhibition_proto_rawDescGZIP() []byte {
|
||||
file_pb_exhibition_proto_rawDescOnce.Do(func() {
|
||||
file_pb_exhibition_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_exhibition_proto_rawDescData)
|
||||
})
|
||||
return file_pb_exhibition_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_pb_exhibition_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_pb_exhibition_proto_goTypes = []interface{}{
|
||||
(*RegisterInfo)(nil), // 0: exhibition.RegisterInfo
|
||||
(*SaveRegisterRecordResp)(nil), // 1: exhibition.SaveRegisterRecordResp
|
||||
(*CheckPhoneResp)(nil), // 2: exhibition.CheckPhoneResp
|
||||
(*RecordListReq)(nil), // 3: exhibition.RecordListReq
|
||||
(*RecordListResp)(nil), // 4: exhibition.RecordListResp
|
||||
(*ExportRecordReq)(nil), // 5: exhibition.ExportRecordReq
|
||||
(*ExportInfo)(nil), // 6: exhibition.ExportInfo
|
||||
(*ExportRecordResp)(nil), // 7: exhibition.ExportRecordResp
|
||||
}
|
||||
var file_pb_exhibition_proto_depIdxs = []int32{
|
||||
0, // 0: exhibition.CheckPhoneResp.data:type_name -> exhibition.RegisterInfo
|
||||
0, // 1: exhibition.RecordListResp.data:type_name -> exhibition.RegisterInfo
|
||||
6, // 2: exhibition.ExportRecordResp.data:type_name -> exhibition.ExportInfo
|
||||
0, // 3: exhibition.Exhibition.CheckPhone:input_type -> exhibition.RegisterInfo
|
||||
0, // 4: exhibition.Exhibition.SaveRegisterRecord:input_type -> exhibition.RegisterInfo
|
||||
3, // 5: exhibition.Exhibition.RegisterRecordList:input_type -> exhibition.RecordListReq
|
||||
5, // 6: exhibition.Exhibition.ExportRegisterRecord:input_type -> exhibition.ExportRecordReq
|
||||
2, // 7: exhibition.Exhibition.CheckPhone:output_type -> exhibition.CheckPhoneResp
|
||||
1, // 8: exhibition.Exhibition.SaveRegisterRecord:output_type -> exhibition.SaveRegisterRecordResp
|
||||
4, // 9: exhibition.Exhibition.RegisterRecordList:output_type -> exhibition.RecordListResp
|
||||
7, // 10: exhibition.Exhibition.ExportRegisterRecord:output_type -> exhibition.ExportRecordResp
|
||||
7, // [7:11] is the sub-list for method output_type
|
||||
3, // [3:7] 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_pb_exhibition_proto_init() }
|
||||
func file_pb_exhibition_proto_init() {
|
||||
if File_pb_exhibition_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_pb_exhibition_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RegisterInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pb_exhibition_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SaveRegisterRecordResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pb_exhibition_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CheckPhoneResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pb_exhibition_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RecordListReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pb_exhibition_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RecordListResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pb_exhibition_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ExportRecordReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pb_exhibition_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ExportInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pb_exhibition_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ExportRecordResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_pb_exhibition_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_pb_exhibition_proto_goTypes,
|
||||
DependencyIndexes: file_pb_exhibition_proto_depIdxs,
|
||||
MessageInfos: file_pb_exhibition_proto_msgTypes,
|
||||
}.Build()
|
||||
File_pb_exhibition_proto = out.File
|
||||
file_pb_exhibition_proto_rawDesc = nil
|
||||
file_pb_exhibition_proto_goTypes = nil
|
||||
file_pb_exhibition_proto_depIdxs = nil
|
||||
}
|
62
api/exhibition/exhibition.validator.pb.go
Normal file
62
api/exhibition/exhibition.validator.pb.go
Normal file
@ -0,0 +1,62 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: pb/exhibition.proto
|
||||
|
||||
package exhibition
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
_ "github.com/mwitkow/go-proto-validators"
|
||||
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||
_ "google.golang.org/protobuf/types/descriptorpb"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
func (this *RegisterInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SaveRegisterRecordResp) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CheckPhoneResp) Validate() error {
|
||||
if this.Data != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Data); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *RecordListReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RecordListResp) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ExportRecordReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ExportInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ExportRecordResp) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
282
api/exhibition/exhibition_triple.pb.go
Normal file
282
api/exhibition/exhibition_triple.pb.go
Normal file
@ -0,0 +1,282 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.5
|
||||
// - protoc v3.21.1
|
||||
// source: pb/exhibition.proto
|
||||
|
||||
package exhibition
|
||||
|
||||
import (
|
||||
context "context"
|
||||
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
|
||||
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
|
||||
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
|
||||
grpc_go "github.com/dubbogo/grpc-go"
|
||||
codes "github.com/dubbogo/grpc-go/codes"
|
||||
metadata "github.com/dubbogo/grpc-go/metadata"
|
||||
status "github.com/dubbogo/grpc-go/status"
|
||||
common "github.com/dubbogo/triple/pkg/common"
|
||||
constant "github.com/dubbogo/triple/pkg/common/constant"
|
||||
triple "github.com/dubbogo/triple/pkg/triple"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc_go.SupportPackageIsVersion7
|
||||
|
||||
// ExhibitionClient is the client API for Exhibition 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.
|
||||
type ExhibitionClient interface {
|
||||
CheckPhone(ctx context.Context, in *RegisterInfo, opts ...grpc_go.CallOption) (*CheckPhoneResp, common.ErrorWithAttachment)
|
||||
SaveRegisterRecord(ctx context.Context, in *RegisterInfo, opts ...grpc_go.CallOption) (*SaveRegisterRecordResp, common.ErrorWithAttachment)
|
||||
RegisterRecordList(ctx context.Context, in *RecordListReq, opts ...grpc_go.CallOption) (*RecordListResp, common.ErrorWithAttachment)
|
||||
ExportRegisterRecord(ctx context.Context, in *ExportRecordReq, opts ...grpc_go.CallOption) (*ExportRecordResp, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type exhibitionClient struct {
|
||||
cc *triple.TripleConn
|
||||
}
|
||||
|
||||
type ExhibitionClientImpl struct {
|
||||
CheckPhone func(ctx context.Context, in *RegisterInfo) (*CheckPhoneResp, error)
|
||||
SaveRegisterRecord func(ctx context.Context, in *RegisterInfo) (*SaveRegisterRecordResp, error)
|
||||
RegisterRecordList func(ctx context.Context, in *RecordListReq) (*RecordListResp, error)
|
||||
ExportRegisterRecord func(ctx context.Context, in *ExportRecordReq) (*ExportRecordResp, error)
|
||||
}
|
||||
|
||||
func (c *ExhibitionClientImpl) GetDubboStub(cc *triple.TripleConn) ExhibitionClient {
|
||||
return NewExhibitionClient(cc)
|
||||
}
|
||||
|
||||
func (c *ExhibitionClientImpl) XXX_InterfaceName() string {
|
||||
return "exhibition.Exhibition"
|
||||
}
|
||||
|
||||
func NewExhibitionClient(cc *triple.TripleConn) ExhibitionClient {
|
||||
return &exhibitionClient{cc}
|
||||
}
|
||||
|
||||
func (c *exhibitionClient) CheckPhone(ctx context.Context, in *RegisterInfo, opts ...grpc_go.CallOption) (*CheckPhoneResp, common.ErrorWithAttachment) {
|
||||
out := new(CheckPhoneResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CheckPhone", in, out)
|
||||
}
|
||||
|
||||
func (c *exhibitionClient) SaveRegisterRecord(ctx context.Context, in *RegisterInfo, opts ...grpc_go.CallOption) (*SaveRegisterRecordResp, common.ErrorWithAttachment) {
|
||||
out := new(SaveRegisterRecordResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SaveRegisterRecord", in, out)
|
||||
}
|
||||
|
||||
func (c *exhibitionClient) RegisterRecordList(ctx context.Context, in *RecordListReq, opts ...grpc_go.CallOption) (*RecordListResp, common.ErrorWithAttachment) {
|
||||
out := new(RecordListResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/RegisterRecordList", in, out)
|
||||
}
|
||||
|
||||
func (c *exhibitionClient) ExportRegisterRecord(ctx context.Context, in *ExportRecordReq, opts ...grpc_go.CallOption) (*ExportRecordResp, common.ErrorWithAttachment) {
|
||||
out := new(ExportRecordResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ExportRegisterRecord", in, out)
|
||||
}
|
||||
|
||||
// ExhibitionServer is the server API for Exhibition service.
|
||||
// All implementations must embed UnimplementedExhibitionServer
|
||||
// for forward compatibility
|
||||
type ExhibitionServer interface {
|
||||
CheckPhone(context.Context, *RegisterInfo) (*CheckPhoneResp, error)
|
||||
SaveRegisterRecord(context.Context, *RegisterInfo) (*SaveRegisterRecordResp, error)
|
||||
RegisterRecordList(context.Context, *RecordListReq) (*RecordListResp, error)
|
||||
ExportRegisterRecord(context.Context, *ExportRecordReq) (*ExportRecordResp, error)
|
||||
mustEmbedUnimplementedExhibitionServer()
|
||||
}
|
||||
|
||||
// UnimplementedExhibitionServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedExhibitionServer struct {
|
||||
proxyImpl protocol.Invoker
|
||||
}
|
||||
|
||||
func (UnimplementedExhibitionServer) CheckPhone(context.Context, *RegisterInfo) (*CheckPhoneResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CheckPhone not implemented")
|
||||
}
|
||||
func (UnimplementedExhibitionServer) SaveRegisterRecord(context.Context, *RegisterInfo) (*SaveRegisterRecordResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SaveRegisterRecord not implemented")
|
||||
}
|
||||
func (UnimplementedExhibitionServer) RegisterRecordList(context.Context, *RecordListReq) (*RecordListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RegisterRecordList not implemented")
|
||||
}
|
||||
func (UnimplementedExhibitionServer) ExportRegisterRecord(context.Context, *ExportRecordReq) (*ExportRecordResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ExportRegisterRecord not implemented")
|
||||
}
|
||||
func (s *UnimplementedExhibitionServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
|
||||
func (s *UnimplementedExhibitionServer) XXX_GetProxyImpl() protocol.Invoker {
|
||||
return s.proxyImpl
|
||||
}
|
||||
|
||||
func (s *UnimplementedExhibitionServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
|
||||
return &Exhibition_ServiceDesc
|
||||
}
|
||||
func (s *UnimplementedExhibitionServer) XXX_InterfaceName() string {
|
||||
return "exhibition.Exhibition"
|
||||
}
|
||||
|
||||
func (UnimplementedExhibitionServer) mustEmbedUnimplementedExhibitionServer() {}
|
||||
|
||||
// UnsafeExhibitionServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ExhibitionServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeExhibitionServer interface {
|
||||
mustEmbedUnimplementedExhibitionServer()
|
||||
}
|
||||
|
||||
func RegisterExhibitionServer(s grpc_go.ServiceRegistrar, srv ExhibitionServer) {
|
||||
s.RegisterService(&Exhibition_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Exhibition_CheckPhone_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RegisterInfo)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("CheckPhone", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Exhibition_SaveRegisterRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RegisterInfo)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("SaveRegisterRecord", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Exhibition_RegisterRecordList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RecordListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("RegisterRecordList", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Exhibition_ExportRegisterRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExportRecordReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("ExportRegisterRecord", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Exhibition_ServiceDesc is the grpc_go.ServiceDesc for Exhibition service.
|
||||
// It's only intended for direct use with grpc_go.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Exhibition_ServiceDesc = grpc_go.ServiceDesc{
|
||||
ServiceName: "exhibition.Exhibition",
|
||||
HandlerType: (*ExhibitionServer)(nil),
|
||||
Methods: []grpc_go.MethodDesc{
|
||||
{
|
||||
MethodName: "CheckPhone",
|
||||
Handler: _Exhibition_CheckPhone_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SaveRegisterRecord",
|
||||
Handler: _Exhibition_SaveRegisterRecord_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RegisterRecordList",
|
||||
Handler: _Exhibition_RegisterRecordList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ExportRegisterRecord",
|
||||
Handler: _Exhibition_ExportRegisterRecord_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "pb/exhibition.proto",
|
||||
}
|
27
conf/dev/config.yaml
Normal file
27
conf/dev/config.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
system:
|
||||
domain: localhost
|
||||
mode: dev
|
||||
node_num: 3
|
||||
port: 8086
|
||||
key:
|
||||
cert:
|
||||
is_https: false
|
||||
cron: false
|
||||
key_path: ""
|
||||
cert_path: ""
|
||||
redis:
|
||||
db: 1
|
||||
addr: 127.0.0.1:6379
|
||||
password: 7532T6R
|
||||
jaeger:
|
||||
addr: 127.0.0.1:6831
|
||||
open: true
|
||||
zapLog:
|
||||
level: "info"
|
||||
filename: "logs/exhibition-main.log"
|
||||
max_size: 5
|
||||
max_age: 30
|
||||
max_backups: 30
|
||||
jwt:
|
||||
key: "3Ei*^!a6^6$w^wgK"
|
||||
expire: 24
|
55
conf/dev/dubbogo.yaml
Normal file
55
conf/dev/dubbogo.yaml
Normal file
@ -0,0 +1,55 @@
|
||||
dubbo:
|
||||
registries:
|
||||
meal_zk:
|
||||
protocol: zookeeper
|
||||
timeout: 30s
|
||||
address: 127.0.0.1:2181
|
||||
consumer:
|
||||
filter: tracing
|
||||
request-timeout: 30s
|
||||
params:
|
||||
max-call-send-msg-size: 8000000
|
||||
max-call-recv-msg-size: 8000000
|
||||
references:
|
||||
|
||||
logger:
|
||||
zap-config:
|
||||
level: error # 日志级别
|
||||
development: false
|
||||
disableCaller: false
|
||||
disableStacktrace: false
|
||||
encoding: "json"
|
||||
# zap encoder 配置
|
||||
encoderConfig:
|
||||
messageKey: "message"
|
||||
levelKey: "level"
|
||||
timeKey: "time"
|
||||
nameKey: "logger"
|
||||
callerKey: "caller"
|
||||
stacktraceKey: "stacktrace"
|
||||
lineEnding: ""
|
||||
levelEncoder: "capitalColor"
|
||||
timeEncoder: "iso8601"
|
||||
durationEncoder: "seconds"
|
||||
callerEncoder: "short"
|
||||
nameEncoder: ""
|
||||
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
|
||||
EncodeDuration: zapcore.SecondsDurationEncoder,
|
||||
outputPaths:
|
||||
- "stderr"
|
||||
errorOutputPaths:
|
||||
- "stderr"
|
||||
lumberjack-config:
|
||||
# 写日志的文件名称
|
||||
filename: "logs/runtime/meal-main.log"
|
||||
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
|
||||
maxSize: 5
|
||||
# 日志保留的最大天数(只保留最近多少天的日志)
|
||||
maxAge: 30
|
||||
# 只保留最近多少个日志文件,用于控制程序总日志的大小
|
||||
maxBackups: 30
|
||||
# 是否使用本地时间,默认使用 UTC 时间
|
||||
localTime: true
|
||||
# 是否压缩日志文件,压缩方法 gzip
|
||||
compress: false
|
||||
|
27
conf/prod/config.yaml
Normal file
27
conf/prod/config.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
system:
|
||||
domain: exhibition.szjixun.cn
|
||||
mode: prod
|
||||
node_num: 3
|
||||
port: 9025
|
||||
key:
|
||||
cert:
|
||||
is_https: false
|
||||
cron: false
|
||||
key_path: ""
|
||||
cert_path: ""
|
||||
redis:
|
||||
db: 3
|
||||
addr: r-bp1mjimyh1ejg1mxclpd.redis.rds.aliyuncs.com:6379
|
||||
password: "fonchain_opv:kP6tW4tS3qB2dW4aE6uI5cX2"
|
||||
jaeger:
|
||||
addr: jaeger:6831
|
||||
open: true
|
||||
zapLog:
|
||||
level: "info"
|
||||
filename: "logs/exhibition-main.log"
|
||||
max_size: 5
|
||||
max_age: 30
|
||||
max_backups: 30
|
||||
jwt:
|
||||
key: "tP0xXGErz4~"
|
||||
expire: 24
|
55
conf/prod/dubbogo.yaml
Normal file
55
conf/prod/dubbogo.yaml
Normal file
@ -0,0 +1,55 @@
|
||||
dubbo:
|
||||
registries:
|
||||
meal_zk:
|
||||
protocol: zookeeper
|
||||
timeout: 3s
|
||||
address: zookeeper:2181
|
||||
consumer:
|
||||
filter: tracing
|
||||
request-timeout: 30s
|
||||
params:
|
||||
max-call-send-msg-size: 8000000
|
||||
max-call-recv-msg-size: 8000000
|
||||
references:
|
||||
|
||||
logger:
|
||||
zap-config:
|
||||
level: error # 日志级别
|
||||
development: false
|
||||
disableCaller: false
|
||||
disableStacktrace: false
|
||||
encoding: "json"
|
||||
# zap encoder 配置
|
||||
encoderConfig:
|
||||
messageKey: "message"
|
||||
levelKey: "level"
|
||||
timeKey: "time"
|
||||
nameKey: "logger"
|
||||
callerKey: "caller"
|
||||
stacktraceKey: "stacktrace"
|
||||
lineEnding: ""
|
||||
levelEncoder: "capitalColor"
|
||||
timeEncoder: "iso8601"
|
||||
durationEncoder: "seconds"
|
||||
callerEncoder: "short"
|
||||
nameEncoder: ""
|
||||
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
|
||||
EncodeDuration: zapcore.SecondsDurationEncoder,
|
||||
outputPaths:
|
||||
- "stderr"
|
||||
errorOutputPaths:
|
||||
- "stderr"
|
||||
lumberjack-config:
|
||||
# 写日志的文件名称
|
||||
filename: "runtime/meal-main.log"
|
||||
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
|
||||
maxSize: 5
|
||||
# 日志保留的最大天数(只保留最近多少天的日志)
|
||||
maxAge: 30
|
||||
# 只保留最近多少个日志文件,用于控制程序总日志的大小
|
||||
maxBackups: 30
|
||||
# 是否使用本地时间,默认使用 UTC 时间
|
||||
localTime: true
|
||||
# 是否压缩日志文件,压缩方法 gzip
|
||||
compress: false
|
||||
|
27
conf/test/config.yaml
Normal file
27
conf/test/config.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
system:
|
||||
domain: exhibitiontest.szjixun.cn
|
||||
mode: test
|
||||
node_num: 3
|
||||
port: 9025
|
||||
key:
|
||||
cert:
|
||||
is_https: false
|
||||
cron: false
|
||||
key_path: ""
|
||||
cert_path: ""
|
||||
redis:
|
||||
db: 3
|
||||
addr: redis:6379
|
||||
password:
|
||||
jaeger:
|
||||
addr: "172.16.100.93:9031"
|
||||
open: true
|
||||
zapLog:
|
||||
level: "info"
|
||||
filename: "logs/exhibition-main.log"
|
||||
max_size: 5
|
||||
max_age: 30
|
||||
max_backups: 30
|
||||
jwt:
|
||||
key: "SxjwBuEcHg42t73"
|
||||
expire: 24
|
55
conf/test/dubbogo.yaml
Normal file
55
conf/test/dubbogo.yaml
Normal file
@ -0,0 +1,55 @@
|
||||
dubbo:
|
||||
registries:
|
||||
meal_zk:
|
||||
protocol: zookeeper
|
||||
timeout: 3s
|
||||
address: zookeeper:2181
|
||||
consumer:
|
||||
filter: tracing
|
||||
request-timeout: 30s
|
||||
params:
|
||||
max-call-send-msg-size: 8000000
|
||||
max-call-recv-msg-size: 8000000
|
||||
references:
|
||||
|
||||
logger:
|
||||
zap-config:
|
||||
level: error # 日志级别
|
||||
development: false
|
||||
disableCaller: false
|
||||
disableStacktrace: false
|
||||
encoding: "json"
|
||||
# zap encoder 配置
|
||||
encoderConfig:
|
||||
messageKey: "message"
|
||||
levelKey: "level"
|
||||
timeKey: "time"
|
||||
nameKey: "logger"
|
||||
callerKey: "caller"
|
||||
stacktraceKey: "stacktrace"
|
||||
lineEnding: ""
|
||||
levelEncoder: "capitalColor"
|
||||
timeEncoder: "iso8601"
|
||||
durationEncoder: "seconds"
|
||||
callerEncoder: "short"
|
||||
nameEncoder: ""
|
||||
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
|
||||
EncodeDuration: zapcore.SecondsDurationEncoder,
|
||||
outputPaths:
|
||||
- "stderr"
|
||||
errorOutputPaths:
|
||||
- "stderr"
|
||||
lumberjack-config:
|
||||
# 写日志的文件名称
|
||||
filename: "runtime/meal-main.log"
|
||||
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
|
||||
maxSize: 5
|
||||
# 日志保留的最大天数(只保留最近多少天的日志)
|
||||
maxAge: 30
|
||||
# 只保留最近多少个日志文件,用于控制程序总日志的大小
|
||||
maxBackups: 30
|
||||
# 是否使用本地时间,默认使用 UTC 时间
|
||||
localTime: true
|
||||
# 是否压缩日志文件,压缩方法 gzip
|
||||
compress: false
|
||||
|
148
go.mod
Normal file
148
go.mod
Normal file
@ -0,0 +1,148 @@
|
||||
module github.com/exhibition-main
|
||||
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
dubbo.apache.org/dubbo-go/v3 v3.0.5
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/dubbogo/gost v1.13.2
|
||||
github.com/dubbogo/grpc-go v1.42.10
|
||||
github.com/dubbogo/triple v1.2.2-rc2
|
||||
github.com/gin-contrib/gzip v0.0.6
|
||||
github.com/gin-contrib/pprof v1.4.0
|
||||
github.com/gin-gonic/gin v1.9.0
|
||||
github.com/go-playground/locales v0.14.1
|
||||
github.com/go-playground/universal-translator v0.18.1
|
||||
github.com/go-playground/validator/v10 v10.11.2
|
||||
github.com/go-redis/redis v6.15.9+incompatible
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/google/wire v0.5.0
|
||||
github.com/mwitkow/go-proto-validators v0.3.2
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible
|
||||
github.com/opentracing/opentracing-go v1.2.0
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/spf13/viper v1.7.0
|
||||
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271
|
||||
github.com/uber/jaeger-client-go v2.30.0+incompatible
|
||||
go.uber.org/zap v1.21.0
|
||||
google.golang.org/protobuf v1.28.1
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.65.0 // indirect
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.4.1 // indirect
|
||||
github.com/RoaringBitmap/roaring v1.2.3 // indirect
|
||||
github.com/Workiva/go-datastructures v1.0.52 // indirect
|
||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
|
||||
github.com/alibaba/sentinel-golang v1.0.4 // indirect
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 // indirect
|
||||
github.com/apache/dubbo-getty v1.4.9-0.20221022181821-4dc6252ce98c // indirect
|
||||
github.com/apache/dubbo-go-hessian2 v1.11.5 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.2.0 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/bytedance/sonic v1.8.0 // indirect
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
|
||||
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 // indirect
|
||||
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // indirect
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
||||
github.com/creasty/defaults v1.5.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dlclark/regexp2 v1.7.0 // indirect
|
||||
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
|
||||
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-co-op/gocron v1.9.0 // indirect
|
||||
github.com/go-errors/errors v1.0.1 // indirect
|
||||
github.com/go-kit/log v0.1.0 // indirect
|
||||
github.com/go-logfmt/logfmt v0.5.0 // indirect
|
||||
github.com/go-logr/logr v1.2.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-resty/resty/v2 v2.7.0 // indirect
|
||||
github.com/goccy/go-json v0.10.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/vault/sdk v0.7.0 // indirect
|
||||
github.com/jinzhu/copier v0.3.5 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/k0kubun/pp v3.0.1+incompatible // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
|
||||
github.com/knadh/koanf v1.5.0 // indirect
|
||||
github.com/leodido/go-urn v1.2.1 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.7 // indirect
|
||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mschoch/smat v0.2.0 // indirect
|
||||
github.com/nacos-group/nacos-sdk-go v1.1.4 // indirect
|
||||
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
|
||||
github.com/pelletier/go-toml v1.7.0 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
|
||||
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/polarismesh/polaris-go v1.3.0 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
||||
github.com/prometheus/client_golang v1.12.2 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.32.1 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/prometheus/statsd_exporter v0.21.0 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.22.2 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/afero v1.1.2 // indirect
|
||||
github.com/spf13/cast v1.3.0 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.0.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.10 // indirect
|
||||
github.com/tklauser/numcpus v0.4.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
|
||||
github.com/ugorji/go/codec v1.2.9 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.7 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.7 // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
go.opentelemetry.io/otel v1.11.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.11.0 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
|
||||
golang.org/x/crypto v0.5.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
google.golang.org/appengine v1.6.6 // indirect
|
||||
google.golang.org/genproto v0.0.0-20220504150022-98cd25cafc72 // indirect
|
||||
google.golang.org/grpc v1.51.0 // indirect
|
||||
gopkg.in/ini.v1 v1.66.2 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
69
internal/config/app_config.go
Normal file
69
internal/config/app_config.go
Normal file
@ -0,0 +1,69 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"dubbo.apache.org/dubbo-go/v3/common/constant"
|
||||
"fmt"
|
||||
"github.com/exhibition-main/internal/model"
|
||||
"github.com/spf13/viper"
|
||||
"os"
|
||||
)
|
||||
|
||||
var Data = new(AppConfig)
|
||||
|
||||
type AppConfig struct {
|
||||
System struct {
|
||||
Domain string
|
||||
Mode string
|
||||
NodeNum int32
|
||||
Port int32
|
||||
KeyPath string `mapstructure:"key_path"`
|
||||
CertPath string `mapstructure:"cert_path"`
|
||||
IsHttps bool `mapstructure:"is_https"`
|
||||
Cron bool
|
||||
}
|
||||
Redis struct {
|
||||
Db uint8
|
||||
Addr string
|
||||
Password string
|
||||
}
|
||||
|
||||
ZapLog struct {
|
||||
Level string `mapstructure:"level"`
|
||||
Filename string `mapstructure:"filename"`
|
||||
MaxSize int `mapstructure:"max_size"`
|
||||
MaxAge int `mapstructure:"max_age"`
|
||||
MaxBackups int `mapstructure:"max_backups"`
|
||||
}
|
||||
Jaeger struct {
|
||||
Addr string
|
||||
Open bool
|
||||
}
|
||||
Jwt struct {
|
||||
Key string
|
||||
Expire int32
|
||||
}
|
||||
}
|
||||
|
||||
func GetConf() (iniConf string, err error) {
|
||||
if os.Getenv(model.MODE_ENV) != "" {
|
||||
if err = os.Setenv(constant.ConfigFileEnvKey, fmt.Sprintf("./conf/%s/%s", os.Getenv(model.MODE_ENV), model.SERVER_DUBBOGO_CONFIG)); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
iniConf = fmt.Sprintf("./conf/%s/%s", os.Getenv(model.MODE_ENV), model.SERVER_CONFIG)
|
||||
return
|
||||
}
|
||||
|
||||
func GetOptions() {
|
||||
iniConf, err := GetConf()
|
||||
viper.SetConfigFile(iniConf)
|
||||
err = viper.ReadInConfig()
|
||||
if err != nil {
|
||||
panic("viper.ReadInConfig failed" + err.Error())
|
||||
return
|
||||
}
|
||||
if err = viper.Unmarshal(Data); err != nil {
|
||||
panic("viper.Unmarshal failed" + err.Error())
|
||||
}
|
||||
|
||||
}
|
38
internal/filter/authfilter.go
Normal file
38
internal/filter/authfilter.go
Normal file
@ -0,0 +1,38 @@
|
||||
package filter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"dubbo.apache.org/dubbo-go/v3/common/extension"
|
||||
"dubbo.apache.org/dubbo-go/v3/filter"
|
||||
"dubbo.apache.org/dubbo-go/v3/protocol"
|
||||
)
|
||||
|
||||
func init() {
|
||||
extension.SetFilter("authFilter", NewAuthFilter)
|
||||
}
|
||||
|
||||
func NewAuthFilter() filter.Filter {
|
||||
return &AuthFilter{}
|
||||
}
|
||||
|
||||
type AuthFilter struct {
|
||||
}
|
||||
|
||||
func (f *AuthFilter) Invoke(ctx context.Context, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
|
||||
|
||||
//xxx 接收凭证
|
||||
invocation.SetAttachment("usertoken", "this is jwt token")
|
||||
return invoker.Invoke(ctx, invocation)
|
||||
}
|
||||
|
||||
func (f *AuthFilter) OnResponse(ctx context.Context, result protocol.Result, invoker protocol.Invoker, protocol protocol.Invocation) protocol.Result {
|
||||
fmt.Println("AuthFilter OnResponse is called")
|
||||
myAttachmentMap := make(map[string]interface{})
|
||||
myAttachmentMap["key1"] = "value1"
|
||||
myAttachmentMap["key2"] = []string{"value1", "value2"}
|
||||
result.SetAttachments(myAttachmentMap)
|
||||
fmt.Printf("result %v--", result)
|
||||
return result
|
||||
}
|
53
internal/middleware/auth.go
Normal file
53
internal/middleware/auth.go
Normal file
@ -0,0 +1,53 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/exhibition-main/internal/model"
|
||||
"github.com/exhibition-main/internal/msg"
|
||||
"github.com/exhibition-main/internal/response"
|
||||
"github.com/exhibition-main/pkg/jwt"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"strings"
|
||||
)
|
||||
|
||||
// JWTAuthMiddleware 基于JWT的认证中间件
|
||||
func JWTAuthMiddleware() func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
authHeader := c.Request.Header.Get("Authorization")
|
||||
if authHeader == "" {
|
||||
response.ResponseQuickMsg(c, msg.Fail, msg.NEED_LOGIN, nil)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
// 按空格分割
|
||||
parts := strings.SplitN(authHeader, " ", 2)
|
||||
if !(len(parts) == 2 && parts[0] == "Bearer") {
|
||||
response.ResponseMsg(c, msg.StatusUnauthorized, model.Response{
|
||||
Status: msg.Fail,
|
||||
Data: nil,
|
||||
Msg: msg.NEED_LOGIN,
|
||||
})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
// parts[1]是获取到的tokenString,我们使用之前定义好的解析JWT的函数来解析它
|
||||
jwtInfo, err := jwt.ParseToken(parts[1])
|
||||
if err != nil {
|
||||
response.ResponseMsg(c, msg.StatusUnauthorized, model.Response{
|
||||
Status: msg.Fail,
|
||||
Data: nil,
|
||||
Msg: msg.INVALID_TOKEN,
|
||||
})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
// 将当前请求的userID信息保存到请求的上下文c上
|
||||
c.Set(model.CTX_USER_INFO, jwt.MyClaims{
|
||||
UserId: jwtInfo.UserId,
|
||||
Nickname: jwtInfo.Nickname,
|
||||
Phone: jwtInfo.Phone,
|
||||
Openid: jwtInfo.Openid,
|
||||
})
|
||||
c.Next() // 后续的处理请求的函数中 可以用过c.Get(CtxUserIDKey) 来获取当前请求的用户信息
|
||||
}
|
||||
}
|
48
internal/middleware/cors.go
Normal file
48
internal/middleware/cors.go
Normal file
@ -0,0 +1,48 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// 跨域
|
||||
func Cors() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
method := c.Request.Method //请求方法
|
||||
origin := c.Request.Header.Get("Origin") //请求头部
|
||||
var headerKeys []string // 声明请求头keys
|
||||
for k := range c.Request.Header {
|
||||
headerKeys = append(headerKeys, k)
|
||||
}
|
||||
headerStr := strings.Join(headerKeys, ", ")
|
||||
if headerStr != "" {
|
||||
headerStr = fmt.Sprintf("access-control-allow-origin, access-control-allow-headers, %s", headerStr)
|
||||
} else {
|
||||
headerStr = "access-control-allow-origin, access-control-allow-headers"
|
||||
}
|
||||
if origin != "" {
|
||||
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
c.Header("Access-Control-Allow-Origin", "*") // 这是允许访问所有域
|
||||
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE,UPDATE") //服务器支持的所有跨域请求的方法,为了避免浏览次请求的多次'预检'请求
|
||||
// header的类型
|
||||
c.Header("Access-Control-Allow-Headers", "Authorization, Content-Length, X-CSRF-Token, Token,session,X_Requested_With,Accept, Origin, Host, Connection, Accept-Encoding, Accept-Language,DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Pragma")
|
||||
// 允许跨域设置 可以返回其他子段
|
||||
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers,Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma,FooBar") // 跨域关键设置 让浏览器可以解析
|
||||
c.Header("Access-Control-Max-Age", "172800") // 缓存请求信息 单位为秒
|
||||
c.Header("Access-Control-Allow-Credentials", "false") // 跨域请求是否需要带cookie信息 默认设置为true
|
||||
c.Set("content-type", "application/json")
|
||||
//c.Header("Access-Control-Allow-Credentials", "true") // 跨域请求是否需要带cookie信息 默认设置为true
|
||||
//c.Header("Access-Control-Request-Private-Network", "true") // 跨域请求是否需要带cookie信息 默认设置为true
|
||||
//c.Header("Access-Control-Allow-Private-Network", "true") // 设置返回格式是json
|
||||
}
|
||||
//放行所有OPTIONS方法
|
||||
if method == "OPTIONS" {
|
||||
c.JSON(http.StatusOK, "Options Request!")
|
||||
}
|
||||
// 处理请求
|
||||
c.Next() // 处理请求
|
||||
}
|
||||
}
|
89
internal/middleware/logging.go
Normal file
89
internal/middleware/logging.go
Normal file
@ -0,0 +1,89 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func NewLogger() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// 开始时间
|
||||
startTime := time.Now() // 处理请求
|
||||
endTime := time.Now() // 执行时间
|
||||
latencyTime := endTime.Sub(startTime) // 请求方式
|
||||
path := c.Request.URL.Path
|
||||
query := c.Request.URL.RawQuery
|
||||
data, _ := ioutil.ReadAll(c.Request.Body)
|
||||
dataStr := string(data)
|
||||
if len(dataStr) > 1000 {
|
||||
// 数据太大就不记录了
|
||||
dataStr = ""
|
||||
}
|
||||
zap.L().Info("path",
|
||||
zap.Int("status", c.Writer.Status()),
|
||||
zap.String("method", c.Request.Method),
|
||||
zap.String("path", path),
|
||||
zap.String("query", query),
|
||||
zap.Any("body", dataStr),
|
||||
zap.String("ip", c.ClientIP()),
|
||||
zap.String("user-agent", c.Request.UserAgent()),
|
||||
zap.String("errors", c.Errors.ByType(gin.ErrorTypePrivate).String()),
|
||||
zap.Duration("latencyTime", latencyTime))
|
||||
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(data))
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
// GinRecovery recover掉项目可能出现的panic,并记录日志
|
||||
func GinRecovery(stack bool) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
// Check for a broken connection, as it is not really a
|
||||
// condition that warrants a panic stack trace.
|
||||
var brokenPipe bool
|
||||
if ne, ok := err.(*net.OpError); ok {
|
||||
if se, ok := ne.Err.(*os.SyscallError); ok {
|
||||
if strings.Contains(strings.ToLower(se.Error()), "broken pipe") || strings.Contains(strings.ToLower(se.Error()), "connection reset by peer") {
|
||||
brokenPipe = true
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest, _ := httputil.DumpRequest(c.Request, false)
|
||||
if brokenPipe {
|
||||
zap.L().Error(c.Request.URL.Path,
|
||||
zap.Any("error", err),
|
||||
zap.String("request", string(httpRequest)),
|
||||
)
|
||||
// If the connection is dead, we can't write a status to it.
|
||||
c.Error(err.(error)) // nolint: errcheck
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
if stack {
|
||||
zap.L().Error("[Recovery from panic]",
|
||||
zap.Any("error", err),
|
||||
zap.String("request", string(httpRequest)),
|
||||
zap.String("stack", string(debug.Stack())),
|
||||
)
|
||||
} else {
|
||||
zap.L().Error("[Recovery from panic]",
|
||||
zap.Any("error", err),
|
||||
zap.String("request", string(httpRequest)),
|
||||
)
|
||||
}
|
||||
c.AbortWithStatus(http.StatusInternalServerError)
|
||||
}
|
||||
}()
|
||||
c.Next()
|
||||
}
|
||||
}
|
19
internal/model/common.go
Normal file
19
internal/model/common.go
Normal file
@ -0,0 +1,19 @@
|
||||
package model
|
||||
|
||||
const (
|
||||
SERVER_CONFIG = "config.yaml"
|
||||
SERVER_DUBBOGO_CONFIG = "dubbogo.yaml"
|
||||
MODE_ENV = "MODE_ENV"
|
||||
)
|
||||
|
||||
type Response struct {
|
||||
Status int `json:"status"`
|
||||
Data interface{} `json:"data"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
type PageInfo struct {
|
||||
Page int32 `json:"page" query:"page"`
|
||||
PageSize int32 `json:"pageSize" query:"pageSize"`
|
||||
Total int32 `json:"total"`
|
||||
}
|
12
internal/model/user.go
Normal file
12
internal/model/user.go
Normal file
@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
const (
|
||||
CTX_USER_INFO = "userinfo"
|
||||
)
|
||||
|
||||
type UserInfo struct {
|
||||
UserId int64 `json:"userId"`
|
||||
CountryCode string `json:"countryCode"`
|
||||
Phone string `json:"phone"`
|
||||
Identity int32 `json:"identity"`
|
||||
}
|
33
internal/msg/code.go
Normal file
33
internal/msg/code.go
Normal file
@ -0,0 +1,33 @@
|
||||
package msg
|
||||
|
||||
const (
|
||||
Ok = 0
|
||||
Fail = 1
|
||||
)
|
||||
|
||||
const (
|
||||
StatusContinue = 100 // 继续
|
||||
StatusSwitchingProtocols = 101 // 切换协议
|
||||
StatusOK = 200 // 成功
|
||||
StatusCreated = 201 // 已创建
|
||||
StatusAccepted = 202 // 已接受
|
||||
StatusNonAuthoritative = 203 // 非权威性信息
|
||||
StatusNoContent = 204 // 无内容
|
||||
StatusResetContent = 205 // 重置内容
|
||||
StatusPartialContent = 206 // 部分内容
|
||||
StatusMultipleChoices = 300 // 多种选择
|
||||
StatusMovedPermanently = 301 // 永久移动
|
||||
StatusFound = 302 // 临时移动
|
||||
StatusSeeOther = 303 // 查看其他位置
|
||||
StatusNotModified = 304 // 未修改
|
||||
StatusUseProxy = 305 // 使用代理
|
||||
StatusTemporaryRedirect = 307 // 临时重定向
|
||||
StatusBadRequest = 400 // 错误请求
|
||||
StatusUnauthorized = 401 // 未经授权
|
||||
StatusForbidden = 403 // 禁止访问
|
||||
StatusNotFound = 404 // 未找到
|
||||
StatusMethodNotAllowed = 405 // 方法不允许
|
||||
StatusConflict = 409 // 冲突
|
||||
StatusInternalServerError = 500 // 服务器内部错误
|
||||
StatusServiceUnavailable = 503 // 服务不可用
|
||||
)
|
28
internal/msg/message.go
Normal file
28
internal/msg/message.go
Normal file
@ -0,0 +1,28 @@
|
||||
package msg
|
||||
|
||||
const (
|
||||
FAIL = "操作失败"
|
||||
SUCCESS = "操作成功"
|
||||
|
||||
ERROR_LOGIN = "账号或密码错误"
|
||||
ERROR_JSON_PARSE = "json解析失败"
|
||||
ERROR_JSON_MARSHAL = "json序列化失败"
|
||||
ERROR_FOR_UPDATE = "锁定错误"
|
||||
ERROR_INSERT = "插入异常"
|
||||
ERROR_DELETE = "删除异常"
|
||||
ERROR_UPDATE = "更新异常"
|
||||
ERROR_SELECT = "查询异常"
|
||||
ERROR_EMPTY_PARAM = "值为空"
|
||||
ERROR_COPIER_STRUCT = "拷贝结构体错误"
|
||||
ERROR_NO_ACTION = "无需操作"
|
||||
ERROR_BIND_PARAM = "绑定数据失败"
|
||||
|
||||
TICKET_SUBCARD_NO_ENOUGH = "次卡数量不足"
|
||||
BUY_FAIL = "购买失败"
|
||||
|
||||
WARNING_WAITING = "请稍后再试"
|
||||
|
||||
NEED_LOGIN = "请先登录"
|
||||
|
||||
INVALID_TOKEN = "token不合法"
|
||||
)
|
27
internal/response/response.go
Normal file
27
internal/response/response.go
Normal file
@ -0,0 +1,27 @@
|
||||
package response
|
||||
|
||||
import (
|
||||
"github.com/exhibition-main/internal/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func ResponseMsg(c *gin.Context, httpCode int, Resp model.Response) {
|
||||
if httpCode == 0 {
|
||||
httpCode = http.StatusOK
|
||||
}
|
||||
c.JSON(httpCode, model.Response{
|
||||
Status: Resp.Status,
|
||||
Msg: Resp.Msg,
|
||||
Data: Resp.Data,
|
||||
})
|
||||
}
|
||||
|
||||
func ResponseQuickMsg(c *gin.Context, Status uint8, Msg string, Data interface{}) {
|
||||
//var c gin.Context
|
||||
c.JSON(http.StatusOK, model.Response{
|
||||
Status: int(Status),
|
||||
Msg: Msg,
|
||||
Data: Data,
|
||||
})
|
||||
}
|
5
internal/response/user.go
Normal file
5
internal/response/user.go
Normal file
@ -0,0 +1,5 @@
|
||||
package response
|
||||
|
||||
type LoginInfo struct {
|
||||
Token string `json:"token"`
|
||||
}
|
32
pkg/cache/redis.go
vendored
Normal file
32
pkg/cache/redis.go
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/dubbogo/gost/log/logger"
|
||||
appConfig "github.com/exhibition-main/internal/config"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
var RedisProvider = wire.NewSet(NewRedis)
|
||||
|
||||
// TODO 添加连接池
|
||||
|
||||
// RedisClient Redis缓存客户端单例
|
||||
var (
|
||||
RedisClient *redis.Client
|
||||
//RedisDbName string
|
||||
)
|
||||
|
||||
func NewRedis() *redis.Client {
|
||||
RedisClient = redis.NewClient(&redis.Options{
|
||||
Addr: appConfig.Data.Redis.Addr,
|
||||
Password: appConfig.Data.Redis.Password,
|
||||
DB: int(appConfig.Data.Redis.Db),
|
||||
})
|
||||
_, err := RedisClient.Ping().Result()
|
||||
if err != nil {
|
||||
logger.Errorf("connRedis err", err)
|
||||
panic(err)
|
||||
}
|
||||
return RedisClient
|
||||
}
|
55
pkg/jwt/jwt.go
Normal file
55
pkg/jwt/jwt.go
Normal file
@ -0,0 +1,55 @@
|
||||
package jwt
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/exhibition-main/internal/msg"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
)
|
||||
|
||||
var mySecret = []byte(viper.GetString("jwt.key"))
|
||||
|
||||
type MyClaims struct {
|
||||
UserId int64 `json:"userId"`
|
||||
Nickname string `json:"nickname"`
|
||||
Phone string `json:"phone"`
|
||||
Openid string `json:"openid"`
|
||||
jwt.StandardClaims
|
||||
}
|
||||
|
||||
// GenToken 生成JWT
|
||||
func GenToken(userId int64, nickname string, phone string, openid string) (string, error) {
|
||||
// 创建一个我们自己的声明的数据
|
||||
c := MyClaims{
|
||||
userId,
|
||||
nickname,
|
||||
phone,
|
||||
openid,
|
||||
jwt.StandardClaims{
|
||||
ExpiresAt: time.Now().Add(
|
||||
time.Duration(viper.GetInt("jwt.expire")) * time.Hour).Unix(),
|
||||
Issuer: "meal",
|
||||
},
|
||||
}
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, c)
|
||||
return token.SignedString(mySecret)
|
||||
}
|
||||
|
||||
// ParseToken 解析JWT
|
||||
func ParseToken(tokenString string) (*MyClaims, error) {
|
||||
// 解析token
|
||||
var mc = new(MyClaims)
|
||||
token, err := jwt.ParseWithClaims(tokenString, mc, func(token *jwt.Token) (i interface{}, err error) {
|
||||
return mySecret, nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if token.Valid { // 校验token
|
||||
return mc, nil
|
||||
}
|
||||
return nil, errors.New(msg.INVALID_TOKEN)
|
||||
}
|
65
pkg/logger/zap.go
Normal file
65
pkg/logger/zap.go
Normal file
@ -0,0 +1,65 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/google/wire"
|
||||
"os"
|
||||
|
||||
appConfig "github.com/exhibition-main/internal/config"
|
||||
|
||||
"github.com/natefinch/lumberjack"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
var lg *zap.Logger
|
||||
|
||||
var Provider = wire.NewSet(ZapInit)
|
||||
|
||||
// ZapInit 初始化lg
|
||||
func ZapInit() *zap.Logger {
|
||||
var err error
|
||||
c := appConfig.Data
|
||||
fmt.Println(c)
|
||||
writeSyncer := getLogWriter(appConfig.Data.ZapLog.Filename, appConfig.Data.ZapLog.MaxSize, appConfig.Data.ZapLog.MaxBackups, appConfig.Data.ZapLog.MaxAge)
|
||||
encoder := getEncoder()
|
||||
var l = new(zapcore.Level)
|
||||
err = l.UnmarshalText([]byte(appConfig.Data.ZapLog.Level))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
var core zapcore.Core
|
||||
if appConfig.Data.System.Mode == "dev" {
|
||||
// 进入开发模式,日志输出到终端
|
||||
consoleEncoder := zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig())
|
||||
core = zapcore.NewTee(
|
||||
zapcore.NewCore(encoder, writeSyncer, l),
|
||||
zapcore.NewCore(consoleEncoder, zapcore.Lock(os.Stdout), zapcore.DebugLevel),
|
||||
)
|
||||
} else {
|
||||
core = zapcore.NewCore(encoder, writeSyncer, l)
|
||||
}
|
||||
lg = zap.New(core, zap.AddCaller())
|
||||
zap.ReplaceGlobals(lg)
|
||||
return lg
|
||||
}
|
||||
|
||||
func getEncoder() zapcore.Encoder {
|
||||
encoderConfig := zap.NewProductionEncoderConfig()
|
||||
encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
|
||||
encoderConfig.TimeKey = "time"
|
||||
encoderConfig.EncodeLevel = zapcore.CapitalLevelEncoder
|
||||
encoderConfig.EncodeDuration = zapcore.SecondsDurationEncoder
|
||||
encoderConfig.EncodeCaller = zapcore.ShortCallerEncoder
|
||||
return zapcore.NewJSONEncoder(encoderConfig)
|
||||
}
|
||||
|
||||
func getLogWriter(filename string, maxSize, maxBackup, maxAge int) zapcore.WriteSyncer {
|
||||
lumberJackLogger := &lumberjack.Logger{
|
||||
Filename: filename,
|
||||
MaxSize: maxSize,
|
||||
MaxBackups: maxBackup,
|
||||
MaxAge: maxAge,
|
||||
}
|
||||
return zapcore.AddSync(lumberJackLogger)
|
||||
}
|
73
pkg/router/router.go
Normal file
73
pkg/router/router.go
Normal file
@ -0,0 +1,73 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/exhibition-main/internal/middleware"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-contrib/gzip"
|
||||
"github.com/gin-contrib/pprof"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// 路由配置
|
||||
func NewRouter() *gin.Engine {
|
||||
//使用默认gin路由
|
||||
r := gin.Default()
|
||||
r.Use(gzip.Gzip(gzip.DefaultCompression))
|
||||
//加入日志中间件,跨域中间件
|
||||
r.Use(middleware.NewLogger(), middleware.Cors(), middleware.GinRecovery(true))
|
||||
//noAuth := r.Group("")
|
||||
auth := r.Group("")
|
||||
auth.Use(middleware.JWTAuthMiddleware())
|
||||
//userAuth := auth.Group("user")
|
||||
//{
|
||||
// userAuth.POST("info", api.UserInfo)
|
||||
// userAuth.POST("tickets", api.Tickets)
|
||||
// userAuth.POST("login-out", api.LoginOut)
|
||||
// userAuth.POST("destroy", api.Destroy)
|
||||
//}
|
||||
//userNoAuth := noAuth.Group("user")
|
||||
//{
|
||||
// userNoAuth.POST("login", api.Login)
|
||||
//}
|
||||
//goodsAuth := auth.Group("goods")
|
||||
//{
|
||||
// goodsAuth.POST("drink-list", api.DrinkList)
|
||||
// goodsAuth.POST("ticket-list", api.TickerList)
|
||||
// goodsAuth.POST("set-meal-list", api.SetMealList)
|
||||
//}
|
||||
//
|
||||
//orderAuth := auth.Group("order")
|
||||
//{
|
||||
// orderAuth.POST("buy-goods", api.BuyGoods)
|
||||
// orderAuth.POST("buy-tickets", api.BuyTicket)
|
||||
// orderAuth.POST("buy-balance", api.BuyBalance)
|
||||
// orderAuth.POST("buy-set-meal", api.BuySetMeal)
|
||||
// orderAuth.POST("history-goods", api.HistoryGoods)
|
||||
// orderAuth.POST("history-tickets", api.HistoryTickets)
|
||||
// orderAuth.POST("history-balance", api.HistoryBalance)
|
||||
//}
|
||||
//
|
||||
//orderNoAuth := noAuth.Group("order")
|
||||
//{
|
||||
// orderNoAuth.POST("wx_callback", api.WxCallback)
|
||||
// orderAuth.POST("order-data-h5", api.OrderDataH5)
|
||||
// orderAuth.POST("update-h5-order", api.UpdateH5Order)
|
||||
//}
|
||||
//
|
||||
//miniNoAuth := noAuth.Group("mini")
|
||||
//{
|
||||
// miniNoAuth.POST("url-scheme", api.UrlScheme)
|
||||
//}
|
||||
|
||||
//静态文件
|
||||
r.StaticFS("/static", http.Dir("./runtime"))
|
||||
r.NoRoute(func(c *gin.Context) {
|
||||
c.JSON(http.StatusNotFound, gin.H{
|
||||
"status": 1,
|
||||
"msg": "不存在的路由",
|
||||
})
|
||||
})
|
||||
pprof.Register(r)
|
||||
return r
|
||||
}
|
17
pkg/service/init.go
Normal file
17
pkg/service/init.go
Normal file
@ -0,0 +1,17 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"dubbo.apache.org/dubbo-go/v3/config"
|
||||
_ "dubbo.apache.org/dubbo-go/v3/imports"
|
||||
appConfig "github.com/exhibition-main/internal/config"
|
||||
)
|
||||
|
||||
//var GrpcAccountClientImpl = new(account.AccountClientImpl)
|
||||
|
||||
func init() {
|
||||
//config.SetConsumerService(GrpcAccountClientImpl)
|
||||
appConfig.GetOptions()
|
||||
if err := config.Load(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
1
pkg/service/register_record.go
Normal file
1
pkg/service/register_record.go
Normal file
@ -0,0 +1 @@
|
||||
package service
|
50
pkg/tracing/jaeger.go
Normal file
50
pkg/tracing/jaeger.go
Normal file
@ -0,0 +1,50 @@
|
||||
package tracing
|
||||
|
||||
import (
|
||||
appConfig "github.com/exhibition-main/internal/config"
|
||||
"github.com/google/wire"
|
||||
"github.com/opentracing/opentracing-go"
|
||||
"github.com/uber/jaeger-client-go"
|
||||
jaegerConfig "github.com/uber/jaeger-client-go/config"
|
||||
"go.uber.org/zap"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
var Provider = wire.NewSet(NewTracing)
|
||||
|
||||
type JaegerProvider struct {
|
||||
Tracer opentracing.Tracer
|
||||
Closer io.Closer
|
||||
}
|
||||
|
||||
var JaegerPoint *JaegerProvider
|
||||
|
||||
func NewTracing() (jaegerProvider *JaegerProvider) {
|
||||
if !appConfig.Data.Jaeger.Open {
|
||||
return
|
||||
}
|
||||
jaegerProvider = &JaegerProvider{}
|
||||
cfg := jaegerConfig.Configuration{
|
||||
ServiceName: "fonchain-baidu",
|
||||
Sampler: &jaegerConfig.SamplerConfig{
|
||||
Type: jaeger.SamplerTypeRemote,
|
||||
Param: 1,
|
||||
},
|
||||
Reporter: &jaegerConfig.ReporterConfig{
|
||||
LocalAgentHostPort: appConfig.Data.Jaeger.Addr,
|
||||
LogSpans: true,
|
||||
BufferFlushInterval: 5 * time.Second,
|
||||
},
|
||||
}
|
||||
nativeTracerIo, closerIo, err := cfg.NewTracer(jaegerConfig.Logger(jaeger.StdLogger))
|
||||
if err != nil {
|
||||
zap.L().Error("nativeTracer err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
opentracing.SetGlobalTracer(nativeTracerIo)
|
||||
jaegerProvider.Tracer = nativeTracerIo
|
||||
jaegerProvider.Closer = closerIo
|
||||
JaegerPoint = jaegerProvider
|
||||
return
|
||||
}
|
19
pkg/utils/user.go
Normal file
19
pkg/utils/user.go
Normal file
@ -0,0 +1,19 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/exhibition-main/internal/model"
|
||||
"github.com/exhibition-main/internal/msg"
|
||||
"github.com/exhibition-main/pkg/jwt"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func GetJwtInfo(ctx *gin.Context) (jwtInfo jwt.MyClaims, err error) {
|
||||
val, ok := ctx.Get(model.CTX_USER_INFO)
|
||||
if !ok {
|
||||
err = errors.New(msg.NEED_LOGIN)
|
||||
return
|
||||
}
|
||||
jwtInfo = val.(jwt.MyClaims)
|
||||
return
|
||||
}
|
63
pkg/utils/validator.go
Normal file
63
pkg/utils/validator.go
Normal file
@ -0,0 +1,63 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/go-playground/locales/en"
|
||||
"github.com/go-playground/locales/zh"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
enTranslations "github.com/go-playground/validator/v10/translations/en"
|
||||
zhTranslations "github.com/go-playground/validator/v10/translations/zh"
|
||||
)
|
||||
|
||||
var Trans ut.Translator
|
||||
|
||||
// InitTrans 初始化翻译器
|
||||
func InitTrans(locale string) (err error) {
|
||||
// 修改gin框架中的Validator引擎属性,实现自定制
|
||||
if v, ok := binding.Validator.Engine().(*validator.Validate); ok {
|
||||
// 注册一个获取json tag的自定义方法
|
||||
v.RegisterTagNameFunc(func(fld reflect.StructField) string {
|
||||
name := strings.SplitN(fld.Tag.Get("json"), ",", 2)[0]
|
||||
if name == "-" {
|
||||
return ""
|
||||
}
|
||||
return name
|
||||
})
|
||||
// 为SignUpParam注册自定义校验方法
|
||||
zhT := zh.New() // 中文翻译器
|
||||
enT := en.New() // 英文翻译器
|
||||
uni := ut.New(enT, zhT, enT)
|
||||
var ok bool
|
||||
// 也可以使用 uni.FindTranslator(...) 传入多个locale进行查找
|
||||
Trans, ok = uni.GetTranslator(locale)
|
||||
if !ok {
|
||||
return fmt.Errorf("uni.GetTranslator(%s) failed", locale)
|
||||
}
|
||||
|
||||
// 注册翻译器
|
||||
switch locale {
|
||||
case "en":
|
||||
err = enTranslations.RegisterDefaultTranslations(v, Trans)
|
||||
case "zh":
|
||||
err = zhTranslations.RegisterDefaultTranslations(v, Trans)
|
||||
default:
|
||||
err = enTranslations.RegisterDefaultTranslations(v, Trans)
|
||||
}
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// RemoveTopStruct 去除提示信息中的结构体名称
|
||||
func RemoveTopStruct(fields map[string]string) map[string]string {
|
||||
res := map[string]string{}
|
||||
for field, err := range fields {
|
||||
res[field[strings.Index(field, ".")+1:]] = err
|
||||
}
|
||||
return res
|
||||
}
|
Loading…
Reference in New Issue
Block a user