fix
wangpengfei
2023-08-28 28fb78f3fa0e4f629ff7d49f8305f5120cdafd15
fix

add fields to product gRPC
5个文件已修改
147 ■■■■■ 已修改文件
api/v1/test/product.go 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config.yaml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
proto/product.proto 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proto/product/product.pb.go 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proto/product/product_grpc.pb.go 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/test/product.go
@@ -220,9 +220,11 @@
        productList[k].Name = v.Name
        productList[k].Unit = v.Unit
        productList[k].PurchasePrice = &v.SalePrice
        //productList[k].MinimumStock = &v.SalePrice
        //productList[k].MaximumStock = &v.SalePrice
        //productList[k].Remark = &v.SalePrice
        min := int(v.MinInventory)
        productList[k].MinimumStock = &min
        max := int(v.MaxInventory)
        productList[k].MaximumStock = &max
        productList[k].Remark = v.Node
        productList[k].ProductType = v.MaterialMode
    }
config.yaml
@@ -182,7 +182,7 @@
  iplimit-time: 3600
  use-multipoint: false
  use-redis: false
  grpc-url: 192.168.20.119:9091
  grpc-url: 192.168.20.118:9091
  grpc-admin-url: 192.168.20.119:50051
tencent-cos:
  bucket: xxxxx-10005608
proto/product.proto
@@ -24,8 +24,12 @@
  double SalePrice = 5; //销售价格
  float Amount = 6;//库存剩余量
  int32 MinInventory = 7;//安全库存
  string MaterialMode = 8; //物料类型
  string PurchaseType = 9;//采购类型
  int32 MaxInventory = 8; // 最大库存
  string MaterialMode = 9; //物料类型
  string PurchaseType = 10;//采购类型
  string Node = 11; // 备注
  string Type = 12; // 型号
  string Specs = 13; // 规格
}
message GetProductListRequest{
proto/product/product.pb.go
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
//     protoc-gen-go v1.31.0
//     protoc        v3.19.0
//     protoc-gen-go v1.26.0
//     protoc        v4.24.0
// source: product.proto
package product
@@ -142,8 +142,12 @@
    SalePrice    float64 `protobuf:"fixed64,5,opt,name=SalePrice,proto3" json:"SalePrice,omitempty"`      //销售价格
    Amount       float32 `protobuf:"fixed32,6,opt,name=Amount,proto3" json:"Amount,omitempty"`            //库存剩余量
    MinInventory int32   `protobuf:"varint,7,opt,name=MinInventory,proto3" json:"MinInventory,omitempty"` //安全库存
    MaterialMode string  `protobuf:"bytes,8,opt,name=MaterialMode,proto3" json:"MaterialMode,omitempty"`  //物料类型
    PurchaseType string  `protobuf:"bytes,9,opt,name=PurchaseType,proto3" json:"PurchaseType,omitempty"`  //采购类型
    MaxInventory int32   `protobuf:"varint,8,opt,name=MaxInventory,proto3" json:"MaxInventory,omitempty"` // 最大库存
    MaterialMode string  `protobuf:"bytes,9,opt,name=MaterialMode,proto3" json:"MaterialMode,omitempty"`  //物料类型
    PurchaseType string  `protobuf:"bytes,10,opt,name=PurchaseType,proto3" json:"PurchaseType,omitempty"` //采购类型
    Node         string  `protobuf:"bytes,11,opt,name=Node,proto3" json:"Node,omitempty"`                 // 备注
    Type         string  `protobuf:"bytes,12,opt,name=Type,proto3" json:"Type,omitempty"`                 // 型号
    Specs        string  `protobuf:"bytes,13,opt,name=Specs,proto3" json:"Specs,omitempty"`               // 规格
}
func (x *Product) Reset() {
@@ -227,6 +231,13 @@
    return 0
}
func (x *Product) GetMaxInventory() int32 {
    if x != nil {
        return x.MaxInventory
    }
    return 0
}
func (x *Product) GetMaterialMode() string {
    if x != nil {
        return x.MaterialMode
@@ -237,6 +248,27 @@
func (x *Product) GetPurchaseType() string {
    if x != nil {
        return x.PurchaseType
    }
    return ""
}
func (x *Product) GetNode() string {
    if x != nil {
        return x.Node
    }
    return ""
}
func (x *Product) GetType() string {
    if x != nil {
        return x.Type
    }
    return ""
}
func (x *Product) GetSpecs() string {
    if x != nil {
        return x.Specs
    }
    return ""
}
@@ -396,7 +428,7 @@
    0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
    0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x1c, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03,
    0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x04,
    0x44, 0x61, 0x74, 0x61, 0x22, 0x83, 0x02, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
    0x44, 0x61, 0x74, 0x61, 0x22, 0xe5, 0x02, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
    0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
    0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65,
    0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04,
@@ -408,39 +440,45 @@
    0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22,
    0x0a, 0x0c, 0x4d, 0x69, 0x6e, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x07,
    0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x4d, 0x69, 0x6e, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f,
    0x72, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4d, 0x6f,
    0x64, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69,
    0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61,
    0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x50, 0x75,
    0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x15, 0x47,
    0x72, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x4d, 0x61, 0x78, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f,
    0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x4d, 0x61, 0x78, 0x49, 0x6e, 0x76,
    0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69,
    0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x4d, 0x61,
    0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x50, 0x75,
    0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09,
    0x52, 0x0c, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12,
    0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x6f,
    0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09,
    0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x63, 0x73, 0x18,
    0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x53, 0x70, 0x65, 0x63, 0x73, 0x22, 0x8f, 0x01, 0x0a,
    0x15, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52,
    0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01,
    0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61,
    0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61,
    0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
    0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x50,
    0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b,
    0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
    0x09, 0x52, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x72,
    0x0a, 0x16, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74,
    0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65,
    0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03,
    0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x1c,
    0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x50,
    0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05,
    0x54, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x54, 0x6f, 0x74,
    0x61, 0x6c, 0x32, 0x9a, 0x01, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x65,
    0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64,
    0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f,
    0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
    0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f,
    0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x47, 0x65,
    0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x47,
    0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71,
    0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01,
    0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65,
    0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65,
    0x53, 0x69, 0x7a, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e,
    0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x50, 0x72, 0x6f,
    0x64, 0x75, 0x63, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x72,
    0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
    0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x72, 0x0a, 0x16,
    0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
    0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01,
    0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73,
    0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x1c, 0x0a, 0x04,
    0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x50, 0x72, 0x6f,
    0x64, 0x75, 0x63, 0x74, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f,
    0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c,
    0x32, 0x9a, 0x01, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76,
    0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
    0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75,
    0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
    0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65,
    0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50,
    0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74,
    0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
    0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c,
    0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0b, 0x5a,
    0x09, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
    0x6f, 0x33,
    0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
    0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42,
    0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72,
    0x6f, 0x74, 0x6f, 0x33,
}
var (
proto/product/product_grpc.pb.go
@@ -1,8 +1,4 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             v3.19.0
// source: product.proto
package product
@@ -17,11 +13,6 @@
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
    ProductService_GetProductInfo_FullMethodName = "/productService/GetProductInfo"
    ProductService_GetProductList_FullMethodName = "/productService/GetProductList"
)
// ProductServiceClient is the client API for ProductService service.
//
@@ -41,7 +32,7 @@
func (c *productServiceClient) GetProductInfo(ctx context.Context, in *GetProductInfoRequest, opts ...grpc.CallOption) (*GetProductInfoResponse, error) {
    out := new(GetProductInfoResponse)
    err := c.cc.Invoke(ctx, ProductService_GetProductInfo_FullMethodName, in, out, opts...)
    err := c.cc.Invoke(ctx, "/productService/GetProductInfo", in, out, opts...)
    if err != nil {
        return nil, err
    }
@@ -50,7 +41,7 @@
func (c *productServiceClient) GetProductList(ctx context.Context, in *GetProductListRequest, opts ...grpc.CallOption) (*GetProductListResponse, error) {
    out := new(GetProductListResponse)
    err := c.cc.Invoke(ctx, ProductService_GetProductList_FullMethodName, in, out, opts...)
    err := c.cc.Invoke(ctx, "/productService/GetProductList", in, out, opts...)
    if err != nil {
        return nil, err
    }
@@ -99,7 +90,7 @@
    }
    info := &grpc.UnaryServerInfo{
        Server:     srv,
        FullMethod: ProductService_GetProductInfo_FullMethodName,
        FullMethod: "/productService/GetProductInfo",
    }
    handler := func(ctx context.Context, req interface{}) (interface{}, error) {
        return srv.(ProductServiceServer).GetProductInfo(ctx, req.(*GetProductInfoRequest))
@@ -117,7 +108,7 @@
    }
    info := &grpc.UnaryServerInfo{
        Server:     srv,
        FullMethod: ProductService_GetProductList_FullMethodName,
        FullMethod: "/productService/GetProductList",
    }
    handler := func(ctx context.Context, req interface{}) (interface{}, error) {
        return srv.(ProductServiceServer).GetProductList(ctx, req.(*GetProductListRequest))