feat: ad manager
This commit is contained in:
+46
-6
@@ -19,10 +19,11 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Ad_Create_FullMethodName = "/ad.Ad/Create"
|
||||
Ad_Edit_FullMethodName = "/ad.Ad/Edit"
|
||||
Ad_Items_FullMethodName = "/ad.Ad/Items"
|
||||
Ad_Status_FullMethodName = "/ad.Ad/Status"
|
||||
Ad_Create_FullMethodName = "/ad.Ad/Create"
|
||||
Ad_Edit_FullMethodName = "/ad.Ad/Edit"
|
||||
Ad_Items_FullMethodName = "/ad.Ad/Items"
|
||||
Ad_Status_FullMethodName = "/ad.Ad/Status"
|
||||
Ad_WebItems_FullMethodName = "/ad.Ad/WebItems"
|
||||
)
|
||||
|
||||
// AdClient is the client API for Ad service.
|
||||
@@ -33,10 +34,12 @@ type AdClient interface {
|
||||
Create(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// 编辑广告
|
||||
Edit(ctx context.Context, in *EditReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// 广告列表
|
||||
// 广告列表(后台)
|
||||
Items(ctx context.Context, in *ItemsReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// 广告状态
|
||||
Status(ctx context.Context, in *StatusReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// 广告列表(C 端)
|
||||
WebItems(ctx context.Context, in *WebItemsReq, opts ...grpc.CallOption) (*Response, error)
|
||||
}
|
||||
|
||||
type adClient struct {
|
||||
@@ -87,6 +90,16 @@ func (c *adClient) Status(ctx context.Context, in *StatusReq, opts ...grpc.CallO
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *adClient) WebItems(ctx context.Context, in *WebItemsReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Ad_WebItems_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// AdServer is the server API for Ad service.
|
||||
// All implementations must embed UnimplementedAdServer
|
||||
// for forward compatibility.
|
||||
@@ -95,10 +108,12 @@ type AdServer interface {
|
||||
Create(context.Context, *CreateReq) (*Response, error)
|
||||
// 编辑广告
|
||||
Edit(context.Context, *EditReq) (*Response, error)
|
||||
// 广告列表
|
||||
// 广告列表(后台)
|
||||
Items(context.Context, *ItemsReq) (*Response, error)
|
||||
// 广告状态
|
||||
Status(context.Context, *StatusReq) (*Response, error)
|
||||
// 广告列表(C 端)
|
||||
WebItems(context.Context, *WebItemsReq) (*Response, error)
|
||||
mustEmbedUnimplementedAdServer()
|
||||
}
|
||||
|
||||
@@ -121,6 +136,9 @@ func (UnimplementedAdServer) Items(context.Context, *ItemsReq) (*Response, error
|
||||
func (UnimplementedAdServer) Status(context.Context, *StatusReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Status not implemented")
|
||||
}
|
||||
func (UnimplementedAdServer) WebItems(context.Context, *WebItemsReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method WebItems not implemented")
|
||||
}
|
||||
func (UnimplementedAdServer) mustEmbedUnimplementedAdServer() {}
|
||||
func (UnimplementedAdServer) testEmbeddedByValue() {}
|
||||
|
||||
@@ -214,6 +232,24 @@ func _Ad_Status_Handler(srv interface{}, ctx context.Context, dec func(interface
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ad_WebItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(WebItemsReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdServer).WebItems(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Ad_WebItems_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AdServer).WebItems(ctx, req.(*WebItemsReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Ad_ServiceDesc is the grpc.ServiceDesc for Ad service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -237,6 +273,10 @@ var Ad_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Status",
|
||||
Handler: _Ad_Status_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "WebItems",
|
||||
Handler: _Ad_WebItems_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "ad/ad.proto",
|
||||
|
||||
Reference in New Issue
Block a user