xuzhiheng 4 жил өмнө
parent
commit
d548c08be9

+ 30 - 0
rpc/stdlib/internal/logic/docofflogic.go

@@ -0,0 +1,30 @@
+package logic
+
+import (
+	"context"
+
+	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib"
+
+	"github.com/tal-tech/go-zero/core/logx"
+)
+
+type DocOffLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDocOffLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocOffLogic {
+	return &DocOffLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DocOffLogic) DocOff(in *stdlib.DocChangeReq) (*stdlib.DocChangeResp, error) {
+	// todo: add your logic here and delete this line
+
+	return &stdlib.DocChangeResp{}, nil
+}

+ 30 - 0
rpc/stdlib/internal/logic/doconlogic.go

@@ -0,0 +1,30 @@
+package logic
+
+import (
+	"context"
+
+	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib"
+
+	"github.com/tal-tech/go-zero/core/logx"
+)
+
+type DocOnLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDocOnLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocOnLogic {
+	return &DocOnLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DocOnLogic) DocOn(in *stdlib.DocChangeReq) (*stdlib.DocChangeResp, error) {
+	// todo: add your logic here and delete this line
+
+	return &stdlib.DocChangeResp{}, nil
+}

+ 11 - 1
rpc/stdlib/internal/server/stdlibserver.go

@@ -8,7 +8,7 @@ import (
 
 	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/logic"
 	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib_pb"
+	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib"
 )
 
 type StdlibServer struct {
@@ -25,3 +25,13 @@ func (s *StdlibServer) DocQuery(ctx context.Context, in *stdlib.DocQueryRequest)
 	l := logic.NewDocQueryLogic(ctx, s.svcCtx)
 	return l.DocQuery(in)
 }
+
+func (s *StdlibServer) DocOn(ctx context.Context, in *stdlib.DocChangeReq) (*stdlib.DocChangeResp, error) {
+	l := logic.NewDocOnLogic(ctx, s.svcCtx)
+	return l.DocOn(in)
+}
+
+func (s *StdlibServer) DocOff(ctx context.Context, in *stdlib.DocChangeReq) (*stdlib.DocChangeResp, error) {
+	l := logic.NewDocOffLogic(ctx, s.svcCtx)
+	return l.DocOff(in)
+}

+ 16 - 2
rpc/stdlib/stdlib.proto

@@ -5,15 +5,19 @@ package stdlib;
 
 
 message DocQueryRequest {
-  string keyWords = 1;
+  string keyWords = 1; //检索词
+  int32 pageNum = 2; //页码
 }
 
 message DocQueryResponse {
     int32 code =1;    //响应代码
     string message=2; //响应消息
     repeated Doc docs=3;//文档列表集合,没有分页参数
+    int32 total = 4; //总数
 }
 
+
+
 message Doc {
     string id=1;//文档id
     string name=2;//文档名称
@@ -24,7 +28,17 @@ message Doc {
     string userId=7;//上传人id
 }
 
+message DocChangeReq {
+	string id = 1; //文档id
+}
+
+message DocChangeResp {
+	bool state = 1; //是否成功
+}
+
 
 service Stdlib {
-  rpc DocQuery(DocQueryRequest) returns(DocQueryResponse);
+  	rpc DocQuery(DocQueryRequest) returns(DocQueryResponse); //文档检索
+	rpc DocOn(DocChangeReq) returns(DocChangeResp); //文档上架
+	rpc DocOff(DocChangeReq) returns(DocChangeResp); //文档下架
 }

+ 251 - 25
rpc/stdlib/stdlib_pb/stdlib.pb.go

@@ -1,22 +1,21 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-// 	protoc-gen-go v1.25.0
-// 	protoc        v3.15.5
+// 	protoc-gen-go v1.23.0
+// 	protoc        v3.11.4
 // source: stdlib.proto
 
 package stdlib
 
 import (
 	context "context"
-	reflect "reflect"
-	sync "sync"
-
 	proto "github.com/golang/protobuf/proto"
 	grpc "google.golang.org/grpc"
 	codes "google.golang.org/grpc/codes"
 	status "google.golang.org/grpc/status"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+	reflect "reflect"
+	sync "sync"
 )
 
 const (
@@ -35,7 +34,8 @@ type DocQueryRequest struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	KeyWords string `protobuf:"bytes,1,opt,name=keyWords,proto3" json:"keyWords,omitempty"`
+	KeyWords string `protobuf:"bytes,1,opt,name=keyWords,proto3" json:"keyWords,omitempty"` //检索词
+	PageNum  int32  `protobuf:"varint,2,opt,name=pageNum,proto3" json:"pageNum,omitempty"`  //页码
 }
 
 func (x *DocQueryRequest) Reset() {
@@ -77,6 +77,13 @@ func (x *DocQueryRequest) GetKeyWords() string {
 	return ""
 }
 
+func (x *DocQueryRequest) GetPageNum() int32 {
+	if x != nil {
+		return x.PageNum
+	}
+	return 0
+}
+
 type DocQueryResponse struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -85,6 +92,7 @@ type DocQueryResponse struct {
 	Code    int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`      //响应代码
 	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` //响应消息
 	Docs    []*Doc `protobuf:"bytes,3,rep,name=docs,proto3" json:"docs,omitempty"`       //文档列表集合,没有分页参数
+	Total   int32  `protobuf:"varint,4,opt,name=total,proto3" json:"total,omitempty"`    //总数
 }
 
 func (x *DocQueryResponse) Reset() {
@@ -140,6 +148,13 @@ func (x *DocQueryResponse) GetDocs() []*Doc {
 	return nil
 }
 
+func (x *DocQueryResponse) GetTotal() int32 {
+	if x != nil {
+		return x.Total
+	}
+	return 0
+}
+
 type Doc struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -235,20 +250,117 @@ func (x *Doc) GetUserId() string {
 	return ""
 }
 
+type DocChangeReq struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //文档id
+}
+
+func (x *DocChangeReq) Reset() {
+	*x = DocChangeReq{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_stdlib_proto_msgTypes[3]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *DocChangeReq) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DocChangeReq) ProtoMessage() {}
+
+func (x *DocChangeReq) ProtoReflect() protoreflect.Message {
+	mi := &file_stdlib_proto_msgTypes[3]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use DocChangeReq.ProtoReflect.Descriptor instead.
+func (*DocChangeReq) Descriptor() ([]byte, []int) {
+	return file_stdlib_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *DocChangeReq) GetId() string {
+	if x != nil {
+		return x.Id
+	}
+	return ""
+}
+
+type DocChangeResp struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	State bool `protobuf:"varint,1,opt,name=state,proto3" json:"state,omitempty"` //是否成功
+}
+
+func (x *DocChangeResp) Reset() {
+	*x = DocChangeResp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_stdlib_proto_msgTypes[4]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *DocChangeResp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DocChangeResp) ProtoMessage() {}
+
+func (x *DocChangeResp) ProtoReflect() protoreflect.Message {
+	mi := &file_stdlib_proto_msgTypes[4]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use DocChangeResp.ProtoReflect.Descriptor instead.
+func (*DocChangeResp) Descriptor() ([]byte, []int) {
+	return file_stdlib_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *DocChangeResp) GetState() bool {
+	if x != nil {
+		return x.State
+	}
+	return false
+}
+
 var File_stdlib_proto protoreflect.FileDescriptor
 
 var file_stdlib_proto_rawDesc = []byte{
 	0x0a, 0x0c, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
-	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x22, 0x2d, 0x0a, 0x0f, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65,
+	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x22, 0x47, 0x0a, 0x0f, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65,
 	0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79,
 	0x57, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79,
-	0x57, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x61, 0x0a, 0x10, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72,
-	0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
-	0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a,
-	0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
-	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x18,
-	0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44,
-	0x6f, 0x63, 0x52, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x22, 0xa1, 0x01, 0x0a, 0x03, 0x44, 0x6f, 0x63,
+	0x57, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d,
+	0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x22,
+	0x77, 0x0a, 0x10, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,
+	0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+	0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
+	0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
+	0x65, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32,
+	0x0b, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x52, 0x04, 0x64, 0x6f,
+	0x63, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28,
+	0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0xa1, 0x01, 0x0a, 0x03, 0x44, 0x6f, 0x63,
 	0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
 	0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
 	0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01,
@@ -258,12 +370,24 @@ var file_stdlib_proto_rawDesc = []byte{
 	0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,
 	0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
 	0x74, 0x61, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x07,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x32, 0x47, 0x0a, 0x06,
-	0x53, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x12, 0x3d, 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65,
-	0x72, 0x79, 0x12, 0x17, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x51,
-	0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x73, 0x74,
-	0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73,
-	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x1e, 0x0a, 0x0c,
+	0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02,
+	0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x25, 0x0a, 0x0d,
+	0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a,
+	0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x74,
+	0x61, 0x74, 0x65, 0x32, 0xb4, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x12, 0x3d,
+	0x0a, 0x08, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, 0x2e, 0x73, 0x74, 0x64,
+	0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75,
+	0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63,
+	0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a,
+	0x05, 0x44, 0x6f, 0x63, 0x4f, 0x6e, 0x12, 0x14, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e,
+	0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73,
+	0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52,
+	0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x06, 0x44, 0x6f, 0x63, 0x4f, 0x66, 0x66, 0x12, 0x14, 0x2e,
+	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
+	0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63,
+	0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+	0x6f, 0x33,
 }
 
 var (
@@ -278,18 +402,24 @@ func file_stdlib_proto_rawDescGZIP() []byte {
 	return file_stdlib_proto_rawDescData
 }
 
-var file_stdlib_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
+var file_stdlib_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
 var file_stdlib_proto_goTypes = []interface{}{
 	(*DocQueryRequest)(nil),  // 0: stdlib.DocQueryRequest
 	(*DocQueryResponse)(nil), // 1: stdlib.DocQueryResponse
 	(*Doc)(nil),              // 2: stdlib.Doc
+	(*DocChangeReq)(nil),     // 3: stdlib.DocChangeReq
+	(*DocChangeResp)(nil),    // 4: stdlib.DocChangeResp
 }
 var file_stdlib_proto_depIdxs = []int32{
 	2, // 0: stdlib.DocQueryResponse.docs:type_name -> stdlib.Doc
 	0, // 1: stdlib.Stdlib.DocQuery:input_type -> stdlib.DocQueryRequest
-	1, // 2: stdlib.Stdlib.DocQuery:output_type -> stdlib.DocQueryResponse
-	2, // [2:3] is the sub-list for method output_type
-	1, // [1:2] is the sub-list for method input_type
+	3, // 2: stdlib.Stdlib.DocOn:input_type -> stdlib.DocChangeReq
+	3, // 3: stdlib.Stdlib.DocOff:input_type -> stdlib.DocChangeReq
+	1, // 4: stdlib.Stdlib.DocQuery:output_type -> stdlib.DocQueryResponse
+	4, // 5: stdlib.Stdlib.DocOn:output_type -> stdlib.DocChangeResp
+	4, // 6: stdlib.Stdlib.DocOff:output_type -> stdlib.DocChangeResp
+	4, // [4:7] is the sub-list for method output_type
+	1, // [1:4] 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
@@ -337,6 +467,30 @@ func file_stdlib_proto_init() {
 				return nil
 			}
 		}
+		file_stdlib_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*DocChangeReq); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_stdlib_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*DocChangeResp); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
 	}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
@@ -344,7 +498,7 @@ func file_stdlib_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_stdlib_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   3,
+			NumMessages:   5,
 			NumExtensions: 0,
 			NumServices:   1,
 		},
@@ -371,6 +525,8 @@ const _ = grpc.SupportPackageIsVersion6
 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 type StdlibClient interface {
 	DocQuery(ctx context.Context, in *DocQueryRequest, opts ...grpc.CallOption) (*DocQueryResponse, error)
+	DocOn(ctx context.Context, in *DocChangeReq, opts ...grpc.CallOption) (*DocChangeResp, error)
+	DocOff(ctx context.Context, in *DocChangeReq, opts ...grpc.CallOption) (*DocChangeResp, error)
 }
 
 type stdlibClient struct {
@@ -390,9 +546,29 @@ func (c *stdlibClient) DocQuery(ctx context.Context, in *DocQueryRequest, opts .
 	return out, nil
 }
 
+func (c *stdlibClient) DocOn(ctx context.Context, in *DocChangeReq, opts ...grpc.CallOption) (*DocChangeResp, error) {
+	out := new(DocChangeResp)
+	err := c.cc.Invoke(ctx, "/stdlib.Stdlib/DocOn", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *stdlibClient) DocOff(ctx context.Context, in *DocChangeReq, opts ...grpc.CallOption) (*DocChangeResp, error) {
+	out := new(DocChangeResp)
+	err := c.cc.Invoke(ctx, "/stdlib.Stdlib/DocOff", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // StdlibServer is the server API for Stdlib service.
 type StdlibServer interface {
 	DocQuery(context.Context, *DocQueryRequest) (*DocQueryResponse, error)
+	DocOn(context.Context, *DocChangeReq) (*DocChangeResp, error)
+	DocOff(context.Context, *DocChangeReq) (*DocChangeResp, error)
 }
 
 // UnimplementedStdlibServer can be embedded to have forward compatible implementations.
@@ -402,6 +578,12 @@ type UnimplementedStdlibServer struct {
 func (*UnimplementedStdlibServer) DocQuery(context.Context, *DocQueryRequest) (*DocQueryResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocQuery not implemented")
 }
+func (*UnimplementedStdlibServer) DocOn(context.Context, *DocChangeReq) (*DocChangeResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method DocOn not implemented")
+}
+func (*UnimplementedStdlibServer) DocOff(context.Context, *DocChangeReq) (*DocChangeResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method DocOff not implemented")
+}
 
 func RegisterStdlibServer(s *grpc.Server, srv StdlibServer) {
 	s.RegisterService(&_Stdlib_serviceDesc, srv)
@@ -425,6 +607,42 @@ func _Stdlib_DocQuery_Handler(srv interface{}, ctx context.Context, dec func(int
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Stdlib_DocOn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(DocChangeReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(StdlibServer).DocOn(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/stdlib.Stdlib/DocOn",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(StdlibServer).DocOn(ctx, req.(*DocChangeReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _Stdlib_DocOff_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(DocChangeReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(StdlibServer).DocOff(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/stdlib.Stdlib/DocOff",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(StdlibServer).DocOff(ctx, req.(*DocChangeReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 var _Stdlib_serviceDesc = grpc.ServiceDesc{
 	ServiceName: "stdlib.Stdlib",
 	HandlerType: (*StdlibServer)(nil),
@@ -433,6 +651,14 @@ var _Stdlib_serviceDesc = grpc.ServiceDesc{
 			MethodName: "DocQuery",
 			Handler:    _Stdlib_DocQuery_Handler,
 		},
+		{
+			MethodName: "DocOn",
+			Handler:    _Stdlib_DocOn_Handler,
+		},
+		{
+			MethodName: "DocOff",
+			Handler:    _Stdlib_DocOff_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "stdlib.proto",

+ 17 - 1
rpc/stdlib/stdlibclient/stdlib.go

@@ -6,18 +6,24 @@
 package stdlibclient
 
 import (
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib_pb"
 	"context"
+
+	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib"
+
 	"github.com/tal-tech/go-zero/zrpc"
 )
 
 type (
+	DocChangeResp    = stdlib.DocChangeResp
 	DocQueryRequest  = stdlib.DocQueryRequest
 	DocQueryResponse = stdlib.DocQueryResponse
 	Doc              = stdlib.Doc
+	DocChangeReq     = stdlib.DocChangeReq
 
 	Stdlib interface {
 		DocQuery(ctx context.Context, in *DocQueryRequest) (*DocQueryResponse, error)
+		DocOn(ctx context.Context, in *DocChangeReq) (*DocChangeResp, error)
+		DocOff(ctx context.Context, in *DocChangeReq) (*DocChangeResp, error)
 	}
 
 	defaultStdlib struct {
@@ -35,3 +41,13 @@ func (m *defaultStdlib) DocQuery(ctx context.Context, in *DocQueryRequest) (*Doc
 	client := stdlib.NewStdlibClient(m.cli.Conn())
 	return client.DocQuery(ctx, in)
 }
+
+func (m *defaultStdlib) DocOn(ctx context.Context, in *DocChangeReq) (*DocChangeResp, error) {
+	client := stdlib.NewStdlibClient(m.cli.Conn())
+	return client.DocOn(ctx, in)
+}
+
+func (m *defaultStdlib) DocOff(ctx context.Context, in *DocChangeReq) (*DocChangeResp, error) {
+	client := stdlib.NewStdlibClient(m.cli.Conn())
+	return client.DocOff(ctx, in)
+}