diff --git a/rpc/store/pb/store.pb.go b/rpc/store/pb/store.pb.go index c9eed69..cbc1cab 100644 --- a/rpc/store/pb/store.pb.go +++ b/rpc/store/pb/store.pb.go @@ -222,6 +222,1090 @@ func (x *Response) GetData() string { return "" } +type EditRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + UserMobile string `protobuf:"bytes,2,opt,name=user_mobile,json=userMobile,proto3" json:"user_mobile,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + IdCard string `protobuf:"bytes,4,opt,name=id_card,json=idCard,proto3" json:"id_card,omitempty"` + Receipt string `protobuf:"bytes,5,opt,name=receipt,proto3" json:"receipt,omitempty"` + Type int32 `protobuf:"varint,6,opt,name=type,proto3" json:"type,omitempty"` + Area string `protobuf:"bytes,7,opt,name=area,proto3" json:"area,omitempty"` + StoreImages string `protobuf:"bytes,8,opt,name=store_images,json=storeImages,proto3" json:"store_images,omitempty"` + DistrictIds string `protobuf:"bytes,9,opt,name=district_ids,json=districtIds,proto3" json:"district_ids,omitempty"` + Address string `protobuf:"bytes,10,opt,name=address,proto3" json:"address,omitempty"` + BankInfo string `protobuf:"bytes,11,opt,name=bank_info,json=bankInfo,proto3" json:"bank_info,omitempty"` + UserName string `protobuf:"bytes,12,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty"` + BusinessLicense string `protobuf:"bytes,13,opt,name=business_license,json=businessLicense,proto3" json:"business_license,omitempty"` + Images string `protobuf:"bytes,14,opt,name=images,proto3" json:"images,omitempty"` + SaleId int64 `protobuf:"varint,15,opt,name=sale_id,json=saleId,proto3" json:"sale_id,omitempty"` + Contact string `protobuf:"bytes,16,opt,name=contact,proto3" json:"contact,omitempty"` + Content string `protobuf:"bytes,17,opt,name=content,proto3" json:"content,omitempty"` + OpenTime string `protobuf:"bytes,18,opt,name=open_time,json=openTime,proto3" json:"open_time,omitempty"` + LongitudeWgs84 string `protobuf:"bytes,19,opt,name=longitude_wgs84,json=longitudeWgs84,proto3" json:"longitude_wgs84,omitempty"` + LatitudeWgs84 string `protobuf:"bytes,20,opt,name=latitude_wgs84,json=latitudeWgs84,proto3" json:"latitude_wgs84,omitempty"` + LongitudeGcj02 string `protobuf:"bytes,21,opt,name=longitude_gcj02,json=longitudeGcj02,proto3" json:"longitude_gcj02,omitempty"` + LatitudeGcj02 string `protobuf:"bytes,22,opt,name=latitude_gcj02,json=latitudeGcj02,proto3" json:"latitude_gcj02,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EditRequest) Reset() { + *x = EditRequest{} + mi := &file_store_store_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EditRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EditRequest) ProtoMessage() {} + +func (x *EditRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EditRequest.ProtoReflect.Descriptor instead. +func (*EditRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{4} +} + +func (x *EditRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *EditRequest) GetUserMobile() string { + if x != nil { + return x.UserMobile + } + return "" +} + +func (x *EditRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *EditRequest) GetIdCard() string { + if x != nil { + return x.IdCard + } + return "" +} + +func (x *EditRequest) GetReceipt() string { + if x != nil { + return x.Receipt + } + return "" +} + +func (x *EditRequest) GetType() int32 { + if x != nil { + return x.Type + } + return 0 +} + +func (x *EditRequest) GetArea() string { + if x != nil { + return x.Area + } + return "" +} + +func (x *EditRequest) GetStoreImages() string { + if x != nil { + return x.StoreImages + } + return "" +} + +func (x *EditRequest) GetDistrictIds() string { + if x != nil { + return x.DistrictIds + } + return "" +} + +func (x *EditRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *EditRequest) GetBankInfo() string { + if x != nil { + return x.BankInfo + } + return "" +} + +func (x *EditRequest) GetUserName() string { + if x != nil { + return x.UserName + } + return "" +} + +func (x *EditRequest) GetBusinessLicense() string { + if x != nil { + return x.BusinessLicense + } + return "" +} + +func (x *EditRequest) GetImages() string { + if x != nil { + return x.Images + } + return "" +} + +func (x *EditRequest) GetSaleId() int64 { + if x != nil { + return x.SaleId + } + return 0 +} + +func (x *EditRequest) GetContact() string { + if x != nil { + return x.Contact + } + return "" +} + +func (x *EditRequest) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *EditRequest) GetOpenTime() string { + if x != nil { + return x.OpenTime + } + return "" +} + +func (x *EditRequest) GetLongitudeWgs84() string { + if x != nil { + return x.LongitudeWgs84 + } + return "" +} + +func (x *EditRequest) GetLatitudeWgs84() string { + if x != nil { + return x.LatitudeWgs84 + } + return "" +} + +func (x *EditRequest) GetLongitudeGcj02() string { + if x != nil { + return x.LongitudeGcj02 + } + return "" +} + +func (x *EditRequest) GetLatitudeGcj02() string { + if x != nil { + return x.LatitudeGcj02 + } + return "" +} + +type CreateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserMobile string `protobuf:"bytes,1,opt,name=user_mobile,json=userMobile,proto3" json:"user_mobile,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + District string `protobuf:"bytes,3,opt,name=district,proto3" json:"district,omitempty"` + DistrictIds string `protobuf:"bytes,4,opt,name=district_ids,json=districtIds,proto3" json:"district_ids,omitempty"` + Address string `protobuf:"bytes,5,opt,name=address,proto3" json:"address,omitempty"` + UserName string `protobuf:"bytes,6,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty"` + Password string `protobuf:"bytes,7,opt,name=password,proto3" json:"password,omitempty"` + BusinessLicense string `protobuf:"bytes,8,opt,name=business_license,json=businessLicense,proto3" json:"business_license,omitempty"` + BankInfo string `protobuf:"bytes,9,opt,name=bank_info,json=bankInfo,proto3" json:"bank_info,omitempty"` + Images string `protobuf:"bytes,10,opt,name=images,proto3" json:"images,omitempty"` + SaleId int64 `protobuf:"varint,11,opt,name=sale_id,json=saleId,proto3" json:"sale_id,omitempty"` + IdCard string `protobuf:"bytes,12,opt,name=id_card,json=idCard,proto3" json:"id_card,omitempty"` + ConsigneeMobile string `protobuf:"bytes,13,opt,name=consignee_mobile,json=consigneeMobile,proto3" json:"consignee_mobile,omitempty"` + ConsigneeName string `protobuf:"bytes,14,opt,name=consignee_name,json=consigneeName,proto3" json:"consignee_name,omitempty"` + Receipt string `protobuf:"bytes,15,opt,name=receipt,proto3" json:"receipt,omitempty"` + Type int32 `protobuf:"varint,16,opt,name=type,proto3" json:"type,omitempty"` + Area string `protobuf:"bytes,17,opt,name=area,proto3" json:"area,omitempty"` + StoreImages string `protobuf:"bytes,18,opt,name=store_images,json=storeImages,proto3" json:"store_images,omitempty"` + Contact string `protobuf:"bytes,19,opt,name=contact,proto3" json:"contact,omitempty"` + Content string `protobuf:"bytes,20,opt,name=content,proto3" json:"content,omitempty"` + OpenTime string `protobuf:"bytes,21,opt,name=open_time,json=openTime,proto3" json:"open_time,omitempty"` + LongitudeWgs84 string `protobuf:"bytes,22,opt,name=longitude_wgs84,json=longitudeWgs84,proto3" json:"longitude_wgs84,omitempty"` + LatitudeWgs84 string `protobuf:"bytes,23,opt,name=latitude_wgs84,json=latitudeWgs84,proto3" json:"latitude_wgs84,omitempty"` + LongitudeGcj02 string `protobuf:"bytes,24,opt,name=longitude_gcj02,json=longitudeGcj02,proto3" json:"longitude_gcj02,omitempty"` + LatitudeGcj02 string `protobuf:"bytes,25,opt,name=latitude_gcj02,json=latitudeGcj02,proto3" json:"latitude_gcj02,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateRequest) Reset() { + *x = CreateRequest{} + mi := &file_store_store_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRequest) ProtoMessage() {} + +func (x *CreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead. +func (*CreateRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateRequest) GetUserMobile() string { + if x != nil { + return x.UserMobile + } + return "" +} + +func (x *CreateRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateRequest) GetDistrict() string { + if x != nil { + return x.District + } + return "" +} + +func (x *CreateRequest) GetDistrictIds() string { + if x != nil { + return x.DistrictIds + } + return "" +} + +func (x *CreateRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *CreateRequest) GetUserName() string { + if x != nil { + return x.UserName + } + return "" +} + +func (x *CreateRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *CreateRequest) GetBusinessLicense() string { + if x != nil { + return x.BusinessLicense + } + return "" +} + +func (x *CreateRequest) GetBankInfo() string { + if x != nil { + return x.BankInfo + } + return "" +} + +func (x *CreateRequest) GetImages() string { + if x != nil { + return x.Images + } + return "" +} + +func (x *CreateRequest) GetSaleId() int64 { + if x != nil { + return x.SaleId + } + return 0 +} + +func (x *CreateRequest) GetIdCard() string { + if x != nil { + return x.IdCard + } + return "" +} + +func (x *CreateRequest) GetConsigneeMobile() string { + if x != nil { + return x.ConsigneeMobile + } + return "" +} + +func (x *CreateRequest) GetConsigneeName() string { + if x != nil { + return x.ConsigneeName + } + return "" +} + +func (x *CreateRequest) GetReceipt() string { + if x != nil { + return x.Receipt + } + return "" +} + +func (x *CreateRequest) GetType() int32 { + if x != nil { + return x.Type + } + return 0 +} + +func (x *CreateRequest) GetArea() string { + if x != nil { + return x.Area + } + return "" +} + +func (x *CreateRequest) GetStoreImages() string { + if x != nil { + return x.StoreImages + } + return "" +} + +func (x *CreateRequest) GetContact() string { + if x != nil { + return x.Contact + } + return "" +} + +func (x *CreateRequest) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *CreateRequest) GetOpenTime() string { + if x != nil { + return x.OpenTime + } + return "" +} + +func (x *CreateRequest) GetLongitudeWgs84() string { + if x != nil { + return x.LongitudeWgs84 + } + return "" +} + +func (x *CreateRequest) GetLatitudeWgs84() string { + if x != nil { + return x.LatitudeWgs84 + } + return "" +} + +func (x *CreateRequest) GetLongitudeGcj02() string { + if x != nil { + return x.LongitudeGcj02 + } + return "" +} + +func (x *CreateRequest) GetLatitudeGcj02() string { + if x != nil { + return x.LatitudeGcj02 + } + return "" +} + +type ToSaleRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + SaleId int64 `protobuf:"varint,2,opt,name=sale_id,json=saleId,proto3" json:"sale_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ToSaleRequest) Reset() { + *x = ToSaleRequest{} + mi := &file_store_store_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ToSaleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToSaleRequest) ProtoMessage() {} + +func (x *ToSaleRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ToSaleRequest.ProtoReflect.Descriptor instead. +func (*ToSaleRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{6} +} + +func (x *ToSaleRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ToSaleRequest) GetSaleId() int64 { + if x != nil { + return x.SaleId + } + return 0 +} + +type PwdRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PwdRequest) Reset() { + *x = PwdRequest{} + mi := &file_store_store_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PwdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PwdRequest) ProtoMessage() {} + +func (x *PwdRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PwdRequest.ProtoReflect.Descriptor instead. +func (*PwdRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{7} +} + +func (x *PwdRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *PwdRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type ContentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ContentRequest) Reset() { + *x = ContentRequest{} + mi := &file_store_store_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ContentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContentRequest) ProtoMessage() {} + +func (x *ContentRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContentRequest.ProtoReflect.Descriptor instead. +func (*ContentRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{8} +} + +func (x *ContentRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ContentRequest) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +type ItemsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` + Size int32 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` + SaleId int64 `protobuf:"varint,4,opt,name=sale_id,json=saleId,proto3" json:"sale_id,omitempty"` + Status int32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ItemsRequest) Reset() { + *x = ItemsRequest{} + mi := &file_store_store_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ItemsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ItemsRequest) ProtoMessage() {} + +func (x *ItemsRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ItemsRequest.ProtoReflect.Descriptor instead. +func (*ItemsRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{9} +} + +func (x *ItemsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ItemsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ItemsRequest) GetSize() int32 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *ItemsRequest) GetSaleId() int64 { + if x != nil { + return x.SaleId + } + return 0 +} + +func (x *ItemsRequest) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +type VerifyItemsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` + Size int32 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` + SaleId int64 `protobuf:"varint,4,opt,name=sale_id,json=saleId,proto3" json:"sale_id,omitempty"` + Status int32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyItemsRequest) Reset() { + *x = VerifyItemsRequest{} + mi := &file_store_store_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyItemsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyItemsRequest) ProtoMessage() {} + +func (x *VerifyItemsRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyItemsRequest.ProtoReflect.Descriptor instead. +func (*VerifyItemsRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{10} +} + +func (x *VerifyItemsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *VerifyItemsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *VerifyItemsRequest) GetSize() int32 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *VerifyItemsRequest) GetSaleId() int64 { + if x != nil { + return x.SaleId + } + return 0 +} + +func (x *VerifyItemsRequest) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +type VerifyEditRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyEditRequest) Reset() { + *x = VerifyEditRequest{} + mi := &file_store_store_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyEditRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyEditRequest) ProtoMessage() {} + +func (x *VerifyEditRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyEditRequest.ProtoReflect.Descriptor instead. +func (*VerifyEditRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{11} +} + +func (x *VerifyEditRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +type ApplyEditRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApplyEditRequest) Reset() { + *x = ApplyEditRequest{} + mi := &file_store_store_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApplyEditRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplyEditRequest) ProtoMessage() {} + +func (x *ApplyEditRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApplyEditRequest.ProtoReflect.Descriptor instead. +func (*ApplyEditRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{12} +} + +func (x *ApplyEditRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ApplyEditRequest) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +type DepositItemsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` + Size int32 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` + Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DepositItemsRequest) Reset() { + *x = DepositItemsRequest{} + mi := &file_store_store_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DepositItemsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DepositItemsRequest) ProtoMessage() {} + +func (x *DepositItemsRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DepositItemsRequest.ProtoReflect.Descriptor instead. +func (*DepositItemsRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{13} +} + +func (x *DepositItemsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DepositItemsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *DepositItemsRequest) GetSize() int32 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *DepositItemsRequest) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +type DepositVerifyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` + Size int32 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DepositVerifyRequest) Reset() { + *x = DepositVerifyRequest{} + mi := &file_store_store_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DepositVerifyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DepositVerifyRequest) ProtoMessage() {} + +func (x *DepositVerifyRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DepositVerifyRequest.ProtoReflect.Descriptor instead. +func (*DepositVerifyRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{14} +} + +func (x *DepositVerifyRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DepositVerifyRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *DepositVerifyRequest) GetSize() int32 { + if x != nil { + return x.Size + } + return 0 +} + +type DepositIgnoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DepositIgnoreRequest) Reset() { + *x = DepositIgnoreRequest{} + mi := &file_store_store_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DepositIgnoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DepositIgnoreRequest) ProtoMessage() {} + +func (x *DepositIgnoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DepositIgnoreRequest.ProtoReflect.Descriptor instead. +func (*DepositIgnoreRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{15} +} + +func (x *DepositIgnoreRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *DepositIgnoreRequest) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +type DepositBackfillRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Amount float64 `protobuf:"fixed64,2,opt,name=amount,proto3" json:"amount,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DepositBackfillRequest) Reset() { + *x = DepositBackfillRequest{} + mi := &file_store_store_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DepositBackfillRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DepositBackfillRequest) ProtoMessage() {} + +func (x *DepositBackfillRequest) ProtoReflect() protoreflect.Message { + mi := &file_store_store_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DepositBackfillRequest.ProtoReflect.Descriptor instead. +func (*DepositBackfillRequest) Descriptor() ([]byte, []int) { + return file_store_store_proto_rawDescGZIP(), []int{16} +} + +func (x *DepositBackfillRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *DepositBackfillRequest) GetAmount() float64 { + if x != nil { + return x.Amount + } + return 0 +} + var File_store_store_proto protoreflect.FileDescriptor const file_store_store_proto_rawDesc = "" + @@ -237,9 +1321,127 @@ const file_store_store_proto_rawDesc = "" + "\bResponse\x12\x12\n" + "\x04code\x18\x01 \x01(\x05R\x04code\x12\x10\n" + "\x03msg\x18\x02 \x01(\tR\x03msg\x12\x12\n" + - "\x04data\x18\x03 \x01(\tR\x04data2[\n" + + "\x04data\x18\x03 \x01(\tR\x04data\"\x94\x05\n" + + "\vEditRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1f\n" + + "\vuser_mobile\x18\x02 \x01(\tR\n" + + "userMobile\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12\x17\n" + + "\aid_card\x18\x04 \x01(\tR\x06idCard\x12\x18\n" + + "\areceipt\x18\x05 \x01(\tR\areceipt\x12\x12\n" + + "\x04type\x18\x06 \x01(\x05R\x04type\x12\x12\n" + + "\x04area\x18\a \x01(\tR\x04area\x12!\n" + + "\fstore_images\x18\b \x01(\tR\vstoreImages\x12!\n" + + "\fdistrict_ids\x18\t \x01(\tR\vdistrictIds\x12\x18\n" + + "\aaddress\x18\n" + + " \x01(\tR\aaddress\x12\x1b\n" + + "\tbank_info\x18\v \x01(\tR\bbankInfo\x12\x1b\n" + + "\tuser_name\x18\f \x01(\tR\buserName\x12)\n" + + "\x10business_license\x18\r \x01(\tR\x0fbusinessLicense\x12\x16\n" + + "\x06images\x18\x0e \x01(\tR\x06images\x12\x17\n" + + "\asale_id\x18\x0f \x01(\x03R\x06saleId\x12\x18\n" + + "\acontact\x18\x10 \x01(\tR\acontact\x12\x18\n" + + "\acontent\x18\x11 \x01(\tR\acontent\x12\x1b\n" + + "\topen_time\x18\x12 \x01(\tR\bopenTime\x12'\n" + + "\x0flongitude_wgs84\x18\x13 \x01(\tR\x0elongitudeWgs84\x12%\n" + + "\x0elatitude_wgs84\x18\x14 \x01(\tR\rlatitudeWgs84\x12'\n" + + "\x0flongitude_gcj02\x18\x15 \x01(\tR\x0elongitudeGcj02\x12%\n" + + "\x0elatitude_gcj02\x18\x16 \x01(\tR\rlatitudeGcj02\"\x90\x06\n" + + "\rCreateRequest\x12\x1f\n" + + "\vuser_mobile\x18\x01 \x01(\tR\n" + + "userMobile\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1a\n" + + "\bdistrict\x18\x03 \x01(\tR\bdistrict\x12!\n" + + "\fdistrict_ids\x18\x04 \x01(\tR\vdistrictIds\x12\x18\n" + + "\aaddress\x18\x05 \x01(\tR\aaddress\x12\x1b\n" + + "\tuser_name\x18\x06 \x01(\tR\buserName\x12\x1a\n" + + "\bpassword\x18\a \x01(\tR\bpassword\x12)\n" + + "\x10business_license\x18\b \x01(\tR\x0fbusinessLicense\x12\x1b\n" + + "\tbank_info\x18\t \x01(\tR\bbankInfo\x12\x16\n" + + "\x06images\x18\n" + + " \x01(\tR\x06images\x12\x17\n" + + "\asale_id\x18\v \x01(\x03R\x06saleId\x12\x17\n" + + "\aid_card\x18\f \x01(\tR\x06idCard\x12)\n" + + "\x10consignee_mobile\x18\r \x01(\tR\x0fconsigneeMobile\x12%\n" + + "\x0econsignee_name\x18\x0e \x01(\tR\rconsigneeName\x12\x18\n" + + "\areceipt\x18\x0f \x01(\tR\areceipt\x12\x12\n" + + "\x04type\x18\x10 \x01(\x05R\x04type\x12\x12\n" + + "\x04area\x18\x11 \x01(\tR\x04area\x12!\n" + + "\fstore_images\x18\x12 \x01(\tR\vstoreImages\x12\x18\n" + + "\acontact\x18\x13 \x01(\tR\acontact\x12\x18\n" + + "\acontent\x18\x14 \x01(\tR\acontent\x12\x1b\n" + + "\topen_time\x18\x15 \x01(\tR\bopenTime\x12'\n" + + "\x0flongitude_wgs84\x18\x16 \x01(\tR\x0elongitudeWgs84\x12%\n" + + "\x0elatitude_wgs84\x18\x17 \x01(\tR\rlatitudeWgs84\x12'\n" + + "\x0flongitude_gcj02\x18\x18 \x01(\tR\x0elongitudeGcj02\x12%\n" + + "\x0elatitude_gcj02\x18\x19 \x01(\tR\rlatitudeGcj02\"8\n" + + "\rToSaleRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x17\n" + + "\asale_id\x18\x02 \x01(\x03R\x06saleId\"8\n" + + "\n" + + "PwdRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\":\n" + + "\x0eContentRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x18\n" + + "\acontent\x18\x02 \x01(\tR\acontent\"{\n" + + "\fItemsRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04page\x18\x02 \x01(\x05R\x04page\x12\x12\n" + + "\x04size\x18\x03 \x01(\x05R\x04size\x12\x17\n" + + "\asale_id\x18\x04 \x01(\x03R\x06saleId\x12\x16\n" + + "\x06status\x18\x05 \x01(\x05R\x06status\"\x81\x01\n" + + "\x12VerifyItemsRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04page\x18\x02 \x01(\x05R\x04page\x12\x12\n" + + "\x04size\x18\x03 \x01(\x05R\x04size\x12\x17\n" + + "\asale_id\x18\x04 \x01(\x03R\x06saleId\x12\x16\n" + + "\x06status\x18\x05 \x01(\x05R\x06status\"#\n" + + "\x11VerifyEditRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\":\n" + + "\x10ApplyEditRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" + + "\x06reason\x18\x02 \x01(\tR\x06reason\"i\n" + + "\x13DepositItemsRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04page\x18\x02 \x01(\x05R\x04page\x12\x12\n" + + "\x04size\x18\x03 \x01(\x05R\x04size\x12\x16\n" + + "\x06status\x18\x04 \x01(\x05R\x06status\"R\n" + + "\x14DepositVerifyRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04page\x18\x02 \x01(\x05R\x04page\x12\x12\n" + + "\x04size\x18\x03 \x01(\x05R\x04size\">\n" + + "\x14DepositIgnoreRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" + + "\x06reason\x18\x02 \x01(\tR\x06reason\"@\n" + + "\x16DepositBackfillRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" + + "\x06amount\x18\x02 \x01(\x01R\x06amount2\xe8\x10\n" + "\x05Store\x12R\n" + - "\x06Status\x12\x14.store.StatusRequest\x1a\x0f.store.Response\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/admin/v3/store/statusB\tZ\a./storeb\x06proto3" + "\x06Status\x12\x14.store.StatusRequest\x1a\x0f.store.Response\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/admin/v3/store/status\x12L\n" + + "\x04Edit\x12\x12.store.EditRequest\x1a\x0f.store.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/admin/v3/store/edit\x12R\n" + + "\x06Create\x12\x14.store.CreateRequest\x1a\x0f.store.Response\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/admin/v3/store/create\x12S\n" + + "\x06ToSale\x12\x14.store.StatusRequest\x1a\x0f.store.Response\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\"\x17/admin/v3/store/to_sale\x12I\n" + + "\x03Pwd\x12\x11.store.PwdRequest\x1a\x0f.store.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/admin/v3/store/pwd\x12N\n" + + "\x04Info\x12\x14.store.ToSaleRequest\x1a\x0f.store.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\x12\x14/admin/v3/store/info\x12U\n" + + "\aContent\x12\x15.store.ContentRequest\x1a\x0f.store.Response\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\x12\x17/admin/v3/store/content\x12O\n" + + "\x05Names\x12\x13.store.EmptyRequest\x1a\x0f.store.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/admin/v3/store/names\x12O\n" + + "\x05Items\x12\x13.store.ItemsRequest\x1a\x0f.store.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/admin/v3/store/items\x12b\n" + + "\vVerifyItems\x12\x19.store.VerifyItemsRequest\x1a\x0f.store.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\x12\x1c/admin/v3/store/verify/items\x12_\n" + + "\fVerifyStatus\x12\x14.store.StatusRequest\x1a\x0f.store.Response\"(\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/admin/v3/store/verify/status\x12Y\n" + + "\n" + + "VerifyEdit\x12\x12.store.EditRequest\x1a\x0f.store.Response\"&\x82\xd3\xe4\x93\x02 :\x01*\"\x1b/admin/v3/store/verify/edit\x12\\\n" + + "\tApplyEdit\x12\x17.store.ApplyEditRequest\x1a\x0f.store.Response\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\"\x1a/admin/v3/store/apply/edit\x12\\\n" + + "\vApplyVerify\x12\x13.store.ItemsRequest\x1a\x0f.store.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\x12\x1c/admin/v3/store/apply/verify\x12c\n" + + "\x11ApplyVerifyStatus\x12\x14.store.StatusRequest\x1a\x0f.store.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/admin/v3/store/apply/status\x12Y\n" + + "\vDepositDone\x12\x10.store.IdRequest\x1a\x0f.store.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/admin/v3/store/deposit/done\x12h\n" + + "\rDepositIgnore\x12\x1b.store.DepositIgnoreRequest\x1a\x0f.store.Response\")\x82\xd3\xe4\x93\x02#:\x01*\"\x1e/admin/v3/store/deposit/ignore\x12h\n" + + "\rDepositVerify\x12\x1b.store.DepositVerifyRequest\x1a\x0f.store.Response\")\x82\xd3\xe4\x93\x02#:\x01*\x12\x1e/admin/v3/store/deposit/verify\x12c\n" + + "\vDepositDown\x12\x1a.store.DepositItemsRequest\x1a\x0f.store.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\x12\x1c/admin/v3/store/deposit/down\x12e\n" + + "\fDepositItems\x12\x1a.store.DepositItemsRequest\x1a\x0f.store.Response\"(\x82\xd3\xe4\x93\x02\":\x01*\x12\x1d/admin/v3/store/deposit/items\x12s\n" + + "\x12DepositIgnoreItems\x12\x1b.store.DepositVerifyRequest\x1a\x0f.store.Response\"/\x82\xd3\xe4\x93\x02):\x01*\x12$/admin/v3/store/deposit/ignore/items\x12_\n" + + "\x0eDepositRecover\x12\x10.store.IdRequest\x1a\x0f.store.Response\"*\x82\xd3\xe4\x93\x02$:\x01*\x12\x1f/admin/v3/store/deposit/recover\x12n\n" + + "\x0fDepositBackfill\x12\x1d.store.DepositBackfillRequest\x1a\x0f.store.Response\"+\x82\xd3\xe4\x93\x02%:\x01*\x12 /admin/v3/store/deposit/backfillB\tZ\a./storeb\x06proto3" var ( file_store_store_proto_rawDescOnce sync.Once @@ -253,21 +1455,78 @@ func file_store_store_proto_rawDescGZIP() []byte { return file_store_store_proto_rawDescData } -var file_store_store_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_store_store_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_store_store_proto_goTypes = []any{ - (*EmptyRequest)(nil), // 0: store.EmptyRequest - (*IdRequest)(nil), // 1: store.IdRequest - (*StatusRequest)(nil), // 2: store.StatusRequest - (*Response)(nil), // 3: store.Response + (*EmptyRequest)(nil), // 0: store.EmptyRequest + (*IdRequest)(nil), // 1: store.IdRequest + (*StatusRequest)(nil), // 2: store.StatusRequest + (*Response)(nil), // 3: store.Response + (*EditRequest)(nil), // 4: store.EditRequest + (*CreateRequest)(nil), // 5: store.CreateRequest + (*ToSaleRequest)(nil), // 6: store.ToSaleRequest + (*PwdRequest)(nil), // 7: store.PwdRequest + (*ContentRequest)(nil), // 8: store.ContentRequest + (*ItemsRequest)(nil), // 9: store.ItemsRequest + (*VerifyItemsRequest)(nil), // 10: store.VerifyItemsRequest + (*VerifyEditRequest)(nil), // 11: store.VerifyEditRequest + (*ApplyEditRequest)(nil), // 12: store.ApplyEditRequest + (*DepositItemsRequest)(nil), // 13: store.DepositItemsRequest + (*DepositVerifyRequest)(nil), // 14: store.DepositVerifyRequest + (*DepositIgnoreRequest)(nil), // 15: store.DepositIgnoreRequest + (*DepositBackfillRequest)(nil), // 16: store.DepositBackfillRequest } var file_store_store_proto_depIdxs = []int32{ - 2, // 0: store.Store.Status:input_type -> store.StatusRequest - 3, // 1: store.Store.Status:output_type -> store.Response - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] 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 + 2, // 0: store.Store.Status:input_type -> store.StatusRequest + 4, // 1: store.Store.Edit:input_type -> store.EditRequest + 5, // 2: store.Store.Create:input_type -> store.CreateRequest + 2, // 3: store.Store.ToSale:input_type -> store.StatusRequest + 7, // 4: store.Store.Pwd:input_type -> store.PwdRequest + 6, // 5: store.Store.Info:input_type -> store.ToSaleRequest + 8, // 6: store.Store.Content:input_type -> store.ContentRequest + 0, // 7: store.Store.Names:input_type -> store.EmptyRequest + 9, // 8: store.Store.Items:input_type -> store.ItemsRequest + 10, // 9: store.Store.VerifyItems:input_type -> store.VerifyItemsRequest + 2, // 10: store.Store.VerifyStatus:input_type -> store.StatusRequest + 4, // 11: store.Store.VerifyEdit:input_type -> store.EditRequest + 12, // 12: store.Store.ApplyEdit:input_type -> store.ApplyEditRequest + 9, // 13: store.Store.ApplyVerify:input_type -> store.ItemsRequest + 2, // 14: store.Store.ApplyVerifyStatus:input_type -> store.StatusRequest + 1, // 15: store.Store.DepositDone:input_type -> store.IdRequest + 15, // 16: store.Store.DepositIgnore:input_type -> store.DepositIgnoreRequest + 14, // 17: store.Store.DepositVerify:input_type -> store.DepositVerifyRequest + 13, // 18: store.Store.DepositDown:input_type -> store.DepositItemsRequest + 13, // 19: store.Store.DepositItems:input_type -> store.DepositItemsRequest + 14, // 20: store.Store.DepositIgnoreItems:input_type -> store.DepositVerifyRequest + 1, // 21: store.Store.DepositRecover:input_type -> store.IdRequest + 16, // 22: store.Store.DepositBackfill:input_type -> store.DepositBackfillRequest + 3, // 23: store.Store.Status:output_type -> store.Response + 3, // 24: store.Store.Edit:output_type -> store.Response + 3, // 25: store.Store.Create:output_type -> store.Response + 3, // 26: store.Store.ToSale:output_type -> store.Response + 3, // 27: store.Store.Pwd:output_type -> store.Response + 3, // 28: store.Store.Info:output_type -> store.Response + 3, // 29: store.Store.Content:output_type -> store.Response + 3, // 30: store.Store.Names:output_type -> store.Response + 3, // 31: store.Store.Items:output_type -> store.Response + 3, // 32: store.Store.VerifyItems:output_type -> store.Response + 3, // 33: store.Store.VerifyStatus:output_type -> store.Response + 3, // 34: store.Store.VerifyEdit:output_type -> store.Response + 3, // 35: store.Store.ApplyEdit:output_type -> store.Response + 3, // 36: store.Store.ApplyVerify:output_type -> store.Response + 3, // 37: store.Store.ApplyVerifyStatus:output_type -> store.Response + 3, // 38: store.Store.DepositDone:output_type -> store.Response + 3, // 39: store.Store.DepositIgnore:output_type -> store.Response + 3, // 40: store.Store.DepositVerify:output_type -> store.Response + 3, // 41: store.Store.DepositDown:output_type -> store.Response + 3, // 42: store.Store.DepositItems:output_type -> store.Response + 3, // 43: store.Store.DepositIgnoreItems:output_type -> store.Response + 3, // 44: store.Store.DepositRecover:output_type -> store.Response + 3, // 45: store.Store.DepositBackfill:output_type -> store.Response + 23, // [23:46] is the sub-list for method output_type + 0, // [0:23] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_store_store_proto_init() } @@ -281,7 +1540,7 @@ func file_store_store_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_store_proto_rawDesc), len(file_store_store_proto_rawDesc)), NumEnums: 0, - NumMessages: 4, + NumMessages: 17, NumExtensions: 0, NumServices: 1, }, diff --git a/rpc/store/pb/store_grpc.pb.go b/rpc/store/pb/store_grpc.pb.go index 7bf7cbc..d67d2e4 100644 --- a/rpc/store/pb/store_grpc.pb.go +++ b/rpc/store/pb/store_grpc.pb.go @@ -19,7 +19,29 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Store_Status_FullMethodName = "/store.Store/Status" + Store_Status_FullMethodName = "/store.Store/Status" + Store_Edit_FullMethodName = "/store.Store/Edit" + Store_Create_FullMethodName = "/store.Store/Create" + Store_ToSale_FullMethodName = "/store.Store/ToSale" + Store_Pwd_FullMethodName = "/store.Store/Pwd" + Store_Info_FullMethodName = "/store.Store/Info" + Store_Content_FullMethodName = "/store.Store/Content" + Store_Names_FullMethodName = "/store.Store/Names" + Store_Items_FullMethodName = "/store.Store/Items" + Store_VerifyItems_FullMethodName = "/store.Store/VerifyItems" + Store_VerifyStatus_FullMethodName = "/store.Store/VerifyStatus" + Store_VerifyEdit_FullMethodName = "/store.Store/VerifyEdit" + Store_ApplyEdit_FullMethodName = "/store.Store/ApplyEdit" + Store_ApplyVerify_FullMethodName = "/store.Store/ApplyVerify" + Store_ApplyVerifyStatus_FullMethodName = "/store.Store/ApplyVerifyStatus" + Store_DepositDone_FullMethodName = "/store.Store/DepositDone" + Store_DepositIgnore_FullMethodName = "/store.Store/DepositIgnore" + Store_DepositVerify_FullMethodName = "/store.Store/DepositVerify" + Store_DepositDown_FullMethodName = "/store.Store/DepositDown" + Store_DepositItems_FullMethodName = "/store.Store/DepositItems" + Store_DepositIgnoreItems_FullMethodName = "/store.Store/DepositIgnoreItems" + Store_DepositRecover_FullMethodName = "/store.Store/DepositRecover" + Store_DepositBackfill_FullMethodName = "/store.Store/DepositBackfill" ) // StoreClient is the client API for Store service. @@ -27,6 +49,28 @@ const ( // 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 StoreClient interface { Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) + Edit(ctx context.Context, in *EditRequest, opts ...grpc.CallOption) (*Response, error) + Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*Response, error) + ToSale(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) + Pwd(ctx context.Context, in *PwdRequest, opts ...grpc.CallOption) (*Response, error) + Info(ctx context.Context, in *ToSaleRequest, opts ...grpc.CallOption) (*Response, error) + Content(ctx context.Context, in *ContentRequest, opts ...grpc.CallOption) (*Response, error) + Names(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*Response, error) + Items(ctx context.Context, in *ItemsRequest, opts ...grpc.CallOption) (*Response, error) + VerifyItems(ctx context.Context, in *VerifyItemsRequest, opts ...grpc.CallOption) (*Response, error) + VerifyStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) + VerifyEdit(ctx context.Context, in *EditRequest, opts ...grpc.CallOption) (*Response, error) + ApplyEdit(ctx context.Context, in *ApplyEditRequest, opts ...grpc.CallOption) (*Response, error) + ApplyVerify(ctx context.Context, in *ItemsRequest, opts ...grpc.CallOption) (*Response, error) + ApplyVerifyStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) + DepositDone(ctx context.Context, in *IdRequest, opts ...grpc.CallOption) (*Response, error) + DepositIgnore(ctx context.Context, in *DepositIgnoreRequest, opts ...grpc.CallOption) (*Response, error) + DepositVerify(ctx context.Context, in *DepositVerifyRequest, opts ...grpc.CallOption) (*Response, error) + DepositDown(ctx context.Context, in *DepositItemsRequest, opts ...grpc.CallOption) (*Response, error) + DepositItems(ctx context.Context, in *DepositItemsRequest, opts ...grpc.CallOption) (*Response, error) + DepositIgnoreItems(ctx context.Context, in *DepositVerifyRequest, opts ...grpc.CallOption) (*Response, error) + DepositRecover(ctx context.Context, in *IdRequest, opts ...grpc.CallOption) (*Response, error) + DepositBackfill(ctx context.Context, in *DepositBackfillRequest, opts ...grpc.CallOption) (*Response, error) } type storeClient struct { @@ -47,11 +91,253 @@ func (c *storeClient) Status(ctx context.Context, in *StatusRequest, opts ...grp return out, nil } +func (c *storeClient) Edit(ctx context.Context, in *EditRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_Edit_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_Create_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) ToSale(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_ToSale_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Pwd(ctx context.Context, in *PwdRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_Pwd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Info(ctx context.Context, in *ToSaleRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_Info_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Content(ctx context.Context, in *ContentRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_Content_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Names(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_Names_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Items(ctx context.Context, in *ItemsRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_Items_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) VerifyItems(ctx context.Context, in *VerifyItemsRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_VerifyItems_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) VerifyStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_VerifyStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) VerifyEdit(ctx context.Context, in *EditRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_VerifyEdit_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) ApplyEdit(ctx context.Context, in *ApplyEditRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_ApplyEdit_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) ApplyVerify(ctx context.Context, in *ItemsRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_ApplyVerify_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) ApplyVerifyStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_ApplyVerifyStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) DepositDone(ctx context.Context, in *IdRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_DepositDone_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) DepositIgnore(ctx context.Context, in *DepositIgnoreRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_DepositIgnore_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) DepositVerify(ctx context.Context, in *DepositVerifyRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_DepositVerify_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) DepositDown(ctx context.Context, in *DepositItemsRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_DepositDown_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) DepositItems(ctx context.Context, in *DepositItemsRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_DepositItems_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) DepositIgnoreItems(ctx context.Context, in *DepositVerifyRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_DepositIgnoreItems_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) DepositRecover(ctx context.Context, in *IdRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_DepositRecover_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) DepositBackfill(ctx context.Context, in *DepositBackfillRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Store_DepositBackfill_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // StoreServer is the server API for Store service. // All implementations must embed UnimplementedStoreServer // for forward compatibility. type StoreServer interface { Status(context.Context, *StatusRequest) (*Response, error) + Edit(context.Context, *EditRequest) (*Response, error) + Create(context.Context, *CreateRequest) (*Response, error) + ToSale(context.Context, *StatusRequest) (*Response, error) + Pwd(context.Context, *PwdRequest) (*Response, error) + Info(context.Context, *ToSaleRequest) (*Response, error) + Content(context.Context, *ContentRequest) (*Response, error) + Names(context.Context, *EmptyRequest) (*Response, error) + Items(context.Context, *ItemsRequest) (*Response, error) + VerifyItems(context.Context, *VerifyItemsRequest) (*Response, error) + VerifyStatus(context.Context, *StatusRequest) (*Response, error) + VerifyEdit(context.Context, *EditRequest) (*Response, error) + ApplyEdit(context.Context, *ApplyEditRequest) (*Response, error) + ApplyVerify(context.Context, *ItemsRequest) (*Response, error) + ApplyVerifyStatus(context.Context, *StatusRequest) (*Response, error) + DepositDone(context.Context, *IdRequest) (*Response, error) + DepositIgnore(context.Context, *DepositIgnoreRequest) (*Response, error) + DepositVerify(context.Context, *DepositVerifyRequest) (*Response, error) + DepositDown(context.Context, *DepositItemsRequest) (*Response, error) + DepositItems(context.Context, *DepositItemsRequest) (*Response, error) + DepositIgnoreItems(context.Context, *DepositVerifyRequest) (*Response, error) + DepositRecover(context.Context, *IdRequest) (*Response, error) + DepositBackfill(context.Context, *DepositBackfillRequest) (*Response, error) mustEmbedUnimplementedStoreServer() } @@ -65,6 +351,72 @@ type UnimplementedStoreServer struct{} func (UnimplementedStoreServer) Status(context.Context, *StatusRequest) (*Response, error) { return nil, status.Error(codes.Unimplemented, "method Status not implemented") } +func (UnimplementedStoreServer) Edit(context.Context, *EditRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method Edit not implemented") +} +func (UnimplementedStoreServer) Create(context.Context, *CreateRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method Create not implemented") +} +func (UnimplementedStoreServer) ToSale(context.Context, *StatusRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method ToSale not implemented") +} +func (UnimplementedStoreServer) Pwd(context.Context, *PwdRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method Pwd not implemented") +} +func (UnimplementedStoreServer) Info(context.Context, *ToSaleRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method Info not implemented") +} +func (UnimplementedStoreServer) Content(context.Context, *ContentRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method Content not implemented") +} +func (UnimplementedStoreServer) Names(context.Context, *EmptyRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method Names not implemented") +} +func (UnimplementedStoreServer) Items(context.Context, *ItemsRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method Items not implemented") +} +func (UnimplementedStoreServer) VerifyItems(context.Context, *VerifyItemsRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyItems not implemented") +} +func (UnimplementedStoreServer) VerifyStatus(context.Context, *StatusRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyStatus not implemented") +} +func (UnimplementedStoreServer) VerifyEdit(context.Context, *EditRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyEdit not implemented") +} +func (UnimplementedStoreServer) ApplyEdit(context.Context, *ApplyEditRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method ApplyEdit not implemented") +} +func (UnimplementedStoreServer) ApplyVerify(context.Context, *ItemsRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method ApplyVerify not implemented") +} +func (UnimplementedStoreServer) ApplyVerifyStatus(context.Context, *StatusRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method ApplyVerifyStatus not implemented") +} +func (UnimplementedStoreServer) DepositDone(context.Context, *IdRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method DepositDone not implemented") +} +func (UnimplementedStoreServer) DepositIgnore(context.Context, *DepositIgnoreRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method DepositIgnore not implemented") +} +func (UnimplementedStoreServer) DepositVerify(context.Context, *DepositVerifyRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method DepositVerify not implemented") +} +func (UnimplementedStoreServer) DepositDown(context.Context, *DepositItemsRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method DepositDown not implemented") +} +func (UnimplementedStoreServer) DepositItems(context.Context, *DepositItemsRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method DepositItems not implemented") +} +func (UnimplementedStoreServer) DepositIgnoreItems(context.Context, *DepositVerifyRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method DepositIgnoreItems not implemented") +} +func (UnimplementedStoreServer) DepositRecover(context.Context, *IdRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method DepositRecover not implemented") +} +func (UnimplementedStoreServer) DepositBackfill(context.Context, *DepositBackfillRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method DepositBackfill not implemented") +} func (UnimplementedStoreServer) mustEmbedUnimplementedStoreServer() {} func (UnimplementedStoreServer) testEmbeddedByValue() {} @@ -104,6 +456,402 @@ func _Store_Status_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Store_Edit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EditRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Edit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_Edit_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Edit(ctx, req.(*EditRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_Create_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Create(ctx, req.(*CreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_ToSale_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).ToSale(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_ToSale_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).ToSale(ctx, req.(*StatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Pwd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PwdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Pwd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_Pwd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Pwd(ctx, req.(*PwdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ToSaleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Info(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_Info_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Info(ctx, req.(*ToSaleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Content_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ContentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Content(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_Content_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Content(ctx, req.(*ContentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Names_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EmptyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Names(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_Names_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Names(ctx, req.(*EmptyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Items_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ItemsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Items(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_Items_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Items(ctx, req.(*ItemsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_VerifyItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyItemsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).VerifyItems(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_VerifyItems_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).VerifyItems(ctx, req.(*VerifyItemsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_VerifyStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).VerifyStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_VerifyStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).VerifyStatus(ctx, req.(*StatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_VerifyEdit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EditRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).VerifyEdit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_VerifyEdit_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).VerifyEdit(ctx, req.(*EditRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_ApplyEdit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApplyEditRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).ApplyEdit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_ApplyEdit_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).ApplyEdit(ctx, req.(*ApplyEditRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_ApplyVerify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ItemsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).ApplyVerify(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_ApplyVerify_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).ApplyVerify(ctx, req.(*ItemsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_ApplyVerifyStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).ApplyVerifyStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_ApplyVerifyStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).ApplyVerifyStatus(ctx, req.(*StatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_DepositDone_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).DepositDone(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_DepositDone_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).DepositDone(ctx, req.(*IdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_DepositIgnore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DepositIgnoreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).DepositIgnore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_DepositIgnore_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).DepositIgnore(ctx, req.(*DepositIgnoreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_DepositVerify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DepositVerifyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).DepositVerify(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_DepositVerify_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).DepositVerify(ctx, req.(*DepositVerifyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_DepositDown_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DepositItemsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).DepositDown(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_DepositDown_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).DepositDown(ctx, req.(*DepositItemsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_DepositItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DepositItemsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).DepositItems(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_DepositItems_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).DepositItems(ctx, req.(*DepositItemsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_DepositIgnoreItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DepositVerifyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).DepositIgnoreItems(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_DepositIgnoreItems_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).DepositIgnoreItems(ctx, req.(*DepositVerifyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_DepositRecover_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).DepositRecover(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_DepositRecover_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).DepositRecover(ctx, req.(*IdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_DepositBackfill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DepositBackfillRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).DepositBackfill(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Store_DepositBackfill_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).DepositBackfill(ctx, req.(*DepositBackfillRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Store_ServiceDesc is the grpc.ServiceDesc for Store service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -115,6 +863,94 @@ var Store_ServiceDesc = grpc.ServiceDesc{ MethodName: "Status", Handler: _Store_Status_Handler, }, + { + MethodName: "Edit", + Handler: _Store_Edit_Handler, + }, + { + MethodName: "Create", + Handler: _Store_Create_Handler, + }, + { + MethodName: "ToSale", + Handler: _Store_ToSale_Handler, + }, + { + MethodName: "Pwd", + Handler: _Store_Pwd_Handler, + }, + { + MethodName: "Info", + Handler: _Store_Info_Handler, + }, + { + MethodName: "Content", + Handler: _Store_Content_Handler, + }, + { + MethodName: "Names", + Handler: _Store_Names_Handler, + }, + { + MethodName: "Items", + Handler: _Store_Items_Handler, + }, + { + MethodName: "VerifyItems", + Handler: _Store_VerifyItems_Handler, + }, + { + MethodName: "VerifyStatus", + Handler: _Store_VerifyStatus_Handler, + }, + { + MethodName: "VerifyEdit", + Handler: _Store_VerifyEdit_Handler, + }, + { + MethodName: "ApplyEdit", + Handler: _Store_ApplyEdit_Handler, + }, + { + MethodName: "ApplyVerify", + Handler: _Store_ApplyVerify_Handler, + }, + { + MethodName: "ApplyVerifyStatus", + Handler: _Store_ApplyVerifyStatus_Handler, + }, + { + MethodName: "DepositDone", + Handler: _Store_DepositDone_Handler, + }, + { + MethodName: "DepositIgnore", + Handler: _Store_DepositIgnore_Handler, + }, + { + MethodName: "DepositVerify", + Handler: _Store_DepositVerify_Handler, + }, + { + MethodName: "DepositDown", + Handler: _Store_DepositDown_Handler, + }, + { + MethodName: "DepositItems", + Handler: _Store_DepositItems_Handler, + }, + { + MethodName: "DepositIgnoreItems", + Handler: _Store_DepositIgnoreItems_Handler, + }, + { + MethodName: "DepositRecover", + Handler: _Store_DepositRecover_Handler, + }, + { + MethodName: "DepositBackfill", + Handler: _Store_DepositBackfill_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "store/store.proto", diff --git a/rpc/store/store.pb b/rpc/store/store.pb index 6766d65..a27eb38 100644 Binary files a/rpc/store/store.pb and b/rpc/store/store.pb differ diff --git a/rpc/store/store.proto b/rpc/store/store.proto index f02d5b5..4f9460d 100644 --- a/rpc/store/store.proto +++ b/rpc/store/store.proto @@ -23,6 +23,120 @@ message Response { string data = 3; } +message EditRequest { + int64 id = 1; + string user_mobile = 2; + string name = 3; + string id_card = 4; + string receipt = 5; + int32 type = 6; + string area = 7; + string store_images = 8; + string district_ids = 9; + string address = 10; + string bank_info = 11; + string user_name = 12; + string business_license = 13; + string images = 14; + int64 sale_id = 15; + string contact = 16; + string content = 17; + string open_time = 18; + string longitude_wgs84 = 19; + string latitude_wgs84 = 20; + string longitude_gcj02 = 21; + string latitude_gcj02 = 22; +} + +message CreateRequest { + string user_mobile = 1; + string name = 2; + string district = 3; + string district_ids = 4; + string address = 5; + string user_name = 6; + string password = 7; + string business_license = 8; + string bank_info = 9; + string images = 10; + int64 sale_id = 11; + string id_card = 12; + string consignee_mobile = 13; + string consignee_name = 14; + string receipt = 15; + int32 type = 16; + string area = 17; + string store_images = 18; + string contact = 19; + string content = 20; + string open_time = 21; + string longitude_wgs84 = 22; + string latitude_wgs84 = 23; + string longitude_gcj02 = 24; + string latitude_gcj02 = 25; +} + +message ToSaleRequest { + int64 id = 1; + int64 sale_id = 2; +} + +message PwdRequest { + int64 id = 1; + string password = 2; +} + +message ContentRequest { + int64 id = 1; + string content = 2; +} + +message ItemsRequest { + string name = 1; + int32 page = 2; + int32 size = 3; + int64 sale_id = 4; + int32 status = 5; +} + +message VerifyItemsRequest { + string name = 1; + int32 page = 2; + int32 size = 3; + int64 sale_id = 4; + int32 status = 5; +} + +message VerifyEditRequest { + int64 id = 1; +} + +message ApplyEditRequest { + int64 id = 1; + string reason = 2; +} + +message DepositItemsRequest { + string name = 1; + int32 page = 2; + int32 size = 3; + int32 status = 4; +} +message DepositVerifyRequest { + string name = 1; + int32 page = 2; + int32 size = 3; +} +message DepositIgnoreRequest { + int64 id = 1; + string reason = 2; +} + +message DepositBackfillRequest { + int64 id = 1; + double amount = 2; +} + service Store { rpc Status(StatusRequest) returns(Response){ option (google.api.http) = { @@ -30,4 +144,142 @@ service Store { body: "*" }; }; -} + rpc Edit(EditRequest) returns(Response){ + option (google.api.http) = { + post: "/admin/v3/store/edit" + body: "*" + }; + }; + rpc Create(CreateRequest) returns(Response){ + option (google.api.http) = { + post: "/admin/v3/store/create" + body: "*" + }; + }; + rpc ToSale(StatusRequest) returns(Response){ + option (google.api.http) = { + post: "/admin/v3/store/to_sale" + body: "*" + }; + }; + rpc Pwd(PwdRequest) returns(Response){ + option (google.api.http) = { + post: "/admin/v3/store/pwd" + body: "*" + }; + }; + rpc Info(ToSaleRequest) returns(Response){ + option (google.api.http) = { + get: "/admin/v3/store/info" + body: "*" + }; + }; + rpc Content(ContentRequest) returns(Response){ + option (google.api.http) = { + get: "/admin/v3/store/content" + body: "*" + }; + }; + rpc Names(EmptyRequest) returns(Response){ + option (google.api.http) = { + get: "/admin/v3/store/names" + body: "*" + }; + }; + rpc Items(ItemsRequest) returns (Response) { + option (google.api.http) = { + get: "/admin/v3/store/items" + body: "*" + }; + } + rpc VerifyItems(VerifyItemsRequest) returns (Response) { + option (google.api.http) = { + get: "/admin/v3/store/verify/items" + body: "*" + }; + } + rpc VerifyStatus(StatusRequest) returns (Response) { + option (google.api.http) = { + post: "/admin/v3/store/verify/status" + body: "*" + }; + } + rpc VerifyEdit(EditRequest) returns (Response) { + option (google.api.http) = { + post: "/admin/v3/store/verify/edit" + body: "*" + }; + } + rpc ApplyEdit(ApplyEditRequest) returns (Response) { + option (google.api.http) = { + post: "/admin/v3/store/apply/edit" + body: "*" + }; + } + rpc ApplyVerify(ItemsRequest) returns (Response) { + option (google.api.http) = { + get: "/admin/v3/store/apply/verify" + body: "*" + }; + } + rpc ApplyVerifyStatus(StatusRequest) returns (Response) { + option (google.api.http) = { + post: "/admin/v3/store/apply/status" + body: "*" + }; + } + + rpc DepositDone(IdRequest) returns (Response) { + option (google.api.http) = { + post: "/admin/v3/store/deposit/done" + body: "*" + }; + } + + rpc DepositIgnore(DepositIgnoreRequest) returns (Response) { + option (google.api.http) = { + post: "/admin/v3/store/deposit/ignore" + body: "*" + }; + } + + rpc DepositVerify(DepositVerifyRequest) returns (Response) { + option (google.api.http) = { + get: "/admin/v3/store/deposit/verify" + body: "*" + }; + } + + rpc DepositDown(DepositItemsRequest) returns (Response) { + option (google.api.http) = { + get: "/admin/v3/store/deposit/down" + body: "*" + }; + } + + rpc DepositItems(DepositItemsRequest) returns (Response) { + option (google.api.http) = { + get: "/admin/v3/store/deposit/items" + body: "*" + }; + } + + rpc DepositIgnoreItems(DepositVerifyRequest) returns (Response) { + option (google.api.http) = { + get: "/admin/v3/store/deposit/ignore/items" + body: "*" + }; + } + rpc DepositRecover(IdRequest) returns (Response) { + option (google.api.http) = { + get: "/admin/v3/store/deposit/recover" + body: "*" + }; + } + rpc DepositBackfill(DepositBackfillRequest) returns (Response) { + option (google.api.http) = { + get: "/admin/v3/store/deposit/backfill" + body: "*" + }; + } +} \ No newline at end of file diff --git a/services/factory/.gitignore b/services/factory/.gitignore new file mode 100644 index 0000000..f5a9b48 --- /dev/null +++ b/services/factory/.gitignore @@ -0,0 +1,3 @@ +run.toml +etc/factory.yaml +tmp \ No newline at end of file diff --git a/services/factory/Dockerfile b/services/factory/Dockerfile new file mode 100644 index 0000000..0f7b8ed --- /dev/null +++ b/services/factory/Dockerfile @@ -0,0 +1,37 @@ +FROM golang:1.26.5-alpine AS builder + +WORKDIR /src + +ENV GOPROXY=https://goproxy.cn,direct \ + CGO_ENABLED=0 \ + GOOS=linux \ + GOARCH=amd64 + +COPY pkg ./pkg +COPY go.mod go.sum ./ + +RUN --mount=type=cache,target=/go/pkg/mod \ + go mod download + +COPY rpc/ ./rpc +COPY services/factory/ ./services/factory/ + +WORKDIR /src/services/factory + +RUN --mount=type=cache,target=/go/pkg/mod \ + --mount=type=cache,target=/root/.cache/go-build \ + go build -ldflags="-s -w" -o /out/main ./ + +FROM alpine:3.22 + +WORKDIR /app + +ENV TZ=Asia/Shanghai + +RUN apk add --no-cache tzdata \ + && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ + && echo "Asia/Shanghai" > /etc/timezone + +COPY --from=builder /out/main . + +CMD ["./main", "-f", "etc/factory.yaml"] diff --git a/services/factory/factory.go b/services/factory/factory.go new file mode 100644 index 0000000..37ae97e --- /dev/null +++ b/services/factory/factory.go @@ -0,0 +1,170 @@ +package main + +import ( + "flag" + "lone-services/pkg/discovery" + "lone-services/pkg/logRedis" + "lone-services/pkg/modelbase" + "lone-services/pkg/mysql" + "lone-services/pkg/redis" + "lone-services/pkg/utils" + "lone-services/pkg/validate" + factory "lone-services/rpc/factory/pb" + "net" + "os" + "strconv" + + "lone-services/services/factory/internal/config" + "lone-services/services/factory/internal/server" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/logx" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/factory.yaml", "the config file") + +func main() { + flag.Parse() + var c config.Config + conf.MustLoad(*configFile, &c) + + // Nacos配置拉取初始化 + nacosParam := utils.NacosConfig{ + Hosts: c.Nacos.Hosts, + NamespaceId: c.Nacos.NamespaceId, + Group: c.Nacos.Group, + ConfigID: c.Nacos.ConfigID, + } + utils.InitConfig(nacosParam) + + // 日志配置 + logConf := logx.LogConf{ + ServiceName: utils.GetConfigString("log.serviceName"), + Mode: utils.GetConfigString("log.mode"), + Encoding: utils.GetConfigString("log.encoding"), + Level: utils.GetConfigString("log.level"), + Path: utils.GetConfigString("log.path"), + KeepDays: utils.GetConfigInt("log.keepDays"), + MaxSize: utils.GetConfigInt("log.maxSize"), + MaxBackups: utils.GetConfigInt("log.maxBackups"), + Compress: utils.GetConfigBool("log.compress"), + } + logx.SetUp(logConf) + logx.AddWriter(logx.NewWriter(os.Stdout)) + + listenOn := utils.GetConfigString("base.listenOn") + mode := utils.GetConfigString("base.mode") + serviceName := utils.GetConfigString("base.name") + + // 初始化服务发现 + if err := discovery.Init(discovery.Config{ + Hosts: c.Nacos.Hosts, + NamespaceId: c.Nacos.NamespaceId, + Group: c.Nacos.Group, + }); err != nil { + logx.Errorf("nacos init: %v", err) + os.Exit(1) + } + + port, err := listenPort(listenOn) + if err != nil { + logx.Errorf("parse ListenOn: %v", err) + os.Exit(1) + } + + // 注册服务 + if err := discovery.Register(discovery.Instance{ + ServiceName: serviceName, + IP: c.Nacos.RegisterIP, + Port: port, + Group: c.Nacos.Group, + }); err != nil { + logx.Errorf("nacos register: %v", err) + os.Exit(1) + } + logx.Infof("服务注册成功: %s:%d", c.Nacos.RegisterIP, port) + + defer func() { + if err := discovery.Deregister(); err != nil { + logx.Errorf("nacos deregister: %v", err) + } + }() + + // 初始化MySQL + db, err := mysql.New(mysql.Config{ + Host: utils.GetConfigString("mysql.host"), + Port: utils.GetConfigInt("mysql.port"), + User: utils.GetConfigString("mysql.user"), + Password: utils.GetConfigString("mysql.password"), + Database: utils.GetConfigString("mysql.database"), + Charset: utils.GetConfigString("mysql.charset"), + Prefix: utils.GetConfigString("mysql.prefix"), + ReadHost: utils.GetConfigString("mysql_read.host"), + ReadPort: utils.GetConfigInt("mysql_read.port"), + ReadUser: utils.GetConfigString("mysql_read.user"), + ReadPassword: utils.GetConfigString("mysql_read.password"), + ReadDatabase: utils.GetConfigString("mysql_read.database"), + }) + if err != nil { + logx.Errorf("mysql init: %v", err) + os.Exit(1) + } + + // 初始化Redis + if err := redis.Init(redis.Config{ + Host: utils.GetConfigString("redis.host"), + Port: utils.GetConfigInt("redis.port"), + Password: utils.GetConfigString("redis.password"), + DB: utils.GetConfigInt("redis.db"), + }); err != nil { + logx.Errorf("redis init: %v", err) + os.Exit(1) + } + + if err := logRedis.Init(logRedis.LogRedisConfig{ + Host: utils.GetConfigString("log-redis.host"), + Port: utils.GetConfigInt("log-redis.port"), + Password: utils.GetConfigString("log-redis.password"), + DB: utils.GetConfigInt("log-redis.db"), + }); err != nil { + logx.Errorf("log redis init: %v", err) + os.Exit(1) + } + + debug := utils.GetConfigBool("mysql.debug") + modelbase.Init(db, modelbase.Config{Prefix: utils.GetConfigString("mysql.prefix"), Debug: debug}) + + // 初始化服务信息 + rpcConf := zrpc.RpcServerConf{ + ListenOn: listenOn, + } + rpcConf.Mode = mode + ctx := svc.NewServiceContext(c, db) + + s := zrpc.MustNewServer(rpcConf, func(grpcServer *grpc.Server) { + factory.RegisterFactoryServer(grpcServer, server.NewFactoryServer(ctx)) + if mode == service.DevMode || mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + s.AddUnaryInterceptors(validate.UnaryServerInterceptor(validate.MustNew())) + + logx.Infof("Starting rpc server at %s...", listenOn) + s.Start() +} + +// listenPort 拆分端口 +func listenPort(listenOn string) (uint64, error) { + _, portStr, err := net.SplitHostPort(listenOn) + if err != nil { + return utils.NumberZero, err + } + return strconv.ParseUint(portStr, utils.NumberTen, utils.NumberSixtyFourth) +} diff --git a/services/factory/factoryclient/factory.go b/services/factory/factoryclient/factory.go new file mode 100644 index 0000000..eb4def8 --- /dev/null +++ b/services/factory/factoryclient/factory.go @@ -0,0 +1,164 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.2 +// Source: factory.proto + +package factoryClient + +import ( + "context" + + "lone-services/rpc/factory/pb" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + EmptyRequest = factory.EmptyRequest + GroupCreateRequest = factory.GroupCreateRequest + GroupEditRequest = factory.GroupEditRequest + GroupItemsRequest = factory.GroupItemsRequest + GroupPasswordRequest = factory.GroupPasswordRequest + IdRequest = factory.IdRequest + LogItemsRequest = factory.LogItemsRequest + PostCreateRequest = factory.PostCreateRequest + PostEditRequest = factory.PostEditRequest + Response = factory.Response + StatusRequest = factory.StatusRequest + WorkerCreateRequest = factory.WorkerCreateRequest + WorkerEditRequest = factory.WorkerEditRequest + WorkerItemsRequest = factory.WorkerItemsRequest + + Factory interface { + GroupItems(ctx context.Context, in *GroupItemsRequest, opts ...grpc.CallOption) (*Response, error) + GroupInfo(ctx context.Context, in *IdRequest, opts ...grpc.CallOption) (*Response, error) + GroupCreate(ctx context.Context, in *GroupCreateRequest, opts ...grpc.CallOption) (*Response, error) + GroupEdit(ctx context.Context, in *GroupEditRequest, opts ...grpc.CallOption) (*Response, error) + GroupStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) + GroupNames(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*Response, error) + GroupPassword(ctx context.Context, in *GroupPasswordRequest, opts ...grpc.CallOption) (*Response, error) + PostItems(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*Response, error) + PostInfo(ctx context.Context, in *IdRequest, opts ...grpc.CallOption) (*Response, error) + PostCreate(ctx context.Context, in *PostCreateRequest, opts ...grpc.CallOption) (*Response, error) + PostEdit(ctx context.Context, in *PostEditRequest, opts ...grpc.CallOption) (*Response, error) + PostStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) + PostNames(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*Response, error) + LogItems(ctx context.Context, in *LogItemsRequest, opts ...grpc.CallOption) (*Response, error) + WorkerCreate(ctx context.Context, in *WorkerCreateRequest, opts ...grpc.CallOption) (*Response, error) + WorkerEdit(ctx context.Context, in *WorkerEditRequest, opts ...grpc.CallOption) (*Response, error) + WorkerStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) + WorkerNames(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*Response, error) + WorkerItems(ctx context.Context, in *WorkerItemsRequest, opts ...grpc.CallOption) (*Response, error) + WorkerInfo(ctx context.Context, in *IdRequest, opts ...grpc.CallOption) (*Response, error) + } + + defaultFactory struct { + cli zrpc.Client + } +) + +func NewFactory(cli zrpc.Client) Factory { + return &defaultFactory{ + cli: cli, + } +} + +func (m *defaultFactory) GroupItems(ctx context.Context, in *GroupItemsRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.GroupItems(ctx, in, opts...) +} + +func (m *defaultFactory) GroupInfo(ctx context.Context, in *IdRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.GroupInfo(ctx, in, opts...) +} + +func (m *defaultFactory) GroupCreate(ctx context.Context, in *GroupCreateRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.GroupCreate(ctx, in, opts...) +} + +func (m *defaultFactory) GroupEdit(ctx context.Context, in *GroupEditRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.GroupEdit(ctx, in, opts...) +} + +func (m *defaultFactory) GroupStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.GroupStatus(ctx, in, opts...) +} + +func (m *defaultFactory) GroupNames(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.GroupNames(ctx, in, opts...) +} + +func (m *defaultFactory) GroupPassword(ctx context.Context, in *GroupPasswordRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.GroupPassword(ctx, in, opts...) +} + +func (m *defaultFactory) PostItems(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.PostItems(ctx, in, opts...) +} + +func (m *defaultFactory) PostInfo(ctx context.Context, in *IdRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.PostInfo(ctx, in, opts...) +} + +func (m *defaultFactory) PostCreate(ctx context.Context, in *PostCreateRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.PostCreate(ctx, in, opts...) +} + +func (m *defaultFactory) PostEdit(ctx context.Context, in *PostEditRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.PostEdit(ctx, in, opts...) +} + +func (m *defaultFactory) PostStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.PostStatus(ctx, in, opts...) +} + +func (m *defaultFactory) PostNames(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.PostNames(ctx, in, opts...) +} + +func (m *defaultFactory) LogItems(ctx context.Context, in *LogItemsRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.LogItems(ctx, in, opts...) +} + +func (m *defaultFactory) WorkerCreate(ctx context.Context, in *WorkerCreateRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.WorkerCreate(ctx, in, opts...) +} + +func (m *defaultFactory) WorkerEdit(ctx context.Context, in *WorkerEditRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.WorkerEdit(ctx, in, opts...) +} + +func (m *defaultFactory) WorkerStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.WorkerStatus(ctx, in, opts...) +} + +func (m *defaultFactory) WorkerNames(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.WorkerNames(ctx, in, opts...) +} + +func (m *defaultFactory) WorkerItems(ctx context.Context, in *WorkerItemsRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.WorkerItems(ctx, in, opts...) +} + +func (m *defaultFactory) WorkerInfo(ctx context.Context, in *IdRequest, opts ...grpc.CallOption) (*Response, error) { + client := factory.NewFactoryClient(m.cli.Conn()) + return client.WorkerInfo(ctx, in, opts...) +} diff --git a/services/factory/internal/config/config.go b/services/factory/internal/config/config.go new file mode 100644 index 0000000..a1979dd --- /dev/null +++ b/services/factory/internal/config/config.go @@ -0,0 +1,13 @@ +package config + +type Config struct { + Nacos NacosConf +} + +type NacosConf struct { + Hosts []string + NamespaceId string `json:",optional"` + Group string `json:",optional"` + RegisterIP string `json:",optional"` + ConfigID string `json:",optional"` +} diff --git a/services/factory/internal/dao/group.go b/services/factory/internal/dao/group.go new file mode 100644 index 0000000..fe6646d --- /dev/null +++ b/services/factory/internal/dao/group.go @@ -0,0 +1,42 @@ +package dao + +type GroupCreate struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Name string `gorm:"column:name;type:char(30);comment:组名;NOT NULL" json:"name"` + Account string `gorm:"column:account;type:varchar(100);comment:账号;NOT NULL" json:"account"` + Password string `gorm:"column:password;type:varchar(255);comment:密码" json:"password"` + Status int32 `gorm:"column:status;type:tinyint(1);default:1;comment:状态;NOT NULL" json:"status"` + Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type GroupStatus struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Status int32 `gorm:"column:status;type:tinyint(1);default:1;comment:状态;NOT NULL" json:"status"` + Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type GroupInfo struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Name string `gorm:"column:name;type:char(30);comment:组名;NOT NULL" json:"name"` + Account string `gorm:"column:account;type:varchar(100);comment:账号;NOT NULL" json:"account"` + Status int32 `gorm:"column:status;type:tinyint(1);default:1;comment:状态;NOT NULL" json:"status"` + Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type GroupPassword struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Password string `gorm:"column:password;type:varchar(255);comment:密码" json:"password"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type GroupName struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Name string `gorm:"column:name;type:char(30);comment:组名;NOT NULL" json:"name"` +} diff --git a/services/factory/internal/dao/log.go b/services/factory/internal/dao/log.go new file mode 100644 index 0000000..f673920 --- /dev/null +++ b/services/factory/internal/dao/log.go @@ -0,0 +1,23 @@ +package dao + +type LogInfo struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Content string `gorm:"column:content;type:text;comment:内容;NOT NULL" json:"content"` + ObjId int64 `gorm:"column:obj_id;type:int(11);comment:对象ID;NOT NULL" json:"obj_id"` + ObjType int32 `gorm:"column:obj_type;type:tinyint(1);comment:对象类型,1为职位,2为组,3为工人,4请假;NOT NULL" json:"obj_type"` + Type int32 `gorm:"column:type;type:tinyint(1);default:1;comment:类型,1为登录,2为登出,3修改,4为添加,5状态;NOT NULL" json:"type"` + IsStatistics string `gorm:"column:is_statistics;type:enum('1','2');default:2;comment:是否统计过,1为统计过,2为未统计" json:"is_statistics"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type LogCreate struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Content string `gorm:"column:content;type:text;comment:内容;NOT NULL" json:"content"` + ObjId int64 `gorm:"column:obj_id;type:int(11);comment:对象ID;NOT NULL" json:"obj_id"` + ObjType int32 `gorm:"column:obj_type;type:tinyint(1);comment:对象类型,1为职位,2为组,3为工人,4请假;NOT NULL" json:"obj_type"` + Type int32 `gorm:"column:type;type:tinyint(1);default:1;comment:类型,1为登录,2为登出,3修改,4为添加,5状态;NOT NULL" json:"type"` + IsStatistics string `gorm:"column:is_statistics;type:enum('1','2');default:2;comment:是否统计过,1为统计过,2为未统计" json:"is_statistics"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} diff --git a/services/factory/internal/dao/post.go b/services/factory/internal/dao/post.go new file mode 100644 index 0000000..b02f1e2 --- /dev/null +++ b/services/factory/internal/dao/post.go @@ -0,0 +1,32 @@ +package dao + +type PostCreate struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Name string `gorm:"column:name;type:char(30);comment:姓名;NOT NULL" json:"name"` + Status int32 `gorm:"column:status;type:tinyint(1);default:1;comment:状态,1为正常,2为禁用,默认1;NOT NULL" json:"status"` + Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type PostStatus struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Status int32 `gorm:"column:status;type:tinyint(1);default:1;comment:状态,1为正常,2为禁用,默认1;NOT NULL" json:"status"` + Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type PostInfo struct { + Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Name string `gorm:"column:name;type:char(30);comment:姓名;NOT NULL" json:"name"` + Status uint8 `gorm:"column:status;type:tinyint(1);default:1;comment:状态,1为正常,2为禁用,默认1;NOT NULL" json:"status"` + Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"` + AdminId int `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type PostName struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Name string `gorm:"column:name;type:char(30);comment:姓名;NOT NULL" json:"name"` +} diff --git a/services/factory/internal/dao/worker.go b/services/factory/internal/dao/worker.go new file mode 100644 index 0000000..031115c --- /dev/null +++ b/services/factory/internal/dao/worker.go @@ -0,0 +1,40 @@ +package dao + +type WorkerCreate struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Name string `gorm:"column:name;type:char(30);comment:姓名;NOT NULL" json:"name"` + Mobile string `gorm:"column:mobile;type:char(12);comment:手机号" json:"mobile"` + GroupId int64 `gorm:"column:group_id;type:int(11);default:0;comment:小组ID" json:"group_id"` + PostId int64 `gorm:"column:post_id;type:int(11);default:0;comment:岗位ID" json:"post_id"` + Status int32 `gorm:"column:status;type:tinyint(1);default:1;comment:状态;NOT NULL" json:"status"` + Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type WorkerStatus struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Status int32 `gorm:"column:status;type:tinyint(1);default:1;comment:状态;NOT NULL" json:"status"` + Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type WorkerInfo struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Name string `gorm:"column:name;type:char(30);comment:姓名;NOT NULL" json:"name"` + Mobile string `gorm:"column:mobile;type:char(12);comment:手机号" json:"mobile"` + GroupId int64 `gorm:"column:group_id;type:int(11);default:0;comment:小组ID" json:"group_id"` + GroupName string `gorm:"-" json:"group_name"` + PostId int64 `gorm:"column:post_id;type:int(11);default:0;comment:岗位ID" json:"post_id"` + PostName string `gorm:"-" json:"post_name"` + Status int32 `gorm:"column:status;type:tinyint(1);default:1;comment:状态;NOT NULL" json:"status"` + Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"` + AdminId int64 `gorm:"column:admin_id;type:int(11);default:0" json:"admin_id"` + AdminName string `gorm:"column:admin_name;type:varchar(50)" json:"admin_name"` +} + +type WorkerName struct { + Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Name string `gorm:"column:name;type:char(30);comment:姓名;NOT NULL" json:"name"` +} diff --git a/services/factory/internal/logic/base.go b/services/factory/internal/logic/base.go new file mode 100644 index 0000000..39e4a25 --- /dev/null +++ b/services/factory/internal/logic/base.go @@ -0,0 +1,48 @@ +package logic + +import ( + "lone-services/pkg/utils" + "lone-services/pkg/validate" + factory "lone-services/rpc/factory/pb" + "reflect" + + jsoniter "github.com/json-iterator/go" +) + +type BaseLogic struct { +} + +func (l *BaseLogic) checkParams(in interface{}, v validate.IValidator) *factory.Response { + rv := reflect.ValueOf(in) + if rv.Kind() != reflect.Ptr || rv.IsNil() { + return &factory.Response{ + Code: utils.ErrorParams.Code, + Msg: "request must be non‑nil proto pointer", + } + } + + resp := validate.ValidateFromProto(in, v) + if resp != utils.StringEmpty { + return &factory.Response{ + Code: utils.ErrorParams.Code, + Msg: resp, + } + } + return nil +} + +func (l *BaseLogic) fail(status utils.Status) (*factory.Response, error) { + return l.out(status, status.Msg) +} +func (l *BaseLogic) out(status utils.Status, msg string) (*factory.Response, error) { + return &factory.Response{Code: status.Code, Msg: msg}, nil +} + +func (l *BaseLogic) outData(status utils.Status, msg, data string) (*factory.Response, error) { + return &factory.Response{Code: status.Code, Msg: msg, Data: data}, nil +} + +func (l *BaseLogic) ok(data any) (*factory.Response, error) { + buf, _ := jsoniter.Marshal(data) + return &factory.Response{Code: utils.Ok.Code, Msg: utils.Ok.Msg, Data: string(buf)}, nil +} diff --git a/services/factory/internal/logic/groupCreateLogic.go b/services/factory/internal/logic/groupCreateLogic.go new file mode 100644 index 0000000..5faf137 --- /dev/null +++ b/services/factory/internal/logic/groupCreateLogic.go @@ -0,0 +1,67 @@ +package logic + +import ( + "context" + "lone-services/pkg/utils" + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "lone-services/services/factory/internal/svc" + "lone-services/services/factory/validator" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GroupCreateLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewGroupCreateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupCreateLogic { + return &GroupCreateLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GroupCreateLogic) GroupCreate(in *factory.GroupCreateRequest) (*factory.Response, error) { + var v validator.GroupCreateValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + + var info dao.GroupCreate + + pwd, err := utils.EncryptPassword(in.Password) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorEncryptAesError) + } + info.AdminId = adminInfo.ID + info.AdminName = adminInfo.Name + info.Name = in.Name + info.Account = in.Account + info.Password = pwd + + err = model.GroupModel{}.Init().Create(&info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + + action := utils.ActionAdd{ + NewContent: info, + Type: utils.LogActionTypeAdd, + ModuleName: utils.LogActionModuleFactoryGroup, + } + utils.SetActionLog(adminInfo, action) + + return l.ok(info.Id) +} diff --git a/services/factory/internal/logic/groupEditLogic.go b/services/factory/internal/logic/groupEditLogic.go new file mode 100644 index 0000000..e0a963a --- /dev/null +++ b/services/factory/internal/logic/groupEditLogic.go @@ -0,0 +1,84 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "lone-services/services/factory/validator" + "strconv" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GroupEditLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewGroupEditLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupEditLogic { + return &GroupEditLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GroupEditLogic) GroupEdit(in *factory.GroupEditRequest) (*factory.Response, error) { + var v validator.GroupEditValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + + var info dao.GroupCreate + w := modelbase.Params{Eq: map[string]string{"id": strconv.Itoa(int(in.Id))}} + err := model.GroupModel{}.Init().GetOne(w, &info) + if err != nil { + return l.fail(utils.ErrorNotFund) + } + if info.Id < utils.NumberOne { + return l.fail(utils.ErrorNotFund) + } + action := utils.ActionAdd{ + OldContent: info, + Type: utils.LogActionTypeEdit, + ModuleName: utils.LogActionModuleFactoryGroup, + } + + info.AdminId = adminInfo.ID + info.AdminName = adminInfo.Name + info.Name = in.Name + info.Account = in.Account + + if len(in.Password) > utils.NumberZero { + pwd, err := utils.EncryptPassword(in.Password) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorEncryptAesError) + } + info.Password = pwd + } + + row, err := model.GroupModel{}.Init().Edit(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + + if row > utils.NumberZero { + action.NewContent = info + utils.SetActionLog(adminInfo, action) + } + + return l.ok(info.Id) +} diff --git a/services/factory/internal/logic/groupInfoLogic.go b/services/factory/internal/logic/groupInfoLogic.go new file mode 100644 index 0000000..b362432 --- /dev/null +++ b/services/factory/internal/logic/groupInfoLogic.go @@ -0,0 +1,52 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/pkg/validate" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "strconv" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GroupInfoLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewGroupInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupInfoLogic { + return &GroupInfoLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GroupInfoLogic) GroupInfo(in *factory.IdRequest) (*factory.Response, error) { + var v validate.InfoValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + + var info dao.GroupInfo + modelObj := model.GroupModel{}.Init() + w := modelbase.Params{Eq: map[string]string{"id": strconv.Itoa(int(in.Id))}} + err := modelObj.GetOne(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorNotFund) + } + + if info.Id < utils.NumberOne { + return l.fail(utils.ErrorNotFund) + } + return l.ok(info) +} diff --git a/services/factory/internal/logic/groupItemsLogic.go b/services/factory/internal/logic/groupItemsLogic.go new file mode 100644 index 0000000..aabc9f9 --- /dev/null +++ b/services/factory/internal/logic/groupItemsLogic.go @@ -0,0 +1,66 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "lone-services/services/factory/internal/svc" + "lone-services/services/sale/validator" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GroupItemsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewGroupItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupItemsLogic { + return &GroupItemsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GroupItemsLogic) GroupItems(in *factory.GroupItemsRequest) (*factory.Response, error) { + var v validator.GroupItemsValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var info []dao.GroupInfo + w := modelbase.Params{ + Page: int(in.Page), + Size: int(in.Size), + Order: "id desc", + } + + w.Like = make(map[string]string) + w.Other = make(map[string]string) + w.Eq = make(map[string]string) + + if len(in.Name) > utils.NumberZero { + w.Like["name LIKE ? "] = "%%" + in.Name + "%%" + } + + if in.Status > utils.NumberZero { + w.Eq["status"] = string(in.Status) + } + + items, err := model.GroupModel{}.Init().Page(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorNotFund) + } + + return l.ok(items) +} diff --git a/services/factory/internal/logic/groupNamesLogic.go b/services/factory/internal/logic/groupNamesLogic.go new file mode 100644 index 0000000..08e6f7c --- /dev/null +++ b/services/factory/internal/logic/groupNamesLogic.go @@ -0,0 +1,40 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GroupNamesLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewGroupNamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupNamesLogic { + return &GroupNamesLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GroupNamesLogic) GroupNames(in *factory.EmptyRequest) (*factory.Response, error) { + w := modelbase.Params{Eq: map[string]string{"id": utils.StringStatusOk}} + var names []dao.GroupName + err := model.GroupModel{}.Init().Items(w, &names) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorNotFund) + } + + return l.ok(names) +} diff --git a/services/factory/internal/logic/groupPasswordLogic.go b/services/factory/internal/logic/groupPasswordLogic.go new file mode 100644 index 0000000..48e15e0 --- /dev/null +++ b/services/factory/internal/logic/groupPasswordLogic.go @@ -0,0 +1,75 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "lone-services/services/factory/validator" + "strconv" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GroupPasswordLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewGroupPasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupPasswordLogic { + return &GroupPasswordLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GroupPasswordLogic) GroupPassword(in *factory.GroupPasswordRequest) (*factory.Response, error) { + var v validator.GroupPasswordValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var action = utils.ActionAdd{} + var info dao.GroupPassword + w := modelbase.Params{Eq: map[string]string{"id": strconv.Itoa(int(in.Id))}} + modelObj := model.GroupModel{}.Init() + err := modelObj.GetOne(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + if info.Id < utils.NumberOne { + return l.fail(utils.ErrorNotFund) + } + action.OldContent = info + pwd, err := utils.EncryptPassword(in.Password) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorEncryptAesError) + } + info.Password = pwd + info.AdminName = adminInfo.Name + info.AdminId = adminInfo.ID + row, editErr := modelObj.Edit(w, info) + if editErr != nil { + l.Logger.Error(editErr) + return l.fail(utils.Fail) + } + if row > utils.NumberZero { + action.NewContent = info + action.Type = utils.LogActionTypePassword + action.ModuleName = utils.LogActionModuleFactoryGroup + utils.SetActionLog(adminInfo, action) + } + return l.ok(utils.NumberOne) +} diff --git a/services/factory/internal/logic/groupStatusLogic.go b/services/factory/internal/logic/groupStatusLogic.go new file mode 100644 index 0000000..e6d30da --- /dev/null +++ b/services/factory/internal/logic/groupStatusLogic.go @@ -0,0 +1,72 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/pkg/validate" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "strconv" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GroupStatusLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewGroupStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupStatusLogic { + return &GroupStatusLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GroupStatusLogic) GroupStatus(in *factory.StatusRequest) (*factory.Response, error) { + var v validate.StatusValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var action = utils.ActionAdd{} + var info dao.GroupStatus + w := modelbase.Params{Eq: map[string]string{"id": strconv.Itoa(int(in.Id))}} + modelObj := model.GroupModel{}.Init() + err := modelObj.GetOne(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + if info.Id < utils.NumberOne { + return l.fail(utils.ErrorNotFund) + } + action.OldContent = info + info.Status = in.Status + info.Reason = in.Reason + info.AdminName = adminInfo.Name + info.AdminId = adminInfo.ID + row, editErr := modelObj.Edit(w, info) + if editErr != nil { + l.Logger.Error(editErr) + return l.fail(utils.Fail) + } + if row > utils.NumberZero { + action.NewContent = info + action.Reason = in.Reason + action.Type = utils.LogActionTypeStatus + action.ModuleName = utils.LogActionModuleFactoryGroup + utils.SetActionLog(adminInfo, action) + } + return l.ok(utils.NumberOne) +} diff --git a/services/factory/internal/logic/logItemsLogic.go b/services/factory/internal/logic/logItemsLogic.go new file mode 100644 index 0000000..eced952 --- /dev/null +++ b/services/factory/internal/logic/logItemsLogic.go @@ -0,0 +1,70 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "lone-services/services/factory/internal/svc" + "lone-services/services/factory/validator" + + "github.com/zeromicro/go-zero/core/logx" +) + +type LogItemsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewLogItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LogItemsLogic { + return &LogItemsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *LogItemsLogic) LogItems(in *factory.LogItemsRequest) (*factory.Response, error) { + var v validator.LogItemsValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var info []dao.GroupInfo + w := modelbase.Params{ + Page: int(in.Page), + Size: int(in.Size), + Order: "id desc", + } + //TODO + + w.Like = make(map[string]string) + w.Other = make(map[string]string) + w.Eq = make(map[string]string) + + if in.Type > utils.NumberZero { + w.Eq["type"] = string(in.Type) + } + if in.ObjType > utils.NumberZero { + w.Eq["obj_type"] = string(in.ObjType) + } + if len(in.Time) > utils.NumberZero { + w.Other["create_time > ?"] = in.Time[utils.NumberZero] + w.Other["create_time < ?"] = in.Time[utils.NumberOne] + } + + items, err := model.LogModel{}.Init().Page(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorNotFund) + } + + return l.ok(items) +} diff --git a/services/factory/internal/logic/postCreateLogic.go b/services/factory/internal/logic/postCreateLogic.go new file mode 100644 index 0000000..b741751 --- /dev/null +++ b/services/factory/internal/logic/postCreateLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type PostCreateLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewPostCreateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PostCreateLogic { + return &PostCreateLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *PostCreateLogic) PostCreate(in *factory.PostCreateRequest) (*factory.Response, error) { + // todo: add your logic here and delete this line + + return &factory.Response{}, nil +} diff --git a/services/factory/internal/logic/postEditLogic.go b/services/factory/internal/logic/postEditLogic.go new file mode 100644 index 0000000..6f64014 --- /dev/null +++ b/services/factory/internal/logic/postEditLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type PostEditLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewPostEditLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PostEditLogic { + return &PostEditLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *PostEditLogic) PostEdit(in *factory.PostEditRequest) (*factory.Response, error) { + // todo: add your logic here and delete this line + + return &factory.Response{}, nil +} diff --git a/services/factory/internal/logic/postInfoLogic.go b/services/factory/internal/logic/postInfoLogic.go new file mode 100644 index 0000000..0a2b6ab --- /dev/null +++ b/services/factory/internal/logic/postInfoLogic.go @@ -0,0 +1,52 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/pkg/validate" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "strconv" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type PostInfoLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewPostInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PostInfoLogic { + return &PostInfoLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *PostInfoLogic) PostInfo(in *factory.IdRequest) (*factory.Response, error) { + var v validate.InfoValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + + var info dao.PostInfo + modelObj := model.PostModel{}.Init() + w := modelbase.Params{Eq: map[string]string{"id": strconv.Itoa(int(in.Id))}} + err := modelObj.GetOne(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorNotFund) + } + + if info.Id < utils.NumberOne { + return l.fail(utils.ErrorNotFund) + } + return l.ok(info) +} diff --git a/services/factory/internal/logic/postItemsLogic.go b/services/factory/internal/logic/postItemsLogic.go new file mode 100644 index 0000000..86dbcec --- /dev/null +++ b/services/factory/internal/logic/postItemsLogic.go @@ -0,0 +1,47 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type PostItemsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewPostItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PostItemsLogic { + return &PostItemsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *PostItemsLogic) PostItems(in *factory.EmptyRequest) (*factory.Response, error) { + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var info []dao.PostInfo + w := modelbase.Params{ + Order: "id desc", + } + + err := model.PostModel{}.Init().Items(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorNotFund) + } + + return l.ok(info) +} diff --git a/services/factory/internal/logic/postNamesLogic.go b/services/factory/internal/logic/postNamesLogic.go new file mode 100644 index 0000000..9eacf0a --- /dev/null +++ b/services/factory/internal/logic/postNamesLogic.go @@ -0,0 +1,41 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type PostNamesLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewPostNamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PostNamesLogic { + return &PostNamesLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *PostNamesLogic) PostNames(in *factory.EmptyRequest) (*factory.Response, error) { + w := modelbase.Params{Eq: map[string]string{"status": utils.StringStatusOk}} + var names []dao.PostName + err := model.PostModel{}.Init().Items(w, &names) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorNotFund) + } + + return l.ok(names) +} diff --git a/services/factory/internal/logic/postStatusLogic.go b/services/factory/internal/logic/postStatusLogic.go new file mode 100644 index 0000000..09edee8 --- /dev/null +++ b/services/factory/internal/logic/postStatusLogic.go @@ -0,0 +1,72 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/pkg/validate" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "strconv" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type PostStatusLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewPostStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PostStatusLogic { + return &PostStatusLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *PostStatusLogic) PostStatus(in *factory.StatusRequest) (*factory.Response, error) { + var v validate.StatusValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var action = utils.ActionAdd{} + var info dao.PostStatus + w := modelbase.Params{Eq: map[string]string{"id": strconv.Itoa(int(in.Id))}} + modelObj := model.PostModel{}.Init() + err := modelObj.GetOne(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + if info.Id < utils.NumberOne { + return l.fail(utils.ErrorNotFund) + } + action.OldContent = info + info.Status = in.Status + info.Reason = in.Reason + info.AdminName = adminInfo.Name + info.AdminId = adminInfo.ID + row, editErr := modelObj.Edit(w, info) + if editErr != nil { + l.Logger.Error(editErr) + return l.fail(utils.Fail) + } + if row > utils.NumberZero { + action.NewContent = info + action.Reason = in.Reason + action.Type = utils.LogActionTypeStatus + action.ModuleName = utils.LogActionModuleFactoryPost + utils.SetActionLog(adminInfo, action) + } + return l.ok(utils.NumberOne) +} diff --git a/services/factory/internal/logic/workerCreateLogic.go b/services/factory/internal/logic/workerCreateLogic.go new file mode 100644 index 0000000..b175648 --- /dev/null +++ b/services/factory/internal/logic/workerCreateLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type WorkerCreateLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewWorkerCreateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkerCreateLogic { + return &WorkerCreateLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *WorkerCreateLogic) WorkerCreate(in *factory.WorkerCreateRequest) (*factory.Response, error) { + // todo: add your logic here and delete this line + + return &factory.Response{}, nil +} diff --git a/services/factory/internal/logic/workerEditLogic.go b/services/factory/internal/logic/workerEditLogic.go new file mode 100644 index 0000000..ccdc3e1 --- /dev/null +++ b/services/factory/internal/logic/workerEditLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type WorkerEditLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewWorkerEditLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkerEditLogic { + return &WorkerEditLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *WorkerEditLogic) WorkerEdit(in *factory.WorkerEditRequest) (*factory.Response, error) { + // todo: add your logic here and delete this line + + return &factory.Response{}, nil +} diff --git a/services/factory/internal/logic/workerInfoLogic.go b/services/factory/internal/logic/workerInfoLogic.go new file mode 100644 index 0000000..9887e7c --- /dev/null +++ b/services/factory/internal/logic/workerInfoLogic.go @@ -0,0 +1,52 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/pkg/validate" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "strconv" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type WorkerInfoLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewWorkerInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkerInfoLogic { + return &WorkerInfoLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *WorkerInfoLogic) WorkerInfo(in *factory.IdRequest) (*factory.Response, error) { + var v validate.InfoValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + + var info dao.WorkerInfo + modelObj := model.WorkerModel{}.Init() + w := modelbase.Params{Eq: map[string]string{"id": strconv.Itoa(int(in.Id))}} + err := modelObj.GetOne(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorNotFund) + } + + if info.Id < utils.NumberOne { + return l.fail(utils.ErrorNotFund) + } + return l.ok(info) +} diff --git a/services/factory/internal/logic/workerItemsLogic.go b/services/factory/internal/logic/workerItemsLogic.go new file mode 100644 index 0000000..c7d6a55 --- /dev/null +++ b/services/factory/internal/logic/workerItemsLogic.go @@ -0,0 +1,63 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "lone-services/services/factory/validator" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type WorkerItemsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewWorkerItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkerItemsLogic { + return &WorkerItemsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *WorkerItemsLogic) WorkerItems(in *factory.WorkerItemsRequest) (*factory.Response, error) { + var v validator.WorkerItemsValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var info []dao.WorkerInfo + w := modelbase.Params{ + Page: int(in.Page), + Size: int(in.Size), + Order: "id desc", + } + + w.Like = make(map[string]string) + w.Other = make(map[string]string) + w.Eq = make(map[string]string) + + if len(in.Name) > utils.NumberZero { + w.Like["name LIKE ? "] = "%%" + in.Name + "%%" + } + + items, err := model.WorkerModel{}.Init().Page(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorNotFund) + } + + return l.ok(items) +} diff --git a/services/factory/internal/logic/workerNamesLogic.go b/services/factory/internal/logic/workerNamesLogic.go new file mode 100644 index 0000000..34082a9 --- /dev/null +++ b/services/factory/internal/logic/workerNamesLogic.go @@ -0,0 +1,41 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type WorkerNamesLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewWorkerNamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkerNamesLogic { + return &WorkerNamesLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *WorkerNamesLogic) WorkerNames(in *factory.EmptyRequest) (*factory.Response, error) { + w := modelbase.Params{Eq: map[string]string{"status": utils.StringStatusOk}} + var names []dao.WorkerName + err := model.WorkerModel{}.Init().Items(w, &names) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.ErrorNotFund) + } + + return l.ok(names) +} diff --git a/services/factory/internal/logic/workerStatusLogic.go b/services/factory/internal/logic/workerStatusLogic.go new file mode 100644 index 0000000..c8f322c --- /dev/null +++ b/services/factory/internal/logic/workerStatusLogic.go @@ -0,0 +1,72 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/pkg/validate" + "lone-services/services/factory/internal/dao" + "lone-services/services/factory/internal/model" + "strconv" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type WorkerStatusLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewWorkerStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkerStatusLogic { + return &WorkerStatusLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *WorkerStatusLogic) WorkerStatus(in *factory.StatusRequest) (*factory.Response, error) { + var v validate.StatusValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var action = utils.ActionAdd{} + var info dao.WorkerStatus + w := modelbase.Params{Eq: map[string]string{"id": strconv.Itoa(int(in.Id))}} + modelObj := model.WorkerModel{}.Init() + err := modelObj.GetOne(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + if info.Id < utils.NumberOne { + return l.fail(utils.ErrorNotFund) + } + action.OldContent = info + info.Status = in.Status + info.Reason = in.Reason + info.AdminName = adminInfo.Name + info.AdminId = adminInfo.ID + row, editErr := modelObj.Edit(w, info) + if editErr != nil { + l.Logger.Error(editErr) + return l.fail(utils.Fail) + } + if row > utils.NumberZero { + action.NewContent = info + action.Reason = in.Reason + action.Type = utils.LogActionTypeStatus + action.ModuleName = utils.LogActionModuleFactoryWorker + utils.SetActionLog(adminInfo, action) + } + return l.ok(utils.NumberOne) +} diff --git a/services/factory/internal/model/group.go b/services/factory/internal/model/group.go new file mode 100644 index 0000000..0e33db3 --- /dev/null +++ b/services/factory/internal/model/group.go @@ -0,0 +1,23 @@ +package model + +import ( + "lone-services/pkg/modelbase" + "lone-services/services/factory/internal/dao" +) + +type GroupModel struct { + modelbase.Base +} + +func (m GroupModel) TableName() string { + return modelbase.Prefix() + "group" +} + +func (m GroupModel) Init() GroupModel { + m.Table = m.TableName() + return m +} + +func (m GroupModel) Create(data *dao.GroupCreate) error { + return m.Base.Create(data) +} diff --git a/services/factory/internal/model/log.go b/services/factory/internal/model/log.go new file mode 100644 index 0000000..72d5b8a --- /dev/null +++ b/services/factory/internal/model/log.go @@ -0,0 +1,23 @@ +package model + +import ( + "lone-services/pkg/modelbase" + "lone-services/services/factory/internal/dao" +) + +type LogModel struct { + modelbase.Base +} + +func (m LogModel) TableName() string { + return modelbase.Prefix() + "log" +} + +func (m LogModel) Init() LogModel { + m.Table = m.TableName() + return m +} + +func (m LogModel) Create(data *dao.LogCreate) error { + return m.Base.Create(data) +} diff --git a/services/factory/internal/model/post.go b/services/factory/internal/model/post.go new file mode 100644 index 0000000..7761e56 --- /dev/null +++ b/services/factory/internal/model/post.go @@ -0,0 +1,23 @@ +package model + +import ( + "lone-services/pkg/modelbase" + "lone-services/services/factory/internal/dao" +) + +type PostModel struct { + modelbase.Base +} + +func (m PostModel) TableName() string { + return modelbase.Prefix() + "post" +} + +func (m PostModel) Init() PostModel { + m.Table = m.TableName() + return m +} + +func (m PostModel) Create(data *dao.PostCreate) error { + return m.Base.Create(data) +} diff --git a/services/factory/internal/model/worker.go b/services/factory/internal/model/worker.go new file mode 100644 index 0000000..984d953 --- /dev/null +++ b/services/factory/internal/model/worker.go @@ -0,0 +1,23 @@ +package model + +import ( + "lone-services/pkg/modelbase" + "lone-services/services/factory/internal/dao" +) + +type WorkerModel struct { + modelbase.Base +} + +func (m WorkerModel) TableName() string { + return modelbase.Prefix() + "worker" +} + +func (m WorkerModel) Init() WorkerModel { + m.Table = m.TableName() + return m +} + +func (m WorkerModel) Create(data *dao.WorkerCreate) error { + return m.Base.Create(data) +} diff --git a/services/factory/internal/server/factoryServer.go b/services/factory/internal/server/factoryServer.go new file mode 100644 index 0000000..66d04b2 --- /dev/null +++ b/services/factory/internal/server/factoryServer.go @@ -0,0 +1,124 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.2 +// Source: factory.proto + +package server + +import ( + "context" + + "lone-services/rpc/factory/pb" + "lone-services/services/factory/internal/logic" + "lone-services/services/factory/internal/svc" +) + +type FactoryServer struct { + svcCtx *svc.ServiceContext + factory.UnimplementedFactoryServer +} + +func NewFactoryServer(svcCtx *svc.ServiceContext) *FactoryServer { + return &FactoryServer{ + svcCtx: svcCtx, + } +} + +func (s *FactoryServer) GroupItems(ctx context.Context, in *factory.GroupItemsRequest) (*factory.Response, error) { + l := logic.NewGroupItemsLogic(ctx, s.svcCtx) + return l.GroupItems(in) +} + +func (s *FactoryServer) GroupInfo(ctx context.Context, in *factory.IdRequest) (*factory.Response, error) { + l := logic.NewGroupInfoLogic(ctx, s.svcCtx) + return l.GroupInfo(in) +} + +func (s *FactoryServer) GroupCreate(ctx context.Context, in *factory.GroupCreateRequest) (*factory.Response, error) { + l := logic.NewGroupCreateLogic(ctx, s.svcCtx) + return l.GroupCreate(in) +} + +func (s *FactoryServer) GroupEdit(ctx context.Context, in *factory.GroupEditRequest) (*factory.Response, error) { + l := logic.NewGroupEditLogic(ctx, s.svcCtx) + return l.GroupEdit(in) +} + +func (s *FactoryServer) GroupStatus(ctx context.Context, in *factory.StatusRequest) (*factory.Response, error) { + l := logic.NewGroupStatusLogic(ctx, s.svcCtx) + return l.GroupStatus(in) +} + +func (s *FactoryServer) GroupNames(ctx context.Context, in *factory.EmptyRequest) (*factory.Response, error) { + l := logic.NewGroupNamesLogic(ctx, s.svcCtx) + return l.GroupNames(in) +} + +func (s *FactoryServer) GroupPassword(ctx context.Context, in *factory.GroupPasswordRequest) (*factory.Response, error) { + l := logic.NewGroupPasswordLogic(ctx, s.svcCtx) + return l.GroupPassword(in) +} + +func (s *FactoryServer) PostItems(ctx context.Context, in *factory.EmptyRequest) (*factory.Response, error) { + l := logic.NewPostItemsLogic(ctx, s.svcCtx) + return l.PostItems(in) +} + +func (s *FactoryServer) PostInfo(ctx context.Context, in *factory.IdRequest) (*factory.Response, error) { + l := logic.NewPostInfoLogic(ctx, s.svcCtx) + return l.PostInfo(in) +} + +func (s *FactoryServer) PostCreate(ctx context.Context, in *factory.PostCreateRequest) (*factory.Response, error) { + l := logic.NewPostCreateLogic(ctx, s.svcCtx) + return l.PostCreate(in) +} + +func (s *FactoryServer) PostEdit(ctx context.Context, in *factory.PostEditRequest) (*factory.Response, error) { + l := logic.NewPostEditLogic(ctx, s.svcCtx) + return l.PostEdit(in) +} + +func (s *FactoryServer) PostStatus(ctx context.Context, in *factory.StatusRequest) (*factory.Response, error) { + l := logic.NewPostStatusLogic(ctx, s.svcCtx) + return l.PostStatus(in) +} + +func (s *FactoryServer) PostNames(ctx context.Context, in *factory.EmptyRequest) (*factory.Response, error) { + l := logic.NewPostNamesLogic(ctx, s.svcCtx) + return l.PostNames(in) +} + +func (s *FactoryServer) LogItems(ctx context.Context, in *factory.LogItemsRequest) (*factory.Response, error) { + l := logic.NewLogItemsLogic(ctx, s.svcCtx) + return l.LogItems(in) +} + +func (s *FactoryServer) WorkerCreate(ctx context.Context, in *factory.WorkerCreateRequest) (*factory.Response, error) { + l := logic.NewWorkerCreateLogic(ctx, s.svcCtx) + return l.WorkerCreate(in) +} + +func (s *FactoryServer) WorkerEdit(ctx context.Context, in *factory.WorkerEditRequest) (*factory.Response, error) { + l := logic.NewWorkerEditLogic(ctx, s.svcCtx) + return l.WorkerEdit(in) +} + +func (s *FactoryServer) WorkerStatus(ctx context.Context, in *factory.StatusRequest) (*factory.Response, error) { + l := logic.NewWorkerStatusLogic(ctx, s.svcCtx) + return l.WorkerStatus(in) +} + +func (s *FactoryServer) WorkerNames(ctx context.Context, in *factory.EmptyRequest) (*factory.Response, error) { + l := logic.NewWorkerNamesLogic(ctx, s.svcCtx) + return l.WorkerNames(in) +} + +func (s *FactoryServer) WorkerItems(ctx context.Context, in *factory.WorkerItemsRequest) (*factory.Response, error) { + l := logic.NewWorkerItemsLogic(ctx, s.svcCtx) + return l.WorkerItems(in) +} + +func (s *FactoryServer) WorkerInfo(ctx context.Context, in *factory.IdRequest) (*factory.Response, error) { + l := logic.NewWorkerInfoLogic(ctx, s.svcCtx) + return l.WorkerInfo(in) +} diff --git a/services/factory/internal/svc/servicecontext.go b/services/factory/internal/svc/servicecontext.go new file mode 100644 index 0000000..d167715 --- /dev/null +++ b/services/factory/internal/svc/servicecontext.go @@ -0,0 +1,22 @@ +package svc + +import ( + "lone-services/pkg/utils" + "lone-services/services/factory/internal/config" + + "gorm.io/gorm" +) + +type ServiceContext struct { + Config config.Config + DB *gorm.DB + Prefix string +} + +func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext { + return &ServiceContext{ + Config: c, + DB: db, + Prefix: utils.GetConfigString("mysql.prefix"), + } +} diff --git a/services/factory/validator/group.go b/services/factory/validator/group.go new file mode 100644 index 0000000..a588d0e --- /dev/null +++ b/services/factory/validator/group.go @@ -0,0 +1,49 @@ +package validator + +import "lone-services/pkg/validate" + +type GroupEditValidator struct { + Id int64 `form:"id" json:"id" validate:"required"` + Name string `form:"name" json:"name" validate:"required"` + Account string `form:"account" json:"account" validate:"required"` + Password string `form:"password" json:"password"` +} +type GroupPasswordValidator struct { + Id int64 `form:"id" json:"id" validate:"required"` + Password string `form:"password" json:"password" validate:"required"` +} + +func (p GroupEditValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{ + validate.FieldId: validate.FieldIdValue, + "Name.required": "小组名称不能为空", + "Account.required": "账号不能为空", + } +} + +type GroupCreateValidator struct { + Name string `form:"name" json:"name" validate:"required"` + Account string `form:"account" json:"account" validate:"required"` + Password string `form:"password" json:"password" validate:"required"` +} + +func (p GroupCreateValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{ + "Name.required": "小组名称不能为空", + "Account.required": "账号不能为空", + } +} + +func (p GroupPasswordValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{ + validate.FieldId: validate.FieldIdValue, + "Password.required": "密码不能为空", + } +} + +type GroupItemsValidator struct { + Page int32 `form:"page" json:"page"` + Size int32 `form:"size" json:"size"` + Name string `form:"name" json:"name"` + Status int32 `form:"status" json:"status"` +} diff --git a/services/factory/validator/log.go b/services/factory/validator/log.go new file mode 100644 index 0000000..eaf00d2 --- /dev/null +++ b/services/factory/validator/log.go @@ -0,0 +1,15 @@ +package validator + +import "lone-services/pkg/validate" + +type LogItemsValidator struct { + Page int32 `form:"page" json:"page"` + Size int32 `form:"size" json:"size"` + Type int32 `form:"type" json:"type"` + ObjType int32 `form:"obj_type" json:"obj_type"` + Time []string `form:"time" json:"time"` +} + +func (p LogItemsValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{} +} diff --git a/services/factory/validator/post.go b/services/factory/validator/post.go new file mode 100644 index 0000000..7b49fc6 --- /dev/null +++ b/services/factory/validator/post.go @@ -0,0 +1,25 @@ +package validator + +import "lone-services/pkg/validate" + +type PostEditValidator struct { + Id int64 `form:"id" json:"id" validate:"required"` + Name string `form:"name" json:"name" validate:"required"` +} + +func (p PostEditValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{ + "Id.required": "ID不能为空", + "Name.required": "小组名称不能为空", + } +} + +type PostCreateValidator struct { + Name string `form:"name" json:"name" validate:"required"` +} + +func (p PostCreateValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{ + "Name.required": "小组名称不能为空", + } +} diff --git a/services/factory/validator/worker.go b/services/factory/validator/worker.go new file mode 100644 index 0000000..99a5b7b --- /dev/null +++ b/services/factory/validator/worker.go @@ -0,0 +1,35 @@ +package validator + +import "lone-services/pkg/validate" + +type WorkerEditValidator struct { + Id int64 `form:"id" json:"id" validate:"required"` + Name string `form:"name" json:"name" validate:"required"` +} + +func (p WorkerEditValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{ + "Id.required": "ID不能为空", + "Name.required": "名称不能为空", + } +} + +type WorkerCreateValidator struct { + Name string `form:"name" json:"name" validate:"required"` +} + +func (p WorkerCreateValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{ + "Name.required": "名称不能为空", + } +} + +type WorkerItemsValidator struct { + Page int32 `form:"page" json:"page"` + Size int32 `form:"size" json:"size"` + Name string `form:"name" json:"name"` +} + +func (p WorkerItemsValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{} +}