This commit is contained in:
xiabin 2025-02-14 17:30:53 +08:00
parent 3ff637c478
commit c679ea79af
17 changed files with 541 additions and 550 deletions

View File

@ -1,299 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.4
// protoc v3.19.4
// source: ecpm.proto
package ecpm
import (
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 Request struct {
state protoimpl.MessageState `protogen:"open.v1"`
Ping string `protobuf:"bytes,1,opt,name=ping,proto3" json:"ping,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Request) Reset() {
*x = Request{}
mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Request) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Request) ProtoMessage() {}
func (x *Request) ProtoReflect() protoreflect.Message {
mi := &file_douyin_ecpm_calculation_service_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 Request.ProtoReflect.Descriptor instead.
func (*Request) Descriptor() ([]byte, []int) {
return file_douyin_ecpm_calculation_service_proto_rawDescGZIP(), []int{0}
}
func (x *Request) GetPing() string {
if x != nil {
return x.Ping
}
return ""
}
type Response struct {
state protoimpl.MessageState `protogen:"open.v1"`
Pong string `protobuf:"bytes,1,opt,name=pong,proto3" json:"pong,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Response) Reset() {
*x = Response{}
mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[1]
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_douyin_ecpm_calculation_service_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 Response.ProtoReflect.Descriptor instead.
func (*Response) Descriptor() ([]byte, []int) {
return file_douyin_ecpm_calculation_service_proto_rawDescGZIP(), []int{1}
}
func (x *Response) GetPong() string {
if x != nil {
return x.Pong
}
return ""
}
type GetEcpmRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
AppId string `protobuf:"bytes,1,opt,name=appId,proto3" json:"appId,omitempty"`
OpenId string `protobuf:"bytes,2,opt,name=openId,proto3" json:"openId,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetEcpmRequest) Reset() {
*x = GetEcpmRequest{}
mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetEcpmRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetEcpmRequest) ProtoMessage() {}
func (x *GetEcpmRequest) ProtoReflect() protoreflect.Message {
mi := &file_douyin_ecpm_calculation_service_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 GetEcpmRequest.ProtoReflect.Descriptor instead.
func (*GetEcpmRequest) Descriptor() ([]byte, []int) {
return file_douyin_ecpm_calculation_service_proto_rawDescGZIP(), []int{2}
}
func (x *GetEcpmRequest) GetAppId() string {
if x != nil {
return x.AppId
}
return ""
}
func (x *GetEcpmRequest) GetOpenId() string {
if x != nil {
return x.OpenId
}
return ""
}
type GetEcpmResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetEcpmResponse) Reset() {
*x = GetEcpmResponse{}
mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetEcpmResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetEcpmResponse) ProtoMessage() {}
func (x *GetEcpmResponse) ProtoReflect() protoreflect.Message {
mi := &file_douyin_ecpm_calculation_service_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 GetEcpmResponse.ProtoReflect.Descriptor instead.
func (*GetEcpmResponse) Descriptor() ([]byte, []int) {
return file_douyin_ecpm_calculation_service_proto_rawDescGZIP(), []int{3}
}
func (x *GetEcpmResponse) GetOk() bool {
if x != nil {
return x.Ok
}
return false
}
var File_douyin_ecpm_calculation_service_proto protoreflect.FileDescriptor
var file_douyin_ecpm_calculation_service_proto_rawDesc = string([]byte{
0x0a, 0x25, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61,
0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1f, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f,
0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x1d, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x22, 0x3e, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x63,
0x70, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12,
0x16, 0x0a, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x22, 0x21, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x45, 0x63,
0x70, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b,
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x32, 0xec, 0x01, 0x0a, 0x1f, 0x64,
0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75,
0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5b,
0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f,
0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x29, 0x2e, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63,
0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6c, 0x0a, 0x07, 0x47,
0x65, 0x74, 0x45, 0x63, 0x70, 0x6d, 0x12, 0x2f, 0x2e, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f,
0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x63, 0x70, 0x6d,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e,
0x5f, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x63, 0x70,
0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x23, 0x5a, 0x21, 0x2e, 0x2f, 0x64,
0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75,
0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
})
var (
file_douyin_ecpm_calculation_service_proto_rawDescOnce sync.Once
file_douyin_ecpm_calculation_service_proto_rawDescData []byte
)
func file_douyin_ecpm_calculation_service_proto_rawDescGZIP() []byte {
file_douyin_ecpm_calculation_service_proto_rawDescOnce.Do(func() {
file_douyin_ecpm_calculation_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_douyin_ecpm_calculation_service_proto_rawDesc), len(file_douyin_ecpm_calculation_service_proto_rawDesc)))
})
return file_douyin_ecpm_calculation_service_proto_rawDescData
}
var file_douyin_ecpm_calculation_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_douyin_ecpm_calculation_service_proto_goTypes = []any{
(*Request)(nil), // 0: ecpm.Request
(*Response)(nil), // 1: ecpm.Response
(*GetEcpmRequest)(nil), // 2: ecpm.GetEcpmRequest
(*GetEcpmResponse)(nil), // 3: ecpm.GetEcpmResponse
}
var file_douyin_ecpm_calculation_service_proto_depIdxs = []int32{
0, // 0: ecpm.ecpm.Ping:input_type -> ecpm.Request
2, // 1: ecpm.ecpm.GetEcpm:input_type -> ecpm.GetEcpmRequest
1, // 2: ecpm.ecpm.Ping:output_type -> ecpm.Response
3, // 3: ecpm.ecpm.GetEcpm:output_type -> ecpm.GetEcpmResponse
2, // [2:4] is the sub-list for method output_type
0, // [0:2] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_douyin_ecpm_calculation_service_proto_init() }
func file_douyin_ecpm_calculation_service_proto_init() {
if File_douyin_ecpm_calculation_service_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_douyin_ecpm_calculation_service_proto_rawDesc), len(file_douyin_ecpm_calculation_service_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_douyin_ecpm_calculation_service_proto_goTypes,
DependencyIndexes: file_douyin_ecpm_calculation_service_proto_depIdxs,
MessageInfos: file_douyin_ecpm_calculation_service_proto_msgTypes,
}.Build()
File_douyin_ecpm_calculation_service_proto = out.File
file_douyin_ecpm_calculation_service_proto_goTypes = nil
file_douyin_ecpm_calculation_service_proto_depIdxs = nil
}

View File

@ -1,160 +0,0 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.19.4
// source: ecpm.proto
package ecpm
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 (
DouyinEcpmCalculationService_Ping_FullMethodName = "/ecpm.ecpm/Ping"
DouyinEcpmCalculationService_GetEcpm_FullMethodName = "/ecpm.ecpm/GetEcpm"
)
// DouyinEcpmCalculationServiceClient is the client API for DouyinEcpmCalculationService 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 DouyinEcpmCalculationServiceClient interface {
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error)
}
type douyinEcpmCalculationServiceClient struct {
cc grpc.ClientConnInterface
}
func NewDouyinEcpmCalculationServiceClient(cc grpc.ClientConnInterface) DouyinEcpmCalculationServiceClient {
return &douyinEcpmCalculationServiceClient{cc}
}
func (c *douyinEcpmCalculationServiceClient) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, DouyinEcpmCalculationService_Ping_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *douyinEcpmCalculationServiceClient) GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetEcpmResponse)
err := c.cc.Invoke(ctx, DouyinEcpmCalculationService_GetEcpm_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// DouyinEcpmCalculationServiceServer is the server API for DouyinEcpmCalculationService service.
// All implementations must embed UnimplementedDouyinEcpmCalculationServiceServer
// for forward compatibility.
type DouyinEcpmCalculationServiceServer interface {
Ping(context.Context, *Request) (*Response, error)
GetEcpm(context.Context, *GetEcpmRequest) (*GetEcpmResponse, error)
mustEmbedUnimplementedDouyinEcpmCalculationServiceServer()
}
// UnimplementedDouyinEcpmCalculationServiceServer 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 UnimplementedDouyinEcpmCalculationServiceServer struct{}
func (UnimplementedDouyinEcpmCalculationServiceServer) Ping(context.Context, *Request) (*Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedDouyinEcpmCalculationServiceServer) GetEcpm(context.Context, *GetEcpmRequest) (*GetEcpmResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetEcpm not implemented")
}
func (UnimplementedDouyinEcpmCalculationServiceServer) mustEmbedUnimplementedDouyinEcpmCalculationServiceServer() {
}
func (UnimplementedDouyinEcpmCalculationServiceServer) testEmbeddedByValue() {}
// UnsafeDouyinEcpmCalculationServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DouyinEcpmCalculationServiceServer will
// result in compilation errors.
type UnsafeDouyinEcpmCalculationServiceServer interface {
mustEmbedUnimplementedDouyinEcpmCalculationServiceServer()
}
func RegisterDouyinEcpmCalculationServiceServer(s grpc.ServiceRegistrar, srv DouyinEcpmCalculationServiceServer) {
// If the following call pancis, it indicates UnimplementedDouyinEcpmCalculationServiceServer 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(&DouyinEcpmCalculationService_ServiceDesc, srv)
}
func _DouyinEcpmCalculationService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Request)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DouyinEcpmCalculationServiceServer).Ping(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: DouyinEcpmCalculationService_Ping_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DouyinEcpmCalculationServiceServer).Ping(ctx, req.(*Request))
}
return interceptor(ctx, in, info, handler)
}
func _DouyinEcpmCalculationService_GetEcpm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetEcpmRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DouyinEcpmCalculationServiceServer).GetEcpm(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: DouyinEcpmCalculationService_GetEcpm_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DouyinEcpmCalculationServiceServer).GetEcpm(ctx, req.(*GetEcpmRequest))
}
return interceptor(ctx, in, info, handler)
}
// DouyinEcpmCalculationService_ServiceDesc is the grpc.ServiceDesc for DouyinEcpmCalculationService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var DouyinEcpmCalculationService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ecpm.ecpm",
HandlerType: (*DouyinEcpmCalculationServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Ping",
Handler: _DouyinEcpmCalculationService_Ping_Handler,
},
{
MethodName: "GetEcpm",
Handler: _DouyinEcpmCalculationService_GetEcpm_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ecpm.proto",
}

View File

@ -1,45 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.6
// Source: ecpm.proto
package ecpm_client
import (
"context"
douyin_ecpm_calculation_service2 "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/ecpm"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
)
type (
GetEcpmRequest = douyin_ecpm_calculation_service2.GetEcpmRequest
GetEcpmResponse = douyin_ecpm_calculation_service2.GetEcpmResponse
Request = douyin_ecpm_calculation_service2.Request
Response = douyin_ecpm_calculation_service2.Response
DouyinEcpmCalculationService interface {
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error)
}
defaultDouyinEcpmCalculationService struct {
cli zrpc.Client
}
)
func NewDouyinEcpmCalculationService(cli zrpc.Client) DouyinEcpmCalculationService {
return &defaultDouyinEcpmCalculationService{
cli: cli,
}
}
func (m *defaultDouyinEcpmCalculationService) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
client := douyin_ecpm_calculation_service2.NewDouyinEcpmCalculationServiceClient(m.cli.Conn())
return client.Ping(ctx, in, opts...)
}
func (m *defaultDouyinEcpmCalculationService) GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error) {
client := douyin_ecpm_calculation_service2.NewDouyinEcpmCalculationServiceClient(m.cli.Conn())
return client.GetEcpm(ctx, in, opts...)
}

View File

@ -1,33 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.6
// Source: ecpm.proto
package server
import (
"context"
douyin_ecpm_calculation_service2 "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/ecpm"
logic2 "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/internal/logic"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/internal/svc"
)
type DouyinEcpmCalculationServiceServer struct {
svcCtx *svc.ServiceContext
douyin_ecpm_calculation_service2.UnimplementedDouyinEcpmCalculationServiceServer
}
func NewDouyinEcpmCalculationServiceServer(svcCtx *svc.ServiceContext) *DouyinEcpmCalculationServiceServer {
return &DouyinEcpmCalculationServiceServer{
svcCtx: svcCtx,
}
}
func (s *DouyinEcpmCalculationServiceServer) Ping(ctx context.Context, in *douyin_ecpm_calculation_service2.Request) (*douyin_ecpm_calculation_service2.Response, error) {
l := logic2.NewPingLogic(ctx, s.svcCtx)
return l.Ping(in)
}
func (s *DouyinEcpmCalculationServiceServer) GetEcpm(ctx context.Context, in *douyin_ecpm_calculation_service2.GetEcpmRequest) (*douyin_ecpm_calculation_service2.GetEcpmResponse, error) {
l := logic2.NewGetEcpmLogic(ctx, s.svcCtx)
return l.GetEcpm(in)
}

View File

@ -0,0 +1,289 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.4
// protoc v3.19.4
// source: ecpm_service.proto
package ecpm
import (
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 Request struct {
state protoimpl.MessageState `protogen:"open.v1"`
Ping string `protobuf:"bytes,1,opt,name=ping,proto3" json:"ping,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Request) Reset() {
*x = Request{}
mi := &file_ecpm_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Request) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Request) ProtoMessage() {}
func (x *Request) ProtoReflect() protoreflect.Message {
mi := &file_ecpm_service_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 Request.ProtoReflect.Descriptor instead.
func (*Request) Descriptor() ([]byte, []int) {
return file_ecpm_service_proto_rawDescGZIP(), []int{0}
}
func (x *Request) GetPing() string {
if x != nil {
return x.Ping
}
return ""
}
type Response struct {
state protoimpl.MessageState `protogen:"open.v1"`
Pong string `protobuf:"bytes,1,opt,name=pong,proto3" json:"pong,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Response) Reset() {
*x = Response{}
mi := &file_ecpm_service_proto_msgTypes[1]
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_ecpm_service_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 Response.ProtoReflect.Descriptor instead.
func (*Response) Descriptor() ([]byte, []int) {
return file_ecpm_service_proto_rawDescGZIP(), []int{1}
}
func (x *Response) GetPong() string {
if x != nil {
return x.Pong
}
return ""
}
type GetEcpmRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
AppId string `protobuf:"bytes,1,opt,name=appId,proto3" json:"appId,omitempty"`
OpenId string `protobuf:"bytes,2,opt,name=openId,proto3" json:"openId,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetEcpmRequest) Reset() {
*x = GetEcpmRequest{}
mi := &file_ecpm_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetEcpmRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetEcpmRequest) ProtoMessage() {}
func (x *GetEcpmRequest) ProtoReflect() protoreflect.Message {
mi := &file_ecpm_service_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 GetEcpmRequest.ProtoReflect.Descriptor instead.
func (*GetEcpmRequest) Descriptor() ([]byte, []int) {
return file_ecpm_service_proto_rawDescGZIP(), []int{2}
}
func (x *GetEcpmRequest) GetAppId() string {
if x != nil {
return x.AppId
}
return ""
}
func (x *GetEcpmRequest) GetOpenId() string {
if x != nil {
return x.OpenId
}
return ""
}
type GetEcpmResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetEcpmResponse) Reset() {
*x = GetEcpmResponse{}
mi := &file_ecpm_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetEcpmResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetEcpmResponse) ProtoMessage() {}
func (x *GetEcpmResponse) ProtoReflect() protoreflect.Message {
mi := &file_ecpm_service_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 GetEcpmResponse.ProtoReflect.Descriptor instead.
func (*GetEcpmResponse) Descriptor() ([]byte, []int) {
return file_ecpm_service_proto_rawDescGZIP(), []int{3}
}
func (x *GetEcpmResponse) GetOk() bool {
if x != nil {
return x.Ok
}
return false
}
var File_ecpm_service_proto protoreflect.FileDescriptor
var file_ecpm_service_proto_rawDesc = string([]byte{
0x0a, 0x12, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x22, 0x1d, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a,
0x04, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x69, 0x6e,
0x67, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a,
0x04, 0x70, 0x6f, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x6f, 0x6e,
0x67, 0x22, 0x3e, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x63, 0x70, 0x6d, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x70, 0x65,
0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49,
0x64, 0x22, 0x21, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x45, 0x63, 0x70, 0x6d, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
0x52, 0x02, 0x6f, 0x6b, 0x32, 0x8d, 0x01, 0x0a, 0x0c, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x73, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e,
0x65, 0x63, 0x70, 0x6d, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x07,
0x47, 0x65, 0x74, 0x45, 0x63, 0x70, 0x6d, 0x12, 0x1c, 0x2e, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x63, 0x70, 0x6d, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x73, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x63, 0x70, 0x6d, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x65, 0x63, 0x70, 0x6d, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
})
var (
file_ecpm_service_proto_rawDescOnce sync.Once
file_ecpm_service_proto_rawDescData []byte
)
func file_ecpm_service_proto_rawDescGZIP() []byte {
file_ecpm_service_proto_rawDescOnce.Do(func() {
file_ecpm_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ecpm_service_proto_rawDesc), len(file_ecpm_service_proto_rawDesc)))
})
return file_ecpm_service_proto_rawDescData
}
var file_ecpm_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_ecpm_service_proto_goTypes = []any{
(*Request)(nil), // 0: ecpm_service.Request
(*Response)(nil), // 1: ecpm_service.Response
(*GetEcpmRequest)(nil), // 2: ecpm_service.GetEcpmRequest
(*GetEcpmResponse)(nil), // 3: ecpm_service.GetEcpmResponse
}
var file_ecpm_service_proto_depIdxs = []int32{
0, // 0: ecpm_service.ecpm_service.Ping:input_type -> ecpm_service.Request
2, // 1: ecpm_service.ecpm_service.GetEcpm:input_type -> ecpm_service.GetEcpmRequest
1, // 2: ecpm_service.ecpm_service.Ping:output_type -> ecpm_service.Response
3, // 3: ecpm_service.ecpm_service.GetEcpm:output_type -> ecpm_service.GetEcpmResponse
2, // [2:4] is the sub-list for method output_type
0, // [0:2] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_ecpm_service_proto_init() }
func file_ecpm_service_proto_init() {
if File_ecpm_service_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ecpm_service_proto_rawDesc), len(file_ecpm_service_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ecpm_service_proto_goTypes,
DependencyIndexes: file_ecpm_service_proto_depIdxs,
MessageInfos: file_ecpm_service_proto_msgTypes,
}.Build()
File_ecpm_service_proto = out.File
file_ecpm_service_proto_goTypes = nil
file_ecpm_service_proto_depIdxs = nil
}

View File

@ -0,0 +1,159 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.19.4
// source: ecpm_service.proto
package ecpm
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 (
EcpmService_Ping_FullMethodName = "/ecpm_service.ecpm_service/Ping"
EcpmService_GetEcpm_FullMethodName = "/ecpm_service.ecpm_service/GetEcpm"
)
// EcpmServiceClient is the client API for EcpmService 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 EcpmServiceClient interface {
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error)
}
type ecpmServiceClient struct {
cc grpc.ClientConnInterface
}
func NewEcpmServiceClient(cc grpc.ClientConnInterface) EcpmServiceClient {
return &ecpmServiceClient{cc}
}
func (c *ecpmServiceClient) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, EcpmService_Ping_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ecpmServiceClient) GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetEcpmResponse)
err := c.cc.Invoke(ctx, EcpmService_GetEcpm_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// EcpmServiceServer is the server API for EcpmService service.
// All implementations must embed UnimplementedEcpmServiceServer
// for forward compatibility.
type EcpmServiceServer interface {
Ping(context.Context, *Request) (*Response, error)
GetEcpm(context.Context, *GetEcpmRequest) (*GetEcpmResponse, error)
mustEmbedUnimplementedEcpmServiceServer()
}
// UnimplementedEcpmServiceServer 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 UnimplementedEcpmServiceServer struct{}
func (UnimplementedEcpmServiceServer) Ping(context.Context, *Request) (*Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedEcpmServiceServer) GetEcpm(context.Context, *GetEcpmRequest) (*GetEcpmResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetEcpm not implemented")
}
func (UnimplementedEcpmServiceServer) mustEmbedUnimplementedEcpmServiceServer() {}
func (UnimplementedEcpmServiceServer) testEmbeddedByValue() {}
// UnsafeEcpmServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to EcpmServiceServer will
// result in compilation errors.
type UnsafeEcpmServiceServer interface {
mustEmbedUnimplementedEcpmServiceServer()
}
func RegisterEcpmServiceServer(s grpc.ServiceRegistrar, srv EcpmServiceServer) {
// If the following call pancis, it indicates UnimplementedEcpmServiceServer 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(&EcpmService_ServiceDesc, srv)
}
func _EcpmService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Request)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EcpmServiceServer).Ping(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EcpmService_Ping_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EcpmServiceServer).Ping(ctx, req.(*Request))
}
return interceptor(ctx, in, info, handler)
}
func _EcpmService_GetEcpm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetEcpmRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EcpmServiceServer).GetEcpm(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EcpmService_GetEcpm_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EcpmServiceServer).GetEcpm(ctx, req.(*GetEcpmRequest))
}
return interceptor(ctx, in, info, handler)
}
// EcpmService_ServiceDesc is the grpc.ServiceDesc for EcpmService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var EcpmService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ecpm_service.ecpm_service",
HandlerType: (*EcpmServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Ping",
Handler: _EcpmService_Ping_Handler,
},
{
MethodName: "GetEcpm",
Handler: _EcpmService_GetEcpm_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ecpm_service.proto",
}

View File

@ -3,9 +3,9 @@ package main
import (
"flag"
"fmt"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/ecpm"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/internal/server"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/internal/svc"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/ecpm"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/internal/server"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/internal/svc"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config"
"github.com/zeromicro/go-zero/core/service"
@ -29,7 +29,7 @@ func main() {
ctx := svc.NewServiceContext(c)
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
ecpm.RegisterDouyinEcpmCalculationServiceServer(grpcServer, server.NewDouyinEcpmCalculationServiceServer(ctx))
ecpm.RegisterEcpmServiceServer(grpcServer, server.NewEcpmServiceServer(ctx))
if c.Mode == service.DevMode || c.Mode == service.TestMode {
reflection.Register(grpcServer)

View File

@ -1,6 +1,6 @@
syntax = "proto3";
package douyin_ecpm_calculation_service;
package ecpm_service;
option go_package="./ecpm";
message Request {
@ -20,7 +20,7 @@ message GetEcpmResponse{
bool ok =1;
}
service douyin_ecpm_calculation_service {
service ecpm_service {
rpc Ping(Request) returns(Response);

View File

@ -0,0 +1,46 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.6
// Source: ecpm_service.proto
package ecpmservice
import (
"context"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/ecpm"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
)
type (
GetEcpmRequest = ecpm.GetEcpmRequest
GetEcpmResponse = ecpm.GetEcpmResponse
Request = ecpm.Request
Response = ecpm.Response
EcpmService interface {
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error)
}
defaultEcpmService struct {
cli zrpc.Client
}
)
func NewEcpmService(cli zrpc.Client) EcpmService {
return &defaultEcpmService{
cli: cli,
}
}
func (m *defaultEcpmService) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
client := ecpm.NewEcpmServiceClient(m.cli.Conn())
return client.Ping(ctx, in, opts...)
}
func (m *defaultEcpmService) GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error) {
client := ecpm.NewEcpmServiceClient(m.cli.Conn())
return client.GetEcpm(ctx, in, opts...)
}

View File

@ -6,8 +6,8 @@ import (
"errors"
"fmt"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/auth"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/ecpm"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/internal/svc"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/ecpm"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/internal/svc"
"io"
"net/http"
"strconv"

View File

@ -2,8 +2,8 @@ package logic
import (
"context"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/ecpm"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm/internal/svc"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/ecpm"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
)

View File

@ -0,0 +1,34 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.6
// Source: ecpm_service.proto
package server
import (
"context"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/ecpm"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/internal/logic"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ecpm_service/internal/svc"
)
type EcpmServiceServer struct {
svcCtx *svc.ServiceContext
ecpm.UnimplementedEcpmServiceServer
}
func NewEcpmServiceServer(svcCtx *svc.ServiceContext) *EcpmServiceServer {
return &EcpmServiceServer{
svcCtx: svcCtx,
}
}
func (s *EcpmServiceServer) Ping(ctx context.Context, in *ecpm.Request) (*ecpm.Response, error) {
l := logic.NewPingLogic(ctx, s.svcCtx)
return l.Ping(in)
}
func (s *EcpmServiceServer) GetEcpm(ctx context.Context, in *ecpm.GetEcpmRequest) (*ecpm.GetEcpmResponse, error) {
l := logic.NewGetEcpmLogic(ctx, s.svcCtx)
return l.GetEcpm(in)
}

View File

@ -76,11 +76,11 @@ func (svc *ServiceContext) initAuthServiceClient() {
if err != nil {
panic(err)
}
clientConf.Token = "auth.rpc.key"
clientConf.App = "auth.rpc"
clientConf.Token = "auth_service.rpc.key"
clientConf.App = "auth_service.rpc"
clientConf.Etcd = discov.EtcdConf{ // 通过 etcd 服务发现
Hosts: []string{viper.GetString(config.EtcdAddrKey)},
Key: "auth.rpc",
Key: "auth_service.rpc",
}
svc.AuthServiceClient = auth.NewAuthServiceClient(zrpc.MustNewClient(clientConf).Conn())