diff --git a/product-service/.idea/.gitignore b/product-service/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/product-service/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/product-service/.idea/modules.xml b/product-service/.idea/modules.xml new file mode 100644 index 0000000..1c81204 --- /dev/null +++ b/product-service/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/product-service/.idea/product-service.iml b/product-service/.idea/product-service.iml new file mode 100644 index 0000000..9267579 --- /dev/null +++ b/product-service/.idea/product-service.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/product-service/.idea/vcs.xml b/product-service/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/product-service/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/product-service/.idea/watcherTasks.xml b/product-service/.idea/watcherTasks.xml new file mode 100644 index 0000000..4aabca4 --- /dev/null +++ b/product-service/.idea/watcherTasks.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/product-service/client/client.go b/product-service/client/client.go new file mode 100644 index 0000000..ef6c67e --- /dev/null +++ b/product-service/client/client.go @@ -0,0 +1,124 @@ +package main + +import ( + "context" + consul "github.com/asim/go-micro/plugins/registry/consul/v4" + opentracing2 "github.com/go-micro/plugins/v4/wrapper/trace/opentracing" + "github.com/opentracing/opentracing-go" + "go-micro.dev/v4/web" + "goproduct/common" + "goproduct/proto" + "log" + "strconv" + + "github.com/gin-gonic/gin" + "go-micro.dev/v4" + "go-micro.dev/v4/registry" +) + +// 获取远程服务的客户端 +func main() { + router := gin.Default() + + router.Handle("GET", "toPage", func(context *gin.Context) { + context.String(200, "to toPage ....") + }) + + //注册到consul + consulReg := consul.NewRegistry(func(options *registry.Options) { + options.Addrs = []string{"192.168.100.131:8500"} + }) + //初始化链路追踪的jaeper + t, io, err := common.NewTracer("shop-product-client", "192.168.100.131:6831") + if err != nil { + log.Println(err) + } + defer io.Close() + opentracing.SetGlobalTracer(t) + + rpcServer := micro.NewService( + //micro.Name("shop-product-client"), + micro.Registry(consulReg), //服务发现 + micro.WrapClient(opentracing2.NewClientWrapper(opentracing.GlobalTracer())), + ) + client := proto.NewPageService("shop-product", rpcServer.Client()) + //分页查询商品列表 + router.GET("/page", func(c *gin.Context) { + //获取远程服务的客户端 client + //获取页面参数 + length, _ := strconv.Atoi(c.Request.FormValue("length")) + pageIndex, _ := strconv.Atoi(c.Request.FormValue("pageIndex")) + //拼接请求信息 + req := &proto.PageReq{ + Length: int32(length), + PageIndex: int32(pageIndex), + } + //远程调用服务 + resp, err := client.Page(context.TODO(), req) + log.Println(" /page :", resp) + //根据响应做输出 + if err != nil { + log.Println(err.Error()) + //c.String(http.StatusBadRequest, "search failed !") + common.RespFail(c.Writer, resp, "请求失败") + return + } + ////writer data message row total field + common.RespListOK(c.Writer, resp, "请求成功", resp.Rows, resp.Total, "请求成功") + }) + //查询商品详情 + clientA := proto.NewShowProductDetailService("shop-product", rpcServer.Client()) + router.GET("/showProductDetail", func(c *gin.Context) { + //获取远程服务的客户端 client + //获取页面参数 + id, _ := strconv.Atoi(c.Request.FormValue("id")) + //拼接请求信息 + req := &proto.ProductDetailReq{ + Id: int32(id), + } + //远程调用服务 + resp, err := clientA.ShowProductDetail(context.TODO(), req) + log.Println(" /showProductDetail :", resp) + //根据响应做输出 + if err != nil { + log.Println(err.Error()) + //c.String(http.StatusBadRequest, "search failed !") + common.RespFail(c.Writer, resp, "请求失败") + return + } + ////writer data message row total field + common.RespOK(c.Writer, resp, "请求成功") + }) + //查询商品SKU + clientSKU := proto.NewShowProductSkuService("shop-product", rpcServer.Client()) + router.GET("/sku", func(c *gin.Context) { + //获取远程服务的客户端 client + //获取页面参数 + id, _ := strconv.Atoi(c.Request.FormValue("productId")) + //拼接请求信息 + req := &proto.ProductSkuReq{ + ProductId: int32(id), + } + //远程调用服务 + resp, err := clientSKU.ShowProductSku(context.TODO(), req) + log.Println(" /sku :", resp) + //根据响应做输出 + if err != nil { + log.Println(err.Error()) + //c.String(http.StatusBadRequest, "search failed !") + common.RespFail(c.Writer, resp, "请求失败") + return + } + ////writer data message row total field + common.RespListOK(c.Writer, resp, "请求成功", 0, 0, "请求成功") + + }) + service := web.NewService( + web.Address(":6667"), + web.Name("shop-product-client"), + web.Registry(consulReg), + web.Handler(router), + ) + service.Run() + //router.Run(":6666") +} diff --git a/product-service/common/jaeger.go b/product-service/common/jaeger.go new file mode 100644 index 0000000..10e3509 --- /dev/null +++ b/product-service/common/jaeger.go @@ -0,0 +1,29 @@ +package common + +import ( + "github.com/opentracing/opentracing-go" + jaeger "github.com/uber/jaeger-client-go" + "github.com/uber/jaeger-client-go/config" + "io" + "time" +) + +/* +@Auth:ShenZ +@Description: Jaeger的实列化方法 +*/ +func NewTracer(serviceName string, addr string) (opentracing.Tracer, io.Closer, error) { + cfg := &config.Configuration{ + ServiceName: serviceName, + Sampler: &config.SamplerConfig{ + Type: jaeger.SamplerTypeConst, + Param: 1, + }, + Reporter: &config.ReporterConfig{ + BufferFlushInterval: 1 * time.Second, + LogSpans: true, + LocalAgentHostPort: addr, + }, + } + return cfg.NewTracer() +} diff --git a/product-service/domain/repository/product_repository.go b/product-service/domain/repository/product_repository.go new file mode 100644 index 0000000..13e6810 --- /dev/null +++ b/product-service/domain/repository/product_repository.go @@ -0,0 +1,86 @@ +package repository + +import ( + "errors" + "fmt" + "goproduct/domain/model" + + "gorm.io/gorm" +) + +/** + int32 clientId = 1; + string phone = 2; + int32 systemId = 3; + string verificationCode = 4; +**/ +//接口 +type IProductRepository interface { + Page(int32, int32) (int64, *[]model.Product, error) + ShowProductDetail(int32) (*model.ProductDetail, error) + ShowProductSku(int32) (*[]model.ProductSku, error) + CountNum() int64 +} + +// 创建实例 +func NewProductRepository(db *gorm.DB) IProductRepository { + return &ProductRepository{mysqlDB: db} +} + +// 数据DB +type ProductRepository struct { + mysqlDB *gorm.DB +} + +// 重写接口方法 +// product/app/product/page?length=15&pageIndex=1 +func (u *ProductRepository) Page(length int32, pageIndex int32) (coun int64, products *[]model.Product, err error) { + arr := make([]model.Product, length) + var count int64 + //u.mysqlDB.Model(&model.Product{}).Count(&count) + + if length > 0 && pageIndex > 0 { + u.mysqlDB = u.mysqlDB.Limit(int(length)).Offset((int(pageIndex) - 1) * int(length)) + if err := u.mysqlDB.Find(&arr).Error; err != nil { + fmt.Println("query product err :", err) + } + u.mysqlDB.Model(&model.Product{}).Offset(-1).Limit(-1).Count(&count) + return count, &arr, nil + } + return count, &arr, errors.New("参数不匹配") +} + +func (u *ProductRepository) ShowProductDetail(id int32) (product *model.ProductDetail, err error) { + sql := "select p.`id` , p.`name`, p.product_type,p.category_id ,p.starting_price,\n " + + " pd.detail as detail ,GROUP_CONCAT(pp.picture SEPARATOR ',') as picture_list\n" + + "FROM `product` p\n" + + " left join product_detail pd on p.id = pd.product_id\n " + + " left join product_picture pp on p.id = pp.product_id\n " + + " where p.`id` = ?" + var productDetails []model.ProductDetail + + u.mysqlDB.Raw(sql, id).Scan(&productDetails) + fmt.Println("repository ShowProductDetail >>>> ", productDetails) + return &productDetails[0], nil +} +func (u *ProductRepository) CountNum() int64 { + var count int64 + u.mysqlDB.Model(&model.Product{}).Offset(-1).Limit(-1).Count(&count) + return count +} + +/* +SkuId int32 `gorm:"column:id" json:"skuId"` +Name string +AttributeSymbolList string `gorm:"column:attribute_symbolList" json:"attributeSymbolList"` +SellPrice float32 `gorm:"column:sell_price" json:"sellPrice"` +Stock int32 `gorm:"default:1"` +*/ +func (u *ProductRepository) ShowProductSku(id int32) (product *[]model.ProductSku, err error) { + sql := "select id ,name ,attribute_symbol_list,sell_price,stock from product_sku where product_id= ?" + var productSku []model.ProductSku + + u.mysqlDB.Raw(sql, id).Scan(&productSku) + fmt.Println("repository ShowProductSku >>>> ", productSku) + return &productSku, nil +} diff --git a/product-service/domain/service/product_data_service.go b/product-service/domain/service/product_data_service.go new file mode 100644 index 0000000..02946f3 --- /dev/null +++ b/product-service/domain/service/product_data_service.go @@ -0,0 +1,40 @@ +package service + +import ( + "goproduct/domain/model" + "goproduct/domain/repository" +) + +type IProductDataService interface { + Page(int32, int32) (count int64, products *[]model.Product, err error) + ShowProductDetail(int32) (obj *model.ProductDetail, err error) + ShowProductSku(int32) (obj *[]model.ProductSku, err error) + CountNum() int64 +} +type ProductDataService struct { + productRepository repository.IProductRepository +} + +func NewProductDataService(productRepository repository.IProductRepository) IProductDataService { + return &ProductDataService{productRepository: productRepository} +} + +// 重写接口方法 +func (u *ProductDataService) Page(length int32, pageIndex int32) (count int64, products *[]model.Product, err error) { + + return u.productRepository.Page(length, pageIndex) +} + +func (u *ProductDataService) CountNum() int64 { + + return u.productRepository.CountNum() +} + +func (u *ProductDataService) ShowProductDetail(id int32) (product *model.ProductDetail, err error) { + + return u.productRepository.ShowProductDetail(id) +} +func (u *ProductDataService) ShowProductSku(id int32) (product *[]model.ProductSku, err error) { + + return u.productRepository.ShowProductSku(id) +} diff --git a/product-service/handler/product_handler.go b/product-service/handler/product_handler.go new file mode 100644 index 0000000..41a580e --- /dev/null +++ b/product-service/handler/product_handler.go @@ -0,0 +1,98 @@ +package handler + +import ( + "context" + "fmt" + "goproduct/common" + "goproduct/domain/model" + "goproduct/domain/service" + "goproduct/proto" +) + +type ProductHandler struct { + ProductDataService service.IProductDataService +} + +// 查询商品列表 +func (u *ProductHandler) Page(ctx context.Context, req *proto.PageReq, resp *proto.PageResp) error { + //count := u.ProductDataService.CountNum() + count, obj, err := u.ProductDataService.Page(req.GetLength(), req.GetPageIndex()) + if err != nil { + println("page product err :", err) + } + //count = u.ProductDataService.CountNum() + resp.Rows = int64(req.GetLength()) + resp.Total = count + //fmt.Println(">>>>>>>>>>>>> page product success :", obj) + ObjForResp(obj, resp) + return nil +} + +/* +* + + "id": 115, + "name": "马歇尔MARSHALL STANMOREⅡ无线蓝牙音响家用复古重低音小音箱", + "startingPrice": 3300, + "mainPicture": "https://msb-edu-prod.oss-cn-beijing.aliyuncs.com/mall-product/product/d4f1f19e-2e90-4ac5-bbe3-1eba02085a0f.jpg", + "labelList": [ ], + "singleBuyLimit": null, + "isEnable": null, + "productType": null + +* +*/ +func ObjForResp(obj *[]model.Product, resp *proto.PageResp) (err error) { + for _, v := range *obj { + product := &proto.Product{} + err := common.SwapToStruct(v, product) + if err != nil { + return err + } + fmt.Println(">>>>>>>>>>>>> ", product) + resp.Product = append(resp.Product, product) + } + return nil +} + +// 商品详情 +func (u *ProductHandler) ShowProductDetail(ctx context.Context, req *proto.ProductDetailReq, resp *proto.ProductDetailResp) error { + //count := u.ProductDataService.CountNum() + obj, err := u.ProductDataService.ShowProductDetail(req.GetId()) + if err != nil { + println("ShowProductDetail err :", err) + } + productDetail := &proto.ProductDetail{} + err1 := common.SwapToStruct(obj, productDetail) + if err1 != nil { + println("ShowProductDetail SwapToStruct err :", err1) + } + resp.ProductDetail = append(resp.ProductDetail, productDetail) + return nil +} + +// 商品SKU +func (u *ProductHandler) ShowProductSku(ctx context.Context, req *proto.ProductSkuReq, resp *proto.ProductSkuResp) error { + //count := u.ProductDataService.CountNum() + obj, err := u.ProductDataService.ShowProductSku(req.GetProductId()) + if err != nil { + println("ShowProductSku err :", err) + } + err1 := ObjSkuForResp(obj, resp) + if err1 != nil { + println("ShowProductSku SwapToStruct err :", err1) + } + return nil +} + +func ObjSkuForResp(obj *[]model.ProductSku, resp *proto.ProductSkuResp) (err error) { + for _, v := range *obj { + product := &proto.ProductSku{} + err := common.SwapToStruct(v, product) + if err != nil { + return err + } + resp.ProductSku = append(resp.ProductSku, product) + } + return nil +} diff --git a/product-service/proto/product.pb.go b/product-service/proto/product.pb.go new file mode 100644 index 0000000..673ab0b --- /dev/null +++ b/product-service/proto/product.pb.go @@ -0,0 +1,1037 @@ +//* +// @Auth:ShenZ +// @Description: + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.18.1 +// source: product.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// * +// "id": 115, +// "name": "马歇尔MARSHALL STANMOREⅡ无线蓝牙音响家用复古重低音小音箱", +// "startingPrice": 3300, +// "mainPicture": "https://msb-edu-prod.oss-cn-beijing.aliyuncs.com/mall-product/product/d4f1f19e-2e90-4ac5-bbe3-1eba02085a0f.jpg", +// "labelList": [ ], +// "singleBuyLimit": null, +// "isEnable": null, +// "productType": null +type Product struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + StartingPrice int32 `protobuf:"varint,3,opt,name=startingPrice,proto3" json:"startingPrice,omitempty"` + MainPicture string `protobuf:"bytes,4,opt,name=mainPicture,proto3" json:"mainPicture,omitempty"` + LabelList map[string]string `protobuf:"bytes,5,rep,name=labelList,proto3" json:"labelList,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + SingleBuyLimit int32 `protobuf:"varint,6,opt,name=singleBuyLimit,proto3" json:"singleBuyLimit,omitempty"` + Token string `protobuf:"bytes,7,opt,name=token,proto3" json:"token,omitempty"` + IsEnable bool `protobuf:"varint,8,opt,name=isEnable,proto3" json:"isEnable,omitempty"` + ProductType int32 `protobuf:"varint,9,opt,name=productType,proto3" json:"productType,omitempty"` +} + +func (x *Product) Reset() { + *x = Product{} + if protoimpl.UnsafeEnabled { + mi := &file_product_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Product) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Product) ProtoMessage() {} + +func (x *Product) ProtoReflect() protoreflect.Message { + mi := &file_product_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Product.ProtoReflect.Descriptor instead. +func (*Product) Descriptor() ([]byte, []int) { + return file_product_proto_rawDescGZIP(), []int{0} +} + +func (x *Product) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Product) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Product) GetStartingPrice() int32 { + if x != nil { + return x.StartingPrice + } + return 0 +} + +func (x *Product) GetMainPicture() string { + if x != nil { + return x.MainPicture + } + return "" +} + +func (x *Product) GetLabelList() map[string]string { + if x != nil { + return x.LabelList + } + return nil +} + +func (x *Product) GetSingleBuyLimit() int32 { + if x != nil { + return x.SingleBuyLimit + } + return 0 +} + +func (x *Product) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *Product) GetIsEnable() bool { + if x != nil { + return x.IsEnable + } + return false +} + +func (x *Product) GetProductType() int32 { + if x != nil { + return x.ProductType + } + return 0 +} + +// 请求 request struct +type PageReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"` + PageIndex int32 `protobuf:"varint,2,opt,name=pageIndex,proto3" json:"pageIndex,omitempty"` +} + +func (x *PageReq) Reset() { + *x = PageReq{} + if protoimpl.UnsafeEnabled { + mi := &file_product_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PageReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PageReq) ProtoMessage() {} + +func (x *PageReq) ProtoReflect() protoreflect.Message { + mi := &file_product_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PageReq.ProtoReflect.Descriptor instead. +func (*PageReq) Descriptor() ([]byte, []int) { + return file_product_proto_rawDescGZIP(), []int{1} +} + +func (x *PageReq) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *PageReq) GetPageIndex() int32 { + if x != nil { + return x.PageIndex + } + return 0 +} + +// * +type PageResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Product []*Product `protobuf:"bytes,1,rep,name=product,proto3" json:"product,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + Rows int64 `protobuf:"varint,3,opt,name=rows,proto3" json:"rows,omitempty"` +} + +func (x *PageResp) Reset() { + *x = PageResp{} + if protoimpl.UnsafeEnabled { + mi := &file_product_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PageResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PageResp) ProtoMessage() {} + +func (x *PageResp) ProtoReflect() protoreflect.Message { + mi := &file_product_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PageResp.ProtoReflect.Descriptor instead. +func (*PageResp) Descriptor() ([]byte, []int) { + return file_product_proto_rawDescGZIP(), []int{2} +} + +func (x *PageResp) GetProduct() []*Product { + if x != nil { + return x.Product + } + return nil +} + +func (x *PageResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *PageResp) GetRows() int64 { + if x != nil { + return x.Rows + } + return 0 +} + +// * +// ID int32 `json:"id"` +// Name string `json:"name"` +// ProductType int32 `gorm:"default:1" json:"productType"` +// CategoryId int32 `json:"categoryId"` +// StartingPrice float32 `json:"startingPrice"` +// TotalStock int32 `gorm:"default:1234" json:"totalStock"` +// MainPicture string `gorm:"default:1" json:"mainPicture"` +// RemoteAreaPostage float32 `json:"remoteAreaPostage"` +// SingleBuyLimit int32 `json:"singleBuyLimit"` +// IsEnable bool `json:"isEnable"` +// Remark string `gorm:"default:1" json:"remark"` +// CreateUser int32 `gorm:"default:1" json:"createUser"` +// CreateTime time.Time `json:"createTime"` +// UpdateUser int32 `json:"updateUser"` +// UpdateTime time.Time `json:"updateTime"` +// IsDeleted bool `json:"isDeleted"` +// Detail string `gorm:"dtail" json:"detail"` //商品详情页面 +// PictureList []string `gorm:"pictureList" json:"pictureList"` //商品详情需要的图片 +type ProductDetail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + ProductType int32 `protobuf:"varint,3,opt,name=productType,proto3" json:"productType,omitempty"` + CategoryId int32 `protobuf:"varint,4,opt,name=categoryId,proto3" json:"categoryId,omitempty"` + StartingPrice float32 `protobuf:"fixed32,5,opt,name=startingPrice,proto3" json:"startingPrice,omitempty"` + TotalStock int32 `protobuf:"varint,6,opt,name=totalStock,proto3" json:"totalStock,omitempty"` + MainPicture string `protobuf:"bytes,7,opt,name=mainPicture,proto3" json:"mainPicture,omitempty"` + RemoteAreaPostage float32 `protobuf:"fixed32,8,opt,name=remoteAreaPostage,proto3" json:"remoteAreaPostage,omitempty"` + SingleBuyLimit int32 `protobuf:"varint,9,opt,name=singleBuyLimit,proto3" json:"singleBuyLimit,omitempty"` + IsEnable bool `protobuf:"varint,10,opt,name=isEnable,proto3" json:"isEnable,omitempty"` + Remark string `protobuf:"bytes,11,opt,name=remark,proto3" json:"remark,omitempty"` + CreateUser int32 `protobuf:"varint,12,opt,name=createUser,proto3" json:"createUser,omitempty"` + CreateTime string `protobuf:"bytes,13,opt,name=createTime,proto3" json:"createTime,omitempty"` //go get google.golang.org/protobuf/ptypes/timestamp + UpdateUser int32 `protobuf:"varint,14,opt,name=updateUser,proto3" json:"updateUser,omitempty"` + UpdateTime string `protobuf:"bytes,15,opt,name=updateTime,proto3" json:"updateTime,omitempty"` + IsDeleted bool `protobuf:"varint,16,opt,name=IsDeleted,proto3" json:"IsDeleted,omitempty"` + Detail string `protobuf:"bytes,17,opt,name=detail,proto3" json:"detail,omitempty"` + PictureList string `protobuf:"bytes,18,opt,name=pictureList,proto3" json:"pictureList,omitempty"` +} + +func (x *ProductDetail) Reset() { + *x = ProductDetail{} + if protoimpl.UnsafeEnabled { + mi := &file_product_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductDetail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductDetail) ProtoMessage() {} + +func (x *ProductDetail) ProtoReflect() protoreflect.Message { + mi := &file_product_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductDetail.ProtoReflect.Descriptor instead. +func (*ProductDetail) Descriptor() ([]byte, []int) { + return file_product_proto_rawDescGZIP(), []int{3} +} + +func (x *ProductDetail) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ProductDetail) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ProductDetail) GetProductType() int32 { + if x != nil { + return x.ProductType + } + return 0 +} + +func (x *ProductDetail) GetCategoryId() int32 { + if x != nil { + return x.CategoryId + } + return 0 +} + +func (x *ProductDetail) GetStartingPrice() float32 { + if x != nil { + return x.StartingPrice + } + return 0 +} + +func (x *ProductDetail) GetTotalStock() int32 { + if x != nil { + return x.TotalStock + } + return 0 +} + +func (x *ProductDetail) GetMainPicture() string { + if x != nil { + return x.MainPicture + } + return "" +} + +func (x *ProductDetail) GetRemoteAreaPostage() float32 { + if x != nil { + return x.RemoteAreaPostage + } + return 0 +} + +func (x *ProductDetail) GetSingleBuyLimit() int32 { + if x != nil { + return x.SingleBuyLimit + } + return 0 +} + +func (x *ProductDetail) GetIsEnable() bool { + if x != nil { + return x.IsEnable + } + return false +} + +func (x *ProductDetail) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *ProductDetail) GetCreateUser() int32 { + if x != nil { + return x.CreateUser + } + return 0 +} + +func (x *ProductDetail) GetCreateTime() string { + if x != nil { + return x.CreateTime + } + return "" +} + +func (x *ProductDetail) GetUpdateUser() int32 { + if x != nil { + return x.UpdateUser + } + return 0 +} + +func (x *ProductDetail) GetUpdateTime() string { + if x != nil { + return x.UpdateTime + } + return "" +} + +func (x *ProductDetail) GetIsDeleted() bool { + if x != nil { + return x.IsDeleted + } + return false +} + +func (x *ProductDetail) GetDetail() string { + if x != nil { + return x.Detail + } + return "" +} + +func (x *ProductDetail) GetPictureList() string { + if x != nil { + return x.PictureList + } + return "" +} + +// 请求 request struct +type ProductDetailReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *ProductDetailReq) Reset() { + *x = ProductDetailReq{} + if protoimpl.UnsafeEnabled { + mi := &file_product_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductDetailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductDetailReq) ProtoMessage() {} + +func (x *ProductDetailReq) ProtoReflect() protoreflect.Message { + mi := &file_product_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductDetailReq.ProtoReflect.Descriptor instead. +func (*ProductDetailReq) Descriptor() ([]byte, []int) { + return file_product_proto_rawDescGZIP(), []int{4} +} + +func (x *ProductDetailReq) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +// * +type ProductDetailResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductDetail []*ProductDetail `protobuf:"bytes,1,rep,name=productDetail,proto3" json:"productDetail,omitempty"` +} + +func (x *ProductDetailResp) Reset() { + *x = ProductDetailResp{} + if protoimpl.UnsafeEnabled { + mi := &file_product_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductDetailResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductDetailResp) ProtoMessage() {} + +func (x *ProductDetailResp) ProtoReflect() protoreflect.Message { + mi := &file_product_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductDetailResp.ProtoReflect.Descriptor instead. +func (*ProductDetailResp) Descriptor() ([]byte, []int) { + return file_product_proto_rawDescGZIP(), []int{5} +} + +func (x *ProductDetailResp) GetProductDetail() []*ProductDetail { + if x != nil { + return x.ProductDetail + } + return nil +} + +// SkuId int32 `gorm:"column:id" json:"skuId"` +// Name string +// AttributeSymbolList string `gorm:"column:attribute_symbolList" json:"attributeSymbolList"` +// SellPrice float32 `gorm:"column:sell_price" json:"sellPrice"` +// Stock int32 `gorm:"default:1"` +type ProductSku struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SkuId int32 `protobuf:"varint,1,opt,name=skuId,proto3" json:"skuId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + AttributeSymbolList string `protobuf:"bytes,3,opt,name=attributeSymbolList,proto3" json:"attributeSymbolList,omitempty"` + SellPrice float32 `protobuf:"fixed32,4,opt,name=sellPrice,proto3" json:"sellPrice,omitempty"` + Stock int32 `protobuf:"varint,5,opt,name=stock,proto3" json:"stock,omitempty"` +} + +func (x *ProductSku) Reset() { + *x = ProductSku{} + if protoimpl.UnsafeEnabled { + mi := &file_product_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductSku) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductSku) ProtoMessage() {} + +func (x *ProductSku) ProtoReflect() protoreflect.Message { + mi := &file_product_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductSku.ProtoReflect.Descriptor instead. +func (*ProductSku) Descriptor() ([]byte, []int) { + return file_product_proto_rawDescGZIP(), []int{6} +} + +func (x *ProductSku) GetSkuId() int32 { + if x != nil { + return x.SkuId + } + return 0 +} + +func (x *ProductSku) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ProductSku) GetAttributeSymbolList() string { + if x != nil { + return x.AttributeSymbolList + } + return "" +} + +func (x *ProductSku) GetSellPrice() float32 { + if x != nil { + return x.SellPrice + } + return 0 +} + +func (x *ProductSku) GetStock() int32 { + if x != nil { + return x.Stock + } + return 0 +} + +// 请求 request struct +type ProductSkuReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId int32 `protobuf:"varint,1,opt,name=productId,proto3" json:"productId,omitempty"` +} + +func (x *ProductSkuReq) Reset() { + *x = ProductSkuReq{} + if protoimpl.UnsafeEnabled { + mi := &file_product_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductSkuReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductSkuReq) ProtoMessage() {} + +func (x *ProductSkuReq) ProtoReflect() protoreflect.Message { + mi := &file_product_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductSkuReq.ProtoReflect.Descriptor instead. +func (*ProductSkuReq) Descriptor() ([]byte, []int) { + return file_product_proto_rawDescGZIP(), []int{7} +} + +func (x *ProductSkuReq) GetProductId() int32 { + if x != nil { + return x.ProductId + } + return 0 +} + +// * +type ProductSkuResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductSku []*ProductSku `protobuf:"bytes,1,rep,name=productSku,proto3" json:"productSku,omitempty"` +} + +func (x *ProductSkuResp) Reset() { + *x = ProductSkuResp{} + if protoimpl.UnsafeEnabled { + mi := &file_product_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductSkuResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductSkuResp) ProtoMessage() {} + +func (x *ProductSkuResp) ProtoReflect() protoreflect.Message { + mi := &file_product_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductSkuResp.ProtoReflect.Descriptor instead. +func (*ProductSkuResp) Descriptor() ([]byte, []int) { + return file_product_proto_rawDescGZIP(), []int{8} +} + +func (x *ProductSkuResp) GetProductSku() []*ProductSku { + if x != nil { + return x.ProductSku + } + return nil +} + +var File_product_proto protoreflect.FileDescriptor + +var file_product_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xec, 0x02, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, + 0x63, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, + 0x6e, 0x67, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x6d, 0x61, 0x69, 0x6e, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x6d, 0x61, 0x69, 0x6e, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3b, + 0x0a, 0x09, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x09, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x73, + 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x42, 0x75, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0e, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x42, 0x75, 0x79, 0x4c, 0x69, + 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4c, 0x61, 0x62, 0x65, 0x6c, + 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3f, 0x0a, 0x07, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x70, 0x61, 0x67, + 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x5e, 0x0a, 0x08, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x28, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x22, 0xbf, 0x04, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x64, 0x75, + 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x24, + 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, + 0x72, 0x69, 0x63, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x74, 0x6f, + 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, + 0x74, 0x6f, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x61, 0x69, 0x6e, 0x50, 0x69, 0x63, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x61, 0x69, 0x6e, 0x50, + 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x41, 0x72, 0x65, 0x61, 0x50, 0x6f, 0x73, 0x74, 0x61, 0x67, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x02, 0x52, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x72, 0x65, 0x61, 0x50, 0x6f, 0x73, + 0x74, 0x61, 0x67, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x42, 0x75, + 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x73, 0x69, + 0x6e, 0x67, 0x6c, 0x65, 0x42, 0x75, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08, + 0x69, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, + 0x69, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, + 0x72, 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, + 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x18, 0x0e, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0f, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x10, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x49, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, + 0x65, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x69, 0x63, + 0x74, 0x75, 0x72, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x22, 0x0a, 0x10, 0x50, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x11, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x3a, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x0d, + 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x9c, 0x01, + 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x6b, 0x75, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x6b, 0x75, + 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x13, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x13, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x53, 0x79, + 0x6d, 0x62, 0x6f, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x6c, + 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, 0x73, 0x65, 0x6c, + 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x22, 0x2d, 0x0a, 0x0d, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, + 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x22, 0x43, 0x0a, 0x0e, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, + 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x53, 0x6b, 0x75, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, + 0x32, 0x31, 0x0a, 0x04, 0x50, 0x61, 0x67, 0x65, 0x12, 0x29, 0x0a, 0x04, 0x50, 0x61, 0x67, 0x65, + 0x12, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x22, 0x00, 0x32, 0x5d, 0x0a, 0x11, 0x53, 0x68, 0x6f, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, + 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x48, 0x0a, 0x11, 0x53, 0x68, 0x6f, 0x77, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x17, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, + 0x22, 0x00, 0x32, 0x51, 0x0a, 0x0e, 0x53, 0x68, 0x6f, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x53, 0x6b, 0x75, 0x12, 0x3f, 0x0a, 0x0e, 0x53, 0x68, 0x6f, 0x77, 0x50, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x52, + 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_product_proto_rawDescOnce sync.Once + file_product_proto_rawDescData = file_product_proto_rawDesc +) + +func file_product_proto_rawDescGZIP() []byte { + file_product_proto_rawDescOnce.Do(func() { + file_product_proto_rawDescData = protoimpl.X.CompressGZIP(file_product_proto_rawDescData) + }) + return file_product_proto_rawDescData +} + +var file_product_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_product_proto_goTypes = []interface{}{ + (*Product)(nil), // 0: proto.Product + (*PageReq)(nil), // 1: proto.PageReq + (*PageResp)(nil), // 2: proto.PageResp + (*ProductDetail)(nil), // 3: proto.ProductDetail + (*ProductDetailReq)(nil), // 4: proto.ProductDetailReq + (*ProductDetailResp)(nil), // 5: proto.ProductDetailResp + (*ProductSku)(nil), // 6: proto.ProductSku + (*ProductSkuReq)(nil), // 7: proto.ProductSkuReq + (*ProductSkuResp)(nil), // 8: proto.ProductSkuResp + nil, // 9: proto.Product.LabelListEntry +} +var file_product_proto_depIdxs = []int32{ + 9, // 0: proto.Product.labelList:type_name -> proto.Product.LabelListEntry + 0, // 1: proto.PageResp.product:type_name -> proto.Product + 3, // 2: proto.ProductDetailResp.productDetail:type_name -> proto.ProductDetail + 6, // 3: proto.ProductSkuResp.productSku:type_name -> proto.ProductSku + 1, // 4: proto.Page.Page:input_type -> proto.PageReq + 4, // 5: proto.ShowProductDetail.ShowProductDetail:input_type -> proto.ProductDetailReq + 7, // 6: proto.ShowProductSku.ShowProductSku:input_type -> proto.ProductSkuReq + 2, // 7: proto.Page.Page:output_type -> proto.PageResp + 5, // 8: proto.ShowProductDetail.ShowProductDetail:output_type -> proto.ProductDetailResp + 8, // 9: proto.ShowProductSku.ShowProductSku:output_type -> proto.ProductSkuResp + 7, // [7:10] is the sub-list for method output_type + 4, // [4:7] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_product_proto_init() } +func file_product_proto_init() { + if File_product_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_product_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Product); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_product_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PageReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_product_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PageResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_product_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductDetail); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_product_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductDetailReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_product_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductDetailResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_product_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductSku); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_product_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductSkuReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_product_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductSkuResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_product_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 3, + }, + GoTypes: file_product_proto_goTypes, + DependencyIndexes: file_product_proto_depIdxs, + MessageInfos: file_product_proto_msgTypes, + }.Build() + File_product_proto = out.File + file_product_proto_rawDesc = nil + file_product_proto_goTypes = nil + file_product_proto_depIdxs = nil +} diff --git a/product-service/proto/product.pb.micro.go b/product-service/proto/product.pb.micro.go new file mode 100644 index 0000000..52852df --- /dev/null +++ b/product-service/proto/product.pb.micro.go @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-micro. DO NOT EDIT. +// source: product.proto + +package proto + +import ( + fmt "fmt" + proto "google.golang.org/protobuf/proto" + math "math" +) + +import ( + context "context" + api "go-micro.dev/v4/api" + client "go-micro.dev/v4/client" + server "go-micro.dev/v4/server" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// Reference imports to suppress errors if they are not otherwise used. +var _ api.Endpoint +var _ context.Context +var _ client.Option +var _ server.Option + +// Api Endpoints for Page service + +func NewPageEndpoints() []*api.Endpoint { + return []*api.Endpoint{} +} + +// Client API for Page service + +type PageService interface { + //rpc 服务 + Page(ctx context.Context, in *PageReq, opts ...client.CallOption) (*PageResp, error) +} + +type pageService struct { + c client.Client + name string +} + +func NewPageService(name string, c client.Client) PageService { + return &pageService{ + c: c, + name: name, + } +} + +func (c *pageService) Page(ctx context.Context, in *PageReq, opts ...client.CallOption) (*PageResp, error) { + req := c.c.NewRequest(c.name, "Page.Page", in) + out := new(PageResp) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Page service + +type PageHandler interface { + //rpc 服务 + Page(context.Context, *PageReq, *PageResp) error +} + +func RegisterPageHandler(s server.Server, hdlr PageHandler, opts ...server.HandlerOption) error { + type page interface { + Page(ctx context.Context, in *PageReq, out *PageResp) error + } + type Page struct { + page + } + h := &pageHandler{hdlr} + return s.Handle(s.NewHandler(&Page{h}, opts...)) +} + +type pageHandler struct { + PageHandler +} + +func (h *pageHandler) Page(ctx context.Context, in *PageReq, out *PageResp) error { + return h.PageHandler.Page(ctx, in, out) +} + +// Api Endpoints for ShowProductDetail service + +func NewShowProductDetailEndpoints() []*api.Endpoint { + return []*api.Endpoint{} +} + +// Client API for ShowProductDetail service + +type ShowProductDetailService interface { + //rpc 服务 + ShowProductDetail(ctx context.Context, in *ProductDetailReq, opts ...client.CallOption) (*ProductDetailResp, error) +} + +type showProductDetailService struct { + c client.Client + name string +} + +func NewShowProductDetailService(name string, c client.Client) ShowProductDetailService { + return &showProductDetailService{ + c: c, + name: name, + } +} + +func (c *showProductDetailService) ShowProductDetail(ctx context.Context, in *ProductDetailReq, opts ...client.CallOption) (*ProductDetailResp, error) { + req := c.c.NewRequest(c.name, "ShowProductDetail.ShowProductDetail", in) + out := new(ProductDetailResp) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for ShowProductDetail service + +type ShowProductDetailHandler interface { + //rpc 服务 + ShowProductDetail(context.Context, *ProductDetailReq, *ProductDetailResp) error +} + +func RegisterShowProductDetailHandler(s server.Server, hdlr ShowProductDetailHandler, opts ...server.HandlerOption) error { + type showProductDetail interface { + ShowProductDetail(ctx context.Context, in *ProductDetailReq, out *ProductDetailResp) error + } + type ShowProductDetail struct { + showProductDetail + } + h := &showProductDetailHandler{hdlr} + return s.Handle(s.NewHandler(&ShowProductDetail{h}, opts...)) +} + +type showProductDetailHandler struct { + ShowProductDetailHandler +} + +func (h *showProductDetailHandler) ShowProductDetail(ctx context.Context, in *ProductDetailReq, out *ProductDetailResp) error { + return h.ShowProductDetailHandler.ShowProductDetail(ctx, in, out) +} + +// Api Endpoints for ShowProductSku service + +func NewShowProductSkuEndpoints() []*api.Endpoint { + return []*api.Endpoint{} +} + +// Client API for ShowProductSku service + +type ShowProductSkuService interface { + //rpc 服务 + ShowProductSku(ctx context.Context, in *ProductSkuReq, opts ...client.CallOption) (*ProductSkuResp, error) +} + +type showProductSkuService struct { + c client.Client + name string +} + +func NewShowProductSkuService(name string, c client.Client) ShowProductSkuService { + return &showProductSkuService{ + c: c, + name: name, + } +} + +func (c *showProductSkuService) ShowProductSku(ctx context.Context, in *ProductSkuReq, opts ...client.CallOption) (*ProductSkuResp, error) { + req := c.c.NewRequest(c.name, "ShowProductSku.ShowProductSku", in) + out := new(ProductSkuResp) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for ShowProductSku service + +type ShowProductSkuHandler interface { + //rpc 服务 + ShowProductSku(context.Context, *ProductSkuReq, *ProductSkuResp) error +} + +func RegisterShowProductSkuHandler(s server.Server, hdlr ShowProductSkuHandler, opts ...server.HandlerOption) error { + type showProductSku interface { + ShowProductSku(ctx context.Context, in *ProductSkuReq, out *ProductSkuResp) error + } + type ShowProductSku struct { + showProductSku + } + h := &showProductSkuHandler{hdlr} + return s.Handle(s.NewHandler(&ShowProductSku{h}, opts...)) +} + +type showProductSkuHandler struct { + ShowProductSkuHandler +} + +func (h *showProductSkuHandler) ShowProductSku(ctx context.Context, in *ProductSkuReq, out *ProductSkuResp) error { + return h.ShowProductSkuHandler.ShowProductSku(ctx, in, out) +} diff --git a/product-service/proto/product.proto b/product-service/proto/product.proto new file mode 100644 index 0000000..88913b4 --- /dev/null +++ b/product-service/proto/product.proto @@ -0,0 +1,146 @@ +/** +* @Auth:ShenZ +* @Description: +*/ +syntax = "proto3"; // 版本号 +option go_package="./;proto"; //参数1 表示生成到哪个目录 ,参数2 表示生成的文件的package +package proto ; //默认在哪个包 + + +//结构体 +/** + "id": 115, + "name": "马歇尔MARSHALL STANMOREⅡ无线蓝牙音响家用复古重低音小音箱", + "startingPrice": 3300, + "mainPicture": "https://msb-edu-prod.oss-cn-beijing.aliyuncs.com/mall-product/product/d4f1f19e-2e90-4ac5-bbe3-1eba02085a0f.jpg", + "labelList": [ ], + "singleBuyLimit": null, + "isEnable": null, + "productType": null +**/ +message Product { + int32 id = 1; + string name = 2; + int32 startingPrice =3; + string mainPicture = 4; + map labelList = 5; + int32 singleBuyLimit = 6; + string token = 7; + bool isEnable = 8; + int32 productType = 9; +} +/** +前端请求信息 +{ + "clientId": 0, + "phone": "", + "systemId": 0, + "verificationCode": "" + } + **/ +//请求 request struct +message PageReq { + int32 length = 1; + int32 pageIndex = 2; +} +//响应 resp struct +/** + +**/ +message PageResp{ + repeated Product product = 1; + int64 total =2; + int64 rows = 3; +} +//RPC 服务 接口 +service Page { + //rpc 服务 + rpc Page (PageReq) returns (PageResp){} +} + +/** + ID int32 `json:"id"` + Name string `json:"name"` + ProductType int32 `gorm:"default:1" json:"productType"` + CategoryId int32 `json:"categoryId"` + StartingPrice float32 `json:"startingPrice"` + TotalStock int32 `gorm:"default:1234" json:"totalStock"` + MainPicture string `gorm:"default:1" json:"mainPicture"` + RemoteAreaPostage float32 `json:"remoteAreaPostage"` + SingleBuyLimit int32 `json:"singleBuyLimit"` + IsEnable bool `json:"isEnable"` + Remark string `gorm:"default:1" json:"remark"` + CreateUser int32 `gorm:"default:1" json:"createUser"` + CreateTime time.Time `json:"createTime"` + UpdateUser int32 `json:"updateUser"` + UpdateTime time.Time `json:"updateTime"` + IsDeleted bool `json:"isDeleted"` + Detail string `gorm:"dtail" json:"detail"` //商品详情页面 + PictureList []string `gorm:"pictureList" json:"pictureList"` //商品详情需要的图片 + */ +message ProductDetail { + int32 id = 1; + string name = 2; + int32 productType =3; + int32 categoryId = 4; + float startingPrice =5; + int32 totalStock = 6; + string mainPicture =7; + float remoteAreaPostage = 8; + int32 singleBuyLimit =9; + bool isEnable =10; + string remark =11; + int32 createUser =12 ; + string createTime = 13; //go get google.golang.org/protobuf/ptypes/timestamp + int32 updateUser =14; + string updateTime =15; + bool IsDeleted =16; + string detail =17; + string pictureList =18; +} +//请求 request struct +message ProductDetailReq { + int32 id = 1; +} +//响应 resp struct +/** + +**/ +message ProductDetailResp{ + repeated ProductDetail productDetail = 1; +} +//RPC 服务 接口 +service ShowProductDetail { + //rpc 服务 + rpc ShowProductDetail (ProductDetailReq) returns (ProductDetailResp){} +} +/* +SkuId int32 `gorm:"column:id" json:"skuId"` + Name string + AttributeSymbolList string `gorm:"column:attribute_symbolList" json:"attributeSymbolList"` + SellPrice float32 `gorm:"column:sell_price" json:"sellPrice"` + Stock int32 `gorm:"default:1"` + */ +message ProductSku { + int32 skuId = 1; + string name = 2; + string attributeSymbolList =3; + float sellPrice = 4; + int32 stock =5; +} +//请求 request struct +message ProductSkuReq { + int32 productId = 1; +} +//响应 resp struct +/** + +**/ +message ProductSkuResp{ + repeated ProductSku productSku = 1; +} +//RPC 服务 接口 +service ShowProductSku { + //rpc 服务 + rpc ShowProductSku (ProductSkuReq) returns (ProductSkuResp){} +} diff --git a/user-service/.idea/.gitignore b/user-service/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/user-service/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/user-service/.idea/modules.xml b/user-service/.idea/modules.xml new file mode 100644 index 0000000..f5824cf --- /dev/null +++ b/user-service/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/user-service/.idea/user-service.iml b/user-service/.idea/user-service.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/user-service/.idea/user-service.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/user-service/.idea/vcs.xml b/user-service/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/user-service/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file