feat: add support

This commit is contained in:
zzw
2026-09-24 10:38:00 +08:00
parent 9b876701c3
commit cb16071b20
19 changed files with 901 additions and 1 deletions
+229
View File
@@ -0,0 +1,229 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v3.19.4
// source: support/support.proto
package support
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_support_support_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_support_support_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_support_support_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 CallReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Action string `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"`
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
Request string `protobuf:"bytes,3,opt,name=request,proto3" json:"request,omitempty"`
// 与旧云呼一致:前端传入的 AccessKey
A string `protobuf:"bytes,4,opt,name=a,proto3" json:"a,omitempty"`
S string `protobuf:"bytes,5,opt,name=s,proto3" json:"s,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CallReq) Reset() {
*x = CallReq{}
mi := &file_support_support_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CallReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CallReq) ProtoMessage() {}
func (x *CallReq) ProtoReflect() protoreflect.Message {
mi := &file_support_support_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 CallReq.ProtoReflect.Descriptor instead.
func (*CallReq) Descriptor() ([]byte, []int) {
return file_support_support_proto_rawDescGZIP(), []int{1}
}
func (x *CallReq) GetAction() string {
if x != nil {
return x.Action
}
return ""
}
func (x *CallReq) GetVersion() string {
if x != nil {
return x.Version
}
return ""
}
func (x *CallReq) GetRequest() string {
if x != nil {
return x.Request
}
return ""
}
func (x *CallReq) GetA() string {
if x != nil {
return x.A
}
return ""
}
func (x *CallReq) GetS() string {
if x != nil {
return x.S
}
return ""
}
var File_support_support_proto protoreflect.FileDescriptor
const file_support_support_proto_rawDesc = "" +
"\n" +
"\x15support/support.proto\x12\asupport\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\"q\n" +
"\aCallReq\x12\x16\n" +
"\x06action\x18\x01 \x01(\tR\x06action\x12\x18\n" +
"\aversion\x18\x02 \x01(\tR\aversion\x12\x18\n" +
"\arequest\x18\x03 \x01(\tR\arequest\x12\f\n" +
"\x01a\x18\x04 \x01(\tR\x01a\x12\f\n" +
"\x01s\x18\x05 \x01(\tR\x01s2W\n" +
"\aSupport\x12L\n" +
"\x04Call\x12\x10.support.CallReq\x1a\x11.support.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/api/v3/support/callB\x1bZ\x19lone-services/rpc/supportb\x06proto3"
var (
file_support_support_proto_rawDescOnce sync.Once
file_support_support_proto_rawDescData []byte
)
func file_support_support_proto_rawDescGZIP() []byte {
file_support_support_proto_rawDescOnce.Do(func() {
file_support_support_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_support_support_proto_rawDesc), len(file_support_support_proto_rawDesc)))
})
return file_support_support_proto_rawDescData
}
var file_support_support_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_support_support_proto_goTypes = []any{
(*Response)(nil), // 0: support.Response
(*CallReq)(nil), // 1: support.CallReq
}
var file_support_support_proto_depIdxs = []int32{
1, // 0: support.Support.Call:input_type -> support.CallReq
0, // 1: support.Support.Call:output_type -> support.Response
1, // [1:2] is the sub-list for method output_type
0, // [0:1] 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_support_support_proto_init() }
func file_support_support_proto_init() {
if File_support_support_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_support_support_proto_rawDesc), len(file_support_support_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_support_support_proto_goTypes,
DependencyIndexes: file_support_support_proto_depIdxs,
MessageInfos: file_support_support_proto_msgTypes,
}.Build()
File_support_support_proto = out.File
file_support_support_proto_goTypes = nil
file_support_support_proto_depIdxs = nil
}
+121
View File
@@ -0,0 +1,121 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v3.19.4
// source: support/support.proto
package support
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 (
Support_Call_FullMethodName = "/support.Support/Call"
)
// SupportClient is the client API for Support 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 SupportClient interface {
Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*Response, error)
}
type supportClient struct {
cc grpc.ClientConnInterface
}
func NewSupportClient(cc grpc.ClientConnInterface) SupportClient {
return &supportClient{cc}
}
func (c *supportClient) Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, Support_Call_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// SupportServer is the server API for Support service.
// All implementations must embed UnimplementedSupportServer
// for forward compatibility.
type SupportServer interface {
Call(context.Context, *CallReq) (*Response, error)
mustEmbedUnimplementedSupportServer()
}
// UnimplementedSupportServer 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 UnimplementedSupportServer struct{}
func (UnimplementedSupportServer) Call(context.Context, *CallReq) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method Call not implemented")
}
func (UnimplementedSupportServer) mustEmbedUnimplementedSupportServer() {}
func (UnimplementedSupportServer) testEmbeddedByValue() {}
// UnsafeSupportServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SupportServer will
// result in compilation errors.
type UnsafeSupportServer interface {
mustEmbedUnimplementedSupportServer()
}
func RegisterSupportServer(s grpc.ServiceRegistrar, srv SupportServer) {
// If the following call panics, it indicates UnimplementedSupportServer 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(&Support_ServiceDesc, srv)
}
func _Support_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CallReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SupportServer).Call(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Support_Call_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SupportServer).Call(ctx, req.(*CallReq))
}
return interceptor(ctx, in, info, handler)
}
// Support_ServiceDesc is the grpc.ServiceDesc for Support service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Support_ServiceDesc = grpc.ServiceDesc{
ServiceName: "support.Support",
HandlerType: (*SupportServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Call",
Handler: _Support_Call_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "support/support.proto",
}
Binary file not shown.
+29
View File
@@ -0,0 +1,29 @@
syntax = "proto3";
package support;
option go_package = "lone-services/rpc/support";
import "google/api/annotations.proto";
service Support {
rpc Call(CallReq) returns (Response) {
option (google.api.http) = {
post: "/api/v3/support/call"
body: "*"
};
}
}
message Response {
int32 code = 1;
string msg = 2;
string data = 3;
}
message CallReq {
string action = 1;
string version = 2;
string request = 3;
// 与旧云呼一致:前端传入的 AccessKey
string a = 4;
string s = 5;
}