feat: product items info
This commit is contained in:
@@ -8,7 +8,6 @@ package product
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
@@ -34,11 +33,13 @@ const (
|
||||
Product_EditBase_FullMethodName = "/product.Product/EditBase"
|
||||
Product_EditSusceptible_FullMethodName = "/product.Product/EditSusceptible"
|
||||
Product_EditApplyPass_FullMethodName = "/product.Product/EditApplyPass"
|
||||
Product_NumberAdd_FullMethodName = "/product.Product/NumberAdd"
|
||||
Product_ApiItems_FullMethodName = "/product.Product/ApiItems"
|
||||
Product_ApiInfo_FullMethodName = "/product.Product/ApiInfo"
|
||||
Product_Number_FullMethodName = "/product.Product/Number"
|
||||
Product_NumberItems_FullMethodName = "/product.Product/NumberItems"
|
||||
Product_InfoById_FullMethodName = "/product.Product/InfoById"
|
||||
Product_ItemsByIds_FullMethodName = "/product.Product/ItemsByIds"
|
||||
Product_NumberAdd_FullMethodName = "/product.Product/NumberAdd"
|
||||
)
|
||||
|
||||
// ProductClient is the client API for Product service.
|
||||
@@ -65,15 +66,18 @@ type ProductClient interface {
|
||||
EditSusceptible(ctx context.Context, in *EditSusceptibleReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// TODO: 临时接口,企微编辑申请审批对接后删除
|
||||
EditApplyPass(ctx context.Context, in *EditApplyPassReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// 增加库存
|
||||
NumberAdd(ctx context.Context, in *NumberAddReq, opts ...grpc.CallOption) (*Response, error)
|
||||
ApiItems(ctx context.Context, in *ApiItemsReq, opts ...grpc.CallOption) (*Response, error)
|
||||
ApiInfo(ctx context.Context, in *ApiInfoReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// 增减库存
|
||||
// type: 1 增加, 2 减少
|
||||
Number(ctx context.Context, in *NumberReq, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
// 批量增减库存
|
||||
NumberItems(ctx context.Context, in *NumberItemsReq, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
// 获取单个产品详情
|
||||
InfoById(ctx context.Context, in *InfoByIdReq, opts ...grpc.CallOption) (*Item, error)
|
||||
// 获取多个产品详情
|
||||
ItemsByIds(ctx context.Context, in *ItemsByIdsReq, opts ...grpc.CallOption) (*ItemsByIdsData, error)
|
||||
// 增加库存
|
||||
NumberAdd(ctx context.Context, in *NumberAddReq, opts ...grpc.CallOption) (*Response, error)
|
||||
}
|
||||
|
||||
type productClient struct {
|
||||
@@ -214,6 +218,36 @@ func (c *productClient) EditApplyPass(ctx context.Context, in *EditApplyPassReq,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) NumberAdd(ctx context.Context, in *NumberAddReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Product_NumberAdd_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) ApiItems(ctx context.Context, in *ApiItemsReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Product_ApiItems_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) ApiInfo(ctx context.Context, in *ApiInfoReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Product_ApiInfo_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) Number(ctx context.Context, in *NumberReq, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(emptypb.Empty)
|
||||
@@ -254,16 +288,6 @@ func (c *productClient) ItemsByIds(ctx context.Context, in *ItemsByIdsReq, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) NumberAdd(ctx context.Context, in *NumberAddReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Product_NumberAdd_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ProductServer is the server API for Product service.
|
||||
// All implementations must embed UnimplementedProductServer
|
||||
// for forward compatibility.
|
||||
@@ -288,15 +312,18 @@ type ProductServer interface {
|
||||
EditSusceptible(context.Context, *EditSusceptibleReq) (*Response, error)
|
||||
// TODO: 临时接口,企微编辑申请审批对接后删除
|
||||
EditApplyPass(context.Context, *EditApplyPassReq) (*Response, error)
|
||||
// 增减库存
|
||||
// type: 1 增加, 2 减少
|
||||
Number(context.Context, *NumberReq) (*emptypb.Empty, error)
|
||||
// 批量增减库存(服务内按 id 排序后在同一事务中执行,防死锁)
|
||||
NumberItems(context.Context, *NumberItemsReq) (*emptypb.Empty, error)
|
||||
InfoById(context.Context, *InfoByIdReq) (*Item, error)
|
||||
ItemsByIds(context.Context, *ItemsByIdsReq) (*ItemsByIdsData, error)
|
||||
// 增加库存
|
||||
NumberAdd(context.Context, *NumberAddReq) (*Response, error)
|
||||
ApiItems(context.Context, *ApiItemsReq) (*Response, error)
|
||||
ApiInfo(context.Context, *ApiInfoReq) (*Response, error)
|
||||
// 增减库存
|
||||
Number(context.Context, *NumberReq) (*emptypb.Empty, error)
|
||||
// 批量增减库存
|
||||
NumberItems(context.Context, *NumberItemsReq) (*emptypb.Empty, error)
|
||||
// 获取单个产品详情
|
||||
InfoById(context.Context, *InfoByIdReq) (*Item, error)
|
||||
// 获取多个产品详情
|
||||
ItemsByIds(context.Context, *ItemsByIdsReq) (*ItemsByIdsData, error)
|
||||
mustEmbedUnimplementedProductServer()
|
||||
}
|
||||
|
||||
@@ -346,6 +373,15 @@ func (UnimplementedProductServer) EditSusceptible(context.Context, *EditSuscepti
|
||||
func (UnimplementedProductServer) EditApplyPass(context.Context, *EditApplyPassReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method EditApplyPass not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) NumberAdd(context.Context, *NumberAddReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method NumberAdd not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) ApiItems(context.Context, *ApiItemsReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ApiItems not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) ApiInfo(context.Context, *ApiInfoReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ApiInfo not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) Number(context.Context, *NumberReq) (*emptypb.Empty, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Number not implemented")
|
||||
}
|
||||
@@ -358,9 +394,6 @@ func (UnimplementedProductServer) InfoById(context.Context, *InfoByIdReq) (*Item
|
||||
func (UnimplementedProductServer) ItemsByIds(context.Context, *ItemsByIdsReq) (*ItemsByIdsData, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ItemsByIds not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) NumberAdd(context.Context, *NumberAddReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method NumberAdd not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) mustEmbedUnimplementedProductServer() {}
|
||||
func (UnimplementedProductServer) testEmbeddedByValue() {}
|
||||
|
||||
@@ -616,6 +649,60 @@ func _Product_EditApplyPass_Handler(srv interface{}, ctx context.Context, dec fu
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_NumberAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NumberAddReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ProductServer).NumberAdd(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Product_NumberAdd_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ProductServer).NumberAdd(ctx, req.(*NumberAddReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_ApiItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ApiItemsReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ProductServer).ApiItems(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Product_ApiItems_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ProductServer).ApiItems(ctx, req.(*ApiItemsReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_ApiInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ApiInfoReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ProductServer).ApiInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Product_ApiInfo_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ProductServer).ApiInfo(ctx, req.(*ApiInfoReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_Number_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NumberReq)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -688,24 +775,6 @@ func _Product_ItemsByIds_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_NumberAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NumberAddReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ProductServer).NumberAdd(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Product_NumberAdd_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ProductServer).NumberAdd(ctx, req.(*NumberAddReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Product_ServiceDesc is the grpc.ServiceDesc for Product service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -765,6 +834,18 @@ var Product_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "EditApplyPass",
|
||||
Handler: _Product_EditApplyPass_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "NumberAdd",
|
||||
Handler: _Product_NumberAdd_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ApiItems",
|
||||
Handler: _Product_ApiItems_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ApiInfo",
|
||||
Handler: _Product_ApiInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Number",
|
||||
Handler: _Product_Number_Handler,
|
||||
@@ -781,10 +862,6 @@ var Product_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "ItemsByIds",
|
||||
Handler: _Product_ItemsByIds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "NumberAdd",
|
||||
Handler: _Product_NumberAdd_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "product/product.proto",
|
||||
|
||||
Reference in New Issue
Block a user