Merge branch 'develop' of git.ailuowan.com:zzw/lone-services into develop
CI / changes (push) Successful in 5s
CI / docker-bff (push) Successful in 2s
CI / docker-product (push) Has been skipped
CI / docker-admin (push) Successful in 3m47s
CI / docker-user (push) Has been skipped
CI / docker-ad (push) Has been skipped

This commit is contained in:
2026-08-21 15:05:43 +08:00
25 changed files with 1855 additions and 471 deletions
BIN
View File
Binary file not shown.
+85
View File
@@ -0,0 +1,85 @@
syntax = "proto3";
package ad;
option go_package = "lone-services/rpc/ad";
import "google/api/annotations.proto";
service Ad {
// 添加广告
rpc Create(CreateReq) returns (Response) {
option (google.api.http) = {
post: "/admin/v3/ad"
body: "*"
};
}
// 编辑广告
rpc Edit(EditReq) returns (Response) {
option (google.api.http) = {
put: "/admin/v3/ad"
body: "*"
};
}
// 广告列表
rpc Items(ItemsReq) returns (Response) {
option (google.api.http) = {
get: "/admin/v3/ad"
body: "*"
};
}
// 广告状态
rpc Status(StatusReq) returns (Response) {
option (google.api.http) = {
put: "/admin/v3/ad/status"
body: "*"
};
}
}
message Response {
int32 code = 1;
string msg = 2;
string data = 3;
}
message CreateReq {
uint32 type = 1;
string image = 2;
string content = 3;
string url = 4;
}
message EditReq {
int64 id = 1;
uint32 type = 2;
string image = 3;
string content = 4;
string url = 5;
}
message ItemsReq {
uint32 page = 1;
uint32 page_size = 2;
}
message StatusReq {
int64 id = 1;
uint32 status = 2;
string reason = 3;
}
message ItemsData {
int64 count = 1;
repeated Item items = 2;
}
message Item {
int64 id = 1;
uint32 type = 2;
string image = 3;
string content = 4;
string reason = 5;
uint32 status = 6;
string url = 7;
string update_time = 8;
string create_time = 9;
}
+612
View File
@@ -0,0 +1,612 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v3.19.4
// source: ad/ad.proto
package ad
import (
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
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)
)
type Response struct {
state protoimpl.MessageState `protogen:"open.v1"`
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Response) Reset() {
*x = Response{}
mi := &file_ad_ad_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Response) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Response) ProtoMessage() {}
func (x *Response) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Response.ProtoReflect.Descriptor instead.
func (*Response) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{0}
}
func (x *Response) GetCode() int32 {
if x != nil {
return x.Code
}
return 0
}
func (x *Response) GetMsg() string {
if x != nil {
return x.Msg
}
return ""
}
func (x *Response) GetData() string {
if x != nil {
return x.Data
}
return ""
}
// type: 1、商城首页banner 2、商城首页视频 3、商城首页公告 4、商城首页教程
type CreateReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Type uint32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"`
Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"`
Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreateReq) Reset() {
*x = CreateReq{}
mi := &file_ad_ad_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreateReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateReq) ProtoMessage() {}
func (x *CreateReq) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateReq.ProtoReflect.Descriptor instead.
func (*CreateReq) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{1}
}
func (x *CreateReq) GetType() uint32 {
if x != nil {
return x.Type
}
return 0
}
func (x *CreateReq) GetImage() string {
if x != nil {
return x.Image
}
return ""
}
func (x *CreateReq) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *CreateReq) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
type EditReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Type uint32 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"`
Image string `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"`
Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *EditReq) Reset() {
*x = EditReq{}
mi := &file_ad_ad_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *EditReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EditReq) ProtoMessage() {}
func (x *EditReq) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EditReq.ProtoReflect.Descriptor instead.
func (*EditReq) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{2}
}
func (x *EditReq) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *EditReq) GetType() uint32 {
if x != nil {
return x.Type
}
return 0
}
func (x *EditReq) GetImage() string {
if x != nil {
return x.Image
}
return ""
}
func (x *EditReq) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *EditReq) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
type ItemsReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page uint32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ItemsReq) Reset() {
*x = ItemsReq{}
mi := &file_ad_ad_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ItemsReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ItemsReq) ProtoMessage() {}
func (x *ItemsReq) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ItemsReq.ProtoReflect.Descriptor instead.
func (*ItemsReq) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{3}
}
func (x *ItemsReq) GetPage() uint32 {
if x != nil {
return x.Page
}
return 0
}
func (x *ItemsReq) GetPageSize() uint32 {
if x != nil {
return x.PageSize
}
return 0
}
// status: 1 正常, 2 禁用
type StatusReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Status uint32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StatusReq) Reset() {
*x = StatusReq{}
mi := &file_ad_ad_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StatusReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatusReq) ProtoMessage() {}
func (x *StatusReq) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StatusReq.ProtoReflect.Descriptor instead.
func (*StatusReq) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{4}
}
func (x *StatusReq) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *StatusReq) GetStatus() uint32 {
if x != nil {
return x.Status
}
return 0
}
func (x *StatusReq) GetReason() string {
if x != nil {
return x.Reason
}
return ""
}
type ItemsData struct {
state protoimpl.MessageState `protogen:"open.v1"`
Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
Items []*Item `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ItemsData) Reset() {
*x = ItemsData{}
mi := &file_ad_ad_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ItemsData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ItemsData) ProtoMessage() {}
func (x *ItemsData) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ItemsData.ProtoReflect.Descriptor instead.
func (*ItemsData) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{5}
}
func (x *ItemsData) GetCount() int64 {
if x != nil {
return x.Count
}
return 0
}
func (x *ItemsData) GetItems() []*Item {
if x != nil {
return x.Items
}
return nil
}
type Item struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Type uint32 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"`
Image string `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"`
Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
Reason string `protobuf:"bytes,5,opt,name=reason,proto3" json:"reason,omitempty"`
Status uint32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"`
Url string `protobuf:"bytes,7,opt,name=url,proto3" json:"url,omitempty"`
UpdateTime string `protobuf:"bytes,8,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
CreateTime string `protobuf:"bytes,9,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Item) Reset() {
*x = Item{}
mi := &file_ad_ad_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Item) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Item) ProtoMessage() {}
func (x *Item) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Item.ProtoReflect.Descriptor instead.
func (*Item) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{6}
}
func (x *Item) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *Item) GetType() uint32 {
if x != nil {
return x.Type
}
return 0
}
func (x *Item) GetImage() string {
if x != nil {
return x.Image
}
return ""
}
func (x *Item) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *Item) GetReason() string {
if x != nil {
return x.Reason
}
return ""
}
func (x *Item) GetStatus() uint32 {
if x != nil {
return x.Status
}
return 0
}
func (x *Item) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
func (x *Item) GetUpdateTime() string {
if x != nil {
return x.UpdateTime
}
return ""
}
func (x *Item) GetCreateTime() string {
if x != nil {
return x.CreateTime
}
return ""
}
var File_ad_ad_proto protoreflect.FileDescriptor
const file_ad_ad_proto_rawDesc = "" +
"\n" +
"\vad/ad.proto\x12\x02ad\x1a\x1cgoogle/api/annotations.proto\"D\n" +
"\bResponse\x12\x12\n" +
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x10\n" +
"\x03msg\x18\x02 \x01(\tR\x03msg\x12\x12\n" +
"\x04data\x18\x03 \x01(\tR\x04data\"a\n" +
"\tCreateReq\x12\x12\n" +
"\x04type\x18\x01 \x01(\rR\x04type\x12\x14\n" +
"\x05image\x18\x02 \x01(\tR\x05image\x12\x18\n" +
"\acontent\x18\x03 \x01(\tR\acontent\x12\x10\n" +
"\x03url\x18\x04 \x01(\tR\x03url\"o\n" +
"\aEditReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
"\x04type\x18\x02 \x01(\rR\x04type\x12\x14\n" +
"\x05image\x18\x03 \x01(\tR\x05image\x12\x18\n" +
"\acontent\x18\x04 \x01(\tR\acontent\x12\x10\n" +
"\x03url\x18\x05 \x01(\tR\x03url\";\n" +
"\bItemsReq\x12\x12\n" +
"\x04page\x18\x01 \x01(\rR\x04page\x12\x1b\n" +
"\tpage_size\x18\x02 \x01(\rR\bpageSize\"K\n" +
"\tStatusReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" +
"\x06status\x18\x02 \x01(\rR\x06status\x12\x16\n" +
"\x06reason\x18\x03 \x01(\tR\x06reason\"A\n" +
"\tItemsData\x12\x14\n" +
"\x05count\x18\x01 \x01(\x03R\x05count\x12\x1e\n" +
"\x05items\x18\x02 \x03(\v2\b.ad.ItemR\x05items\"\xde\x01\n" +
"\x04Item\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
"\x04type\x18\x02 \x01(\rR\x04type\x12\x14\n" +
"\x05image\x18\x03 \x01(\tR\x05image\x12\x18\n" +
"\acontent\x18\x04 \x01(\tR\acontent\x12\x16\n" +
"\x06reason\x18\x05 \x01(\tR\x06reason\x12\x16\n" +
"\x06status\x18\x06 \x01(\rR\x06status\x12\x10\n" +
"\x03url\x18\a \x01(\tR\x03url\x12\x1f\n" +
"\vupdate_time\x18\b \x01(\tR\n" +
"updateTime\x12\x1f\n" +
"\vcreate_time\x18\t \x01(\tR\n" +
"createTime2\x85\x02\n" +
"\x02Ad\x12>\n" +
"\x06Create\x12\r.ad.CreateReq\x1a\f.ad.Response\"\x17\x82\xd3\xe4\x93\x02\x11:\x01*\"\f/admin/v3/ad\x12:\n" +
"\x04Edit\x12\v.ad.EditReq\x1a\f.ad.Response\"\x17\x82\xd3\xe4\x93\x02\x11:\x01*\x1a\f/admin/v3/ad\x12<\n" +
"\x05Items\x12\f.ad.ItemsReq\x1a\f.ad.Response\"\x17\x82\xd3\xe4\x93\x02\x11:\x01*\x12\f/admin/v3/ad\x12E\n" +
"\x06Status\x12\r.ad.StatusReq\x1a\f.ad.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\x1a\x13/admin/v3/ad/statusB\x16Z\x14lone-services/rpc/adb\x06proto3"
var (
file_ad_ad_proto_rawDescOnce sync.Once
file_ad_ad_proto_rawDescData []byte
)
func file_ad_ad_proto_rawDescGZIP() []byte {
file_ad_ad_proto_rawDescOnce.Do(func() {
file_ad_ad_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ad_ad_proto_rawDesc), len(file_ad_ad_proto_rawDesc)))
})
return file_ad_ad_proto_rawDescData
}
var file_ad_ad_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_ad_ad_proto_goTypes = []any{
(*Response)(nil), // 0: ad.Response
(*CreateReq)(nil), // 1: ad.CreateReq
(*EditReq)(nil), // 2: ad.EditReq
(*ItemsReq)(nil), // 3: ad.ItemsReq
(*StatusReq)(nil), // 4: ad.StatusReq
(*ItemsData)(nil), // 5: ad.ItemsData
(*Item)(nil), // 6: ad.Item
}
var file_ad_ad_proto_depIdxs = []int32{
6, // 0: ad.ItemsData.items:type_name -> ad.Item
1, // 1: ad.Ad.Create:input_type -> ad.CreateReq
2, // 2: ad.Ad.Edit:input_type -> ad.EditReq
3, // 3: ad.Ad.Items:input_type -> ad.ItemsReq
4, // 4: ad.Ad.Status:input_type -> ad.StatusReq
0, // 5: ad.Ad.Create:output_type -> ad.Response
0, // 6: ad.Ad.Edit:output_type -> ad.Response
0, // 7: ad.Ad.Items:output_type -> ad.Response
0, // 8: ad.Ad.Status:output_type -> ad.Response
5, // [5:9] is the sub-list for method output_type
1, // [1:5] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_ad_ad_proto_init() }
func file_ad_ad_proto_init() {
if File_ad_ad_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ad_ad_proto_rawDesc), len(file_ad_ad_proto_rawDesc)),
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ad_ad_proto_goTypes,
DependencyIndexes: file_ad_ad_proto_depIdxs,
MessageInfos: file_ad_ad_proto_msgTypes,
}.Build()
File_ad_ad_proto = out.File
file_ad_ad_proto_goTypes = nil
file_ad_ad_proto_depIdxs = nil
}
+243
View File
@@ -0,0 +1,243 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v3.19.4
// source: ad/ad.proto
package ad
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
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"
)
// AdClient is the client API for Ad service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
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)
}
type adClient struct {
cc grpc.ClientConnInterface
}
func NewAdClient(cc grpc.ClientConnInterface) AdClient {
return &adClient{cc}
}
func (c *adClient) Create(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, Ad_Create_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adClient) Edit(ctx context.Context, in *EditReq, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, Ad_Edit_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adClient) Items(ctx context.Context, in *ItemsReq, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, Ad_Items_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adClient) Status(ctx context.Context, in *StatusReq, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, Ad_Status_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.
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)
mustEmbedUnimplementedAdServer()
}
// UnimplementedAdServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAdServer struct{}
func (UnimplementedAdServer) Create(context.Context, *CreateReq) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedAdServer) Edit(context.Context, *EditReq) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method Edit not implemented")
}
func (UnimplementedAdServer) Items(context.Context, *ItemsReq) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method Items not implemented")
}
func (UnimplementedAdServer) Status(context.Context, *StatusReq) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method Status not implemented")
}
func (UnimplementedAdServer) mustEmbedUnimplementedAdServer() {}
func (UnimplementedAdServer) testEmbeddedByValue() {}
// UnsafeAdServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AdServer will
// result in compilation errors.
type UnsafeAdServer interface {
mustEmbedUnimplementedAdServer()
}
func RegisterAdServer(s grpc.ServiceRegistrar, srv AdServer) {
// If the following call panics, it indicates UnimplementedAdServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Ad_ServiceDesc, srv)
}
func _Ad_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdServer).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Ad_Create_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdServer).Create(ctx, req.(*CreateReq))
}
return interceptor(ctx, in, info, handler)
}
func _Ad_Edit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EditReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdServer).Edit(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Ad_Edit_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdServer).Edit(ctx, req.(*EditReq))
}
return interceptor(ctx, in, info, handler)
}
func _Ad_Items_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ItemsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdServer).Items(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Ad_Items_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdServer).Items(ctx, req.(*ItemsReq))
}
return interceptor(ctx, in, info, handler)
}
func _Ad_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatusReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdServer).Status(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Ad_Status_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdServer).Status(ctx, req.(*StatusReq))
}
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)
var Ad_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ad.Ad",
HandlerType: (*AdServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Create",
Handler: _Ad_Create_Handler,
},
{
MethodName: "Edit",
Handler: _Ad_Edit_Handler,
},
{
MethodName: "Items",
Handler: _Ad_Items_Handler,
},
{
MethodName: "Status",
Handler: _Ad_Status_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ad/ad.proto",
}