feat: sale manager
This commit is contained in:
@@ -8,6 +8,7 @@ package product
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
@@ -34,6 +35,7 @@ const (
|
||||
Product_EditSusceptible_FullMethodName = "/product.Product/EditSusceptible"
|
||||
Product_EditApplyPass_FullMethodName = "/product.Product/EditApplyPass"
|
||||
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"
|
||||
@@ -66,6 +68,8 @@ type ProductClient interface {
|
||||
// 增减库存
|
||||
// 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)
|
||||
// 增加库存
|
||||
@@ -220,6 +224,16 @@ func (c *productClient) Number(ctx context.Context, in *NumberReq, opts ...grpc.
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) NumberItems(ctx context.Context, in *NumberItemsReq, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, Product_NumberItems_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) InfoById(ctx context.Context, in *InfoByIdReq, opts ...grpc.CallOption) (*Item, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Item)
|
||||
@@ -277,6 +291,8 @@ type ProductServer interface {
|
||||
// 增减库存
|
||||
// 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)
|
||||
// 增加库存
|
||||
@@ -333,6 +349,9 @@ func (UnimplementedProductServer) EditApplyPass(context.Context, *EditApplyPassR
|
||||
func (UnimplementedProductServer) Number(context.Context, *NumberReq) (*emptypb.Empty, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Number not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) NumberItems(context.Context, *NumberItemsReq) (*emptypb.Empty, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method NumberItems not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) InfoById(context.Context, *InfoByIdReq) (*Item, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method InfoById not implemented")
|
||||
}
|
||||
@@ -615,6 +634,24 @@ func _Product_Number_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_NumberItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NumberItemsReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ProductServer).NumberItems(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Product_NumberItems_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ProductServer).NumberItems(ctx, req.(*NumberItemsReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_InfoById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(InfoByIdReq)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -732,6 +769,10 @@ var Product_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Number",
|
||||
Handler: _Product_Number_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "NumberItems",
|
||||
Handler: _Product_NumberItems_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "InfoById",
|
||||
Handler: _Product_InfoById_Handler,
|
||||
|
||||
Reference in New Issue
Block a user