Merge branch 'develop' of git.ailuowan.com:zzw/lone-services into develop
CI / changes (push) Successful in 13s
CI / docker-bff (push) Successful in 3m18s
CI / docker-product (push) Successful in 3m37s
CI / docker-admin (push) Successful in 3m37s
CI / docker-user (push) Successful in 3m33s
CI / docker-ad (push) Successful in 3m34s

This commit is contained in:
2026-08-24 10:06:59 +08:00
34 changed files with 454 additions and 300 deletions
BIN
View File
Binary file not shown.
+19 -4
View File
@@ -5,34 +5,36 @@ 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: "*"
};
}
rpc WebItems(WebItemsReq) returns (Response) {
option (google.api.http) = {
get: "/api/v3/ad"
body: "*"
};
}
}
message Response {
@@ -61,6 +63,11 @@ message ItemsReq {
uint32 page_size = 2;
}
// type: 逗号分隔,如 "1,2,3"
message WebItemsReq {
string type = 1;
}
message StatusReq {
int64 id = 1;
uint32 status = 2;
@@ -83,3 +90,11 @@ message Item {
string update_time = 8;
string create_time = 9;
}
message WebItem {
int64 id = 1;
uint32 type = 2;
string image = 3;
string content = 4;
string url = 5;
}
+164 -31
View File
@@ -82,7 +82,6 @@ func (x *Response) GetData() string {
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"`
@@ -279,7 +278,51 @@ func (x *ItemsReq) GetPageSize() uint32 {
return 0
}
// status: 1 正常, 2 禁用
// type: 逗号分隔,如 "1,2,3"
type WebItemsReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *WebItemsReq) Reset() {
*x = WebItemsReq{}
mi := &file_ad_ad_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *WebItemsReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WebItemsReq) ProtoMessage() {}
func (x *WebItemsReq) 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 WebItemsReq.ProtoReflect.Descriptor instead.
func (*WebItemsReq) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{4}
}
func (x *WebItemsReq) GetType() string {
if x != nil {
return x.Type
}
return ""
}
type StatusReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
@@ -291,7 +334,7 @@ type StatusReq struct {
func (x *StatusReq) Reset() {
*x = StatusReq{}
mi := &file_ad_ad_proto_msgTypes[4]
mi := &file_ad_ad_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -303,7 +346,7 @@ func (x *StatusReq) String() string {
func (*StatusReq) ProtoMessage() {}
func (x *StatusReq) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[4]
mi := &file_ad_ad_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -316,7 +359,7 @@ func (x *StatusReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use StatusReq.ProtoReflect.Descriptor instead.
func (*StatusReq) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{4}
return file_ad_ad_proto_rawDescGZIP(), []int{5}
}
func (x *StatusReq) GetId() int64 {
@@ -350,7 +393,7 @@ type ItemsData struct {
func (x *ItemsData) Reset() {
*x = ItemsData{}
mi := &file_ad_ad_proto_msgTypes[5]
mi := &file_ad_ad_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -362,7 +405,7 @@ func (x *ItemsData) String() string {
func (*ItemsData) ProtoMessage() {}
func (x *ItemsData) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[5]
mi := &file_ad_ad_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -375,7 +418,7 @@ func (x *ItemsData) ProtoReflect() protoreflect.Message {
// Deprecated: Use ItemsData.ProtoReflect.Descriptor instead.
func (*ItemsData) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{5}
return file_ad_ad_proto_rawDescGZIP(), []int{6}
}
func (x *ItemsData) GetCount() int64 {
@@ -409,7 +452,7 @@ type Item struct {
func (x *Item) Reset() {
*x = Item{}
mi := &file_ad_ad_proto_msgTypes[6]
mi := &file_ad_ad_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -421,7 +464,7 @@ func (x *Item) String() string {
func (*Item) ProtoMessage() {}
func (x *Item) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[6]
mi := &file_ad_ad_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -434,7 +477,7 @@ func (x *Item) ProtoReflect() protoreflect.Message {
// Deprecated: Use Item.ProtoReflect.Descriptor instead.
func (*Item) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{6}
return file_ad_ad_proto_rawDescGZIP(), []int{7}
}
func (x *Item) GetId() int64 {
@@ -500,6 +543,82 @@ func (x *Item) GetCreateTime() string {
return ""
}
type WebItem 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 *WebItem) Reset() {
*x = WebItem{}
mi := &file_ad_ad_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *WebItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WebItem) ProtoMessage() {}
func (x *WebItem) ProtoReflect() protoreflect.Message {
mi := &file_ad_ad_proto_msgTypes[8]
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 WebItem.ProtoReflect.Descriptor instead.
func (*WebItem) Descriptor() ([]byte, []int) {
return file_ad_ad_proto_rawDescGZIP(), []int{8}
}
func (x *WebItem) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *WebItem) GetType() uint32 {
if x != nil {
return x.Type
}
return 0
}
func (x *WebItem) GetImage() string {
if x != nil {
return x.Image
}
return ""
}
func (x *WebItem) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *WebItem) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
var File_ad_ad_proto protoreflect.FileDescriptor
const file_ad_ad_proto_rawDesc = "" +
@@ -522,7 +641,9 @@ const file_ad_ad_proto_rawDesc = "" +
"\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" +
"\tpage_size\x18\x02 \x01(\rR\bpageSize\"!\n" +
"\vWebItemsReq\x12\x12\n" +
"\x04type\x18\x01 \x01(\tR\x04type\"K\n" +
"\tStatusReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" +
"\x06status\x18\x02 \x01(\rR\x06status\x12\x16\n" +
@@ -541,12 +662,20 @@ const file_ad_ad_proto_rawDesc = "" +
"\vupdate_time\x18\b \x01(\tR\n" +
"updateTime\x12\x1f\n" +
"\vcreate_time\x18\t \x01(\tR\n" +
"createTime2\x85\x02\n" +
"createTime\"o\n" +
"\aWebItem\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\x03url2\xc7\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"
"\x06Status\x12\r.ad.StatusReq\x1a\f.ad.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\x1a\x13/admin/v3/ad/status\x12@\n" +
"\bWebItems\x12\x0f.ad.WebItemsReq\x1a\f.ad.Response\"\x15\x82\xd3\xe4\x93\x02\x0f:\x01*\x12\n" +
"/api/v3/adB\x16Z\x14lone-services/rpc/adb\x06proto3"
var (
file_ad_ad_proto_rawDescOnce sync.Once
@@ -560,28 +689,32 @@ func file_ad_ad_proto_rawDescGZIP() []byte {
return file_ad_ad_proto_rawDescData
}
var file_ad_ad_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_ad_ad_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
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
(*Response)(nil), // 0: ad.Response
(*CreateReq)(nil), // 1: ad.CreateReq
(*EditReq)(nil), // 2: ad.EditReq
(*ItemsReq)(nil), // 3: ad.ItemsReq
(*WebItemsReq)(nil), // 4: ad.WebItemsReq
(*StatusReq)(nil), // 5: ad.StatusReq
(*ItemsData)(nil), // 6: ad.ItemsData
(*Item)(nil), // 7: ad.Item
(*WebItem)(nil), // 8: ad.WebItem
}
var file_ad_ad_proto_depIdxs = []int32{
6, // 0: ad.ItemsData.items:type_name -> ad.Item
7, // 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
5, // 4: ad.Ad.Status:input_type -> ad.StatusReq
4, // 5: ad.Ad.WebItems:input_type -> ad.WebItemsReq
0, // 6: ad.Ad.Create:output_type -> ad.Response
0, // 7: ad.Ad.Edit:output_type -> ad.Response
0, // 8: ad.Ad.Items:output_type -> ad.Response
0, // 9: ad.Ad.Status:output_type -> ad.Response
0, // 10: ad.Ad.WebItems:output_type -> ad.Response
6, // [6:11] is the sub-list for method output_type
1, // [1:6] 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
@@ -598,7 +731,7 @@ func file_ad_ad_proto_init() {
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,
NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
+46 -6
View File
@@ -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",