Эх сурвалжийг харах

上下架参数增加appid及修改存es字段

fuwencai 4 жил өмнө
parent
commit
24c99e830f

+ 2 - 2
rpc/stdlib/internal/logic/docofflogic.go

@@ -3,6 +3,7 @@ package logic
 import (
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	"app.yhyue.com/moapp/jy_docs/services/model"
 	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
 	"context"
 	"github.com/tal-tech/go-zero/core/logx"
@@ -24,8 +25,7 @@ func NewDocOffLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocOffLogi
 }
 
 func (l *DocOffLogic) DocOff(in *stdlib.DocChangeReq) (*stdlib.DocChangeResp, error) {
-	// todo: add your logic here and delete this line
-	status := stdlibService.ChangeDocumentOff(in.Id, in.Reason)
+	status := stdlibService.ChangeDocumentOff(&model.Doc{Id: in.Id, AppId: in.AppId}, in.Reason)
 	log.Println(status, "返回值-----------")
 	return &stdlib.DocChangeResp{State: status}, nil
 

+ 4 - 2
rpc/stdlib/internal/logic/doconlogic.go

@@ -3,9 +3,11 @@ package logic
 import (
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	"app.yhyue.com/moapp/jy_docs/services/model"
 	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
 	"context"
 	"github.com/tal-tech/go-zero/core/logx"
+	"log"
 )
 
 type DocOnLogic struct {
@@ -23,7 +25,7 @@ func NewDocOnLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocOnLogic
 }
 
 func (l *DocOnLogic) DocOn(in *stdlib.DocChangeReq) (*stdlib.DocChangeResp, error) {
-	// todo: add your logic here and delete this line
-	status := stdlibService.ChangeDocumentOn(in.Id, in.Reason)
+	status := stdlibService.ChangeDocumentOn(&model.Doc{Id: in.Id, AppId: in.AppId}, in.Reason)
+	log.Println(status, "返回值-----------")
 	return &stdlib.DocChangeResp{State: status}, nil
 }

+ 3 - 2
rpc/stdlib/stdlib.proto

@@ -9,8 +9,8 @@ message DocQueryRequest {
   repeated string docClass = 4;  // 分类 []string
   repeated string docTag = 5;  // 标签 []string
   int64 updateDateSort = 6;  // 上传时间排序 1正序 -1倒序
-  int64 downloadSort = 7;		// 下载次数排序 1正序 -1倒序
-  int64	viewSort = 8;			// 浏览量排序 1正序 -1倒序
+  int64 downloadSort = 7;    // 下载次数排序 1正序 -1倒序
+  int64  viewSort = 8;      // 浏览量排序 1正序 -1倒序
   string userId = 9; //用户id
 }
 
@@ -35,6 +35,7 @@ message Doc {
 message DocChangeReq {
   string id = 1; //文档id
   int32 reason = 2; //处理原因 1机审通过上架 2人审通过上加  10投诉下架 11过期下架
+  string appId = 3; //appId
 }
 
 message DocChangeResp {

+ 97 - 88
rpc/stdlib/stdlib/stdlib.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.25.0
-// 	protoc        v3.15.6
+// 	protoc        v3.15.1
 // source: stdlib.proto
 
 package stdlib
@@ -321,6 +321,7 @@ type DocChangeReq struct {
 
 	Id     string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`          //文档id
 	Reason int32  `protobuf:"varint,2,opt,name=reason,proto3" json:"reason,omitempty"` //处理原因 1机审通过上架 2人审通过上加  10投诉下架 11过期下架
+	AppId  string `protobuf:"bytes,3,opt,name=appId,proto3" json:"appId,omitempty"`    //appId
 }
 
 func (x *DocChangeReq) Reset() {
@@ -369,6 +370,13 @@ func (x *DocChangeReq) GetReason() int32 {
 	return 0
 }
 
+func (x *DocChangeReq) GetAppId() string {
+	if x != nil {
+		return x.AppId
+	}
+	return ""
+}
+
 type DocChangeResp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -965,97 +973,98 @@ var file_stdlib_proto_rawDesc = []byte{
 	0x01, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x44, 0x61, 0x74, 0x65, 0x12,
 	0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20,
 	0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22,
-	0x36, 0x0a, 0x0c, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12,
+	0x4c, 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, 0x12,
 	0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
-	0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 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, 0x22, 0x56,
-	0x0a, 0x10, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x52,
-	0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x44, 0x6f, 0x63, 0x53,
-	0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x05, 0x52, 0x11, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69,
-	0x63, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3e, 0x0a, 0x0e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74,
-	0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49,
-	0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x16,
-	0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
-	0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xfb, 0x01, 0x0a, 0x0f, 0x44, 0x6f, 0x63, 0x47, 0x65,
-	0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
-	0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10,
-	0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67,
-	0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f,
-	0x63, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x6f, 0x63,
-	0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53,
-	0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69,
-	0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x50, 0x61, 0x67,
-	0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x64, 0x6f, 0x63,
-	0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73,
-	0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06,
-	0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73,
-	0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61,
-	0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d,
-	0x6d, 0x61, 0x72, 0x79, 0x22, 0x59, 0x0a, 0x11, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x6f,
-	0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
-	0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a,
-	0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12,
-	0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20,
-	0x01, 0x28, 0x0c, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22,
-	0x46, 0x0a, 0x0e, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65,
-	0x71, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01,
-	0x28, 0x05, 0x52, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x70,
-	0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70,
-	0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0xcb, 0x01, 0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x41,
-	0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x1e, 0x0a,
-	0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
-	0x05, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x1a, 0x0a,
-	0x08, 0x64, 0x6f, 0x63, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x08, 0x64, 0x6f, 0x63, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63,
-	0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64,
-	0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x63,
-	0x49, 0x6d, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x63, 0x49, 0x6d,
-	0x67, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05,
-	0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x50,
-	0x72, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x6f, 0x73, 0x74,
-	0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x76, 0x0a, 0x0f, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69,
-	0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03,
-	0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x27,
-	0x0a, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73,
-	0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74,
-	0x79, 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, 0x32, 0xba, 0x03,
-	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,
+	0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64,
+	0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 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, 0x22, 0x56, 0x0a, 0x10, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69,
+	0x73, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49,
+	0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x2c,
+	0x0a, 0x11, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x54,
+	0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x44, 0x6f, 0x63, 0x53, 0x74,
+	0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3e, 0x0a, 0x0e,
+	0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x14,
+	0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64,
+	0x6f, 0x63, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xfb, 0x01, 0x0a,
+	0x0f, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
+	0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d,
+	0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65,
+	0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
+	0x05, 0x52, 0x07, 0x64, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x6f,
+	0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52,
+	0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x20, 0x0a, 0x0b,
+	0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28,
+	0x05, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x12,
+	0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61,
+	0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x6f,
+	0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
+	0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22, 0x59, 0x0a, 0x11, 0x44, 0x6f,
+	0x63, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63,
+	0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63, 0x43, 0x6f, 0x6e, 0x74,
+	0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x43, 0x6f,
+	0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x46, 0x0a, 0x0e, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69,
+	0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e,
+	0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75,
+	0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20,
+	0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0xcb, 0x01,
+	0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a,
+	0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f,
+	0x63, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49,
+	0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74,
+	0x79, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f, 0x63, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18,
+	0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6f, 0x63, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12,
+	0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x04, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12,
+	0x16, 0x0a, 0x06, 0x64, 0x6f, 0x63, 0x49, 0x6d, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x06, 0x64, 0x6f, 0x63, 0x49, 0x6d, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65,
+	0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a,
+	0x09, 0x63, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
+	0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x76, 0x0a, 0x0f, 0x44,
+	0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12,
+	0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f,
+	0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x03, 0x6d, 0x73, 0x67, 0x12, 0x27, 0x0a, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x03,
+	0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x41,
+	0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 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, 0x32, 0xba, 0x03, 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, 0x73, 0x70, 0x12, 0x40, 0x0a, 0x0d, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69,
-	0x73, 0x74, 0x69, 0x63, 0x73, 0x12, 0x18, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44,
-	0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 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, 0x3e, 0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74,
-	0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x16, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44,
-	0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e,
+	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, 0x40, 0x0a, 0x0d, 0x44, 0x6f,
+	0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x12, 0x18, 0x2e, 0x73, 0x74,
+	0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69,
+	0x63, 0x73, 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, 0x3e, 0x0a, 0x0b,
+	0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x16, 0x2e, 0x73, 0x74,
+	0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b,
+	0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63,
+	0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, 0x0a, 0x0d,
+	0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x2e,
 	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65,
-	0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, 0x0a, 0x0d, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74,
-	0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62,
-	0x2e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a,
-	0x19, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43,
-	0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3e, 0x0a, 0x0b, 0x44, 0x6f,
-	0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x16, 0x2e, 0x73, 0x74, 0x64, 0x6c,
-	0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65,
-	0x71, 0x1a, 0x17, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x41, 0x63,
-	0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
-	0x6f, 0x33,
+	0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44,
+	0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x3e, 0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12,
+	0x16, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69,
+	0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62,
+	0x2e, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70,
+	0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (

+ 6 - 6
rpc/stdlib/stdlibclient/stdlib.go

@@ -14,18 +14,18 @@ import (
 )
 
 type (
-	DocGetContentResp = stdlib.DocGetContentResp
+	DocStatisticsReq  = stdlib.DocStatisticsReq
+	DocActivity       = stdlib.DocActivity
 	DocActivityResp   = stdlib.DocActivityResp
 	DocQueryRequest   = stdlib.DocQueryRequest
-	DocQueryResponse  = stdlib.DocQueryResponse
 	DocChangeReq      = stdlib.DocChangeReq
-	DocStatisticsReq  = stdlib.DocStatisticsReq
+	DocChangeResp     = stdlib.DocChangeResp
 	DocGetCheckReq    = stdlib.DocGetCheckReq
 	DocGetCheckResp   = stdlib.DocGetCheckResp
-	Doc               = stdlib.Doc
-	DocChangeResp     = stdlib.DocChangeResp
+	DocGetContentResp = stdlib.DocGetContentResp
 	DocActivityReq    = stdlib.DocActivityReq
-	DocActivity       = stdlib.DocActivity
+	DocQueryResponse  = stdlib.DocQueryResponse
+	Doc               = stdlib.Doc
 
 	Stdlib interface {
 		DocQuery(ctx context.Context, in *DocQueryRequest) (*DocQueryResponse, error)

+ 3 - 3
rpc/stdlib/test/doc_test.go

@@ -15,7 +15,7 @@ import (
 func Test_DocOn(t *testing.T) {
 	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
 	std := stdlibclient.NewStdlib(zrpc.MustNewClient(zrpc.RpcClientConf{Etcd: discov.EtcdConf{Hosts: []string{"192.168.3.240:2379"}, Key: "jydocs.stdlib.rpc"}}))
-	req := &stdlib.DocChangeReq{Id: "123", Reason: 1}
+	req := &stdlib.DocChangeReq{Id: "123", Reason: 1,AppId: "app_id_123"}
 	res, err := std.DocOn(ctx, req)
 	log.Println("err ", err)
 	if res.State == true {
@@ -25,9 +25,9 @@ func Test_DocOn(t *testing.T) {
 	}
 }
 func Test_DocOff(t *testing.T) {
-	ctx, _ := context.WithTimeout(context.Background(), 120*time.Second)
+	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
 	std := stdlibclient.NewStdlib(zrpc.MustNewClient(zrpc.RpcClientConf{Etcd: discov.EtcdConf{Hosts: []string{"192.168.3.240:2379"}, Key: "jydocs.stdlib.rpc"}}))
-	req := &stdlib.DocChangeReq{Id: "123", Reason: 10}
+	req := &stdlib.DocChangeReq{Id: "123", Reason: 10,AppId: "app_id_123"}
 	res, err := std.DocOff(ctx, req)
 	log.Println("err ", err)
 	if res.State == true {

+ 23 - 23
services/model/stdlib.go

@@ -5,28 +5,28 @@ import (
 )
 
 type Doc struct {
-	Id               string `json:"id" gorm:"id"`
-	UserId           string `json:"userId" gorm:"column:userId"`
-	DocName          string `json:"docName" gorm:"column:docName"`
-	DocFileType      int    `json:"docFileType" gorm:"column:docFileType"`
-	DocFileSuffix    string `json:"docFileSuffix" gorm:"column:docFileSuffix"`
-	DocFileSize      int    `json:"docFileSize" gorm:"column:docFileSize"`
-	DocPageSize      int    `json:"docPageSize" gorm:"column:docPageSize"`
-	DocTags          string `json:"docTags" gorm:"column:docTags"`
-	DocClassLevelOne string `json:"docClassLevelOne" gorm:"column:docClassLevelOne"`
-	DocClassLevelTwo string `json:"docClassLevelTwo" gorm:"column:docClassLevelTwo"`
-	UploadDate       string `json:"uploadDate" gorm:"column:uploadDate"`
-	IsDelete         int    `json:"isDelete" gorm:"column:isDelete"`
-	OssDocId         string `json:"ossDocId" gorm:"column:ossDocId"`
-	OssDocUrl        string `json:"ossDocUrl" gorm:"column:ossDocUrl"`
-	Md5              string `json:"md5" gorm:"column:md5"`
-	OssPdfId         string `json:"ossPdfId" gorm:"column:ossPdfId"`
-	OssPdfUrl        string `json:"ossPdfUrl" gorm:"column:ossPdfUrl"`
-	OssTxtId         string `json:"ossTxtId" gorm:"column:ossTxtId"`
-	OssTxtUrl        string `json:"ossTxtUrl" gorm:"column:ossTxtUrl"`
-	Price            int    `json:"price" gorm:"column:price"`
-	DownOrUp         int    `json:"downOrUp" gorm:"column:downOrUp"`
-	DocSummary       string `json:"docSummary" gorm:"column:docSummary"`
+	Id            string    `json:"id" gorm:"id"`
+	UserId        string    `json:"userId" gorm:"column:userId"`
+	AppId         string    `json:"appId" gorm:"column:appId"`
+	DocName       string    `json:"docName" gorm:"column:docName"`
+	DocFileType   int       `json:"docFileType" gorm:"column:docFileType"`
+	DocFileSuffix string    `json:"docFileSuffix" gorm:"column:docFileSuffix"`
+	DocFileSize   int       `json:"docFileSize" gorm:"column:docFileSize"`
+	DocPageSize   int       `json:"docPageSize" gorm:"column:docPageSize"`
+	DocTags       string    `json:"docTags" gorm:"column:docTags"`
+	DocClass      string    `json:"docClass" gorm:"column:docClass"`
+	UploadDate    time.Time `json:"uploadDate" gorm:"column:uploadDate"`
+	IsDelete      int       `json:"isDelete" gorm:"column:isDelete"`
+	OssDocId      string    `json:"ossDocId" gorm:"column:ossDocId"`
+	OssDocUrl     string    `json:"ossDocUrl" gorm:"column:ossDocUrl"`
+	Md5           string    `json:"md5" gorm:"column:md5"`
+	OssPdfId      string    `json:"ossPdfId" gorm:"column:ossPdfId"`
+	OssPdfUrl     string    `json:"ossPdfUrl" gorm:"column:ossPdfUrl"`
+	OssTxtId      string    `json:"ossTxtId" gorm:"column:ossTxtId"`
+	OssTxtUrl     string    `json:"ossTxtUrl" gorm:"column:ossTxtUrl"`
+	Price         int       `json:"price" gorm:"column:price"`
+	DownOrUp      int       `json:"downOrUp" gorm:"column:downOrUp"`
+	DocSummary    string    `json:"docSummary" gorm:"column:docSummary"`
 }
 
 func (ud *Doc) TableName() string {
@@ -38,7 +38,7 @@ type UserDoc struct {
 	CreateAt        time.Time `json:"create_at" gorm:"create_at"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
 	UpdateAt        time.Time `json:"update_at" gorm:"update_at"`
 	DeletedAt       time.Time `json:"delete_at" gorm:"column:delete_at"`
-	AppId           int64    `json:"app_id"  gorm:"column:appId"`
+	AppId           int64     `json:"app_id"  gorm:"column:appId"`
 	UserId          string    `json:"user_id"  gorm:"column:userId"`
 	DocId           string    `json:"doc_id" gorm:"column:docId"`
 	DocCategory     int       `json:"doc_category" gorm:"column:docCategory"`

+ 34 - 32
services/stdlib/docChangeService.go

@@ -1,6 +1,7 @@
 package stdlib
 
 import (
+	"app.yhyue.com/moapp/jy_docs/services/model"
 	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	elastic "app.yhyue.com/moapp/jybase/esv7"
 	"errors"
@@ -13,25 +14,25 @@ const DocOn = 1
 const DocOff = 0
 
 // 上架文档
-func ChangeDocumentOn(id string, reason int32) bool {
+func ChangeDocumentOn(doc *model.Doc, reason int32) bool {
 	// 查文档
 	docData := map[string]interface{}{}
-	rs := jyDocsRpcUtil.GetJyDocsDB().Table("doc").Where("id=? and isDelete=0 and downOrUp=0", id).Find(&docData)
+	rs := jyDocsRpcUtil.GetJyDocsDB().Table("doc").Where("id=? and isDelete=0 and downOrUp=0 and appId=?", doc.Id, doc.AppId).Find(&docData)
 	if rs.Error != nil {
-		log.Println("上架文档 error:"+id, rs.Error)
+		log.Printf("上架文档 appId:%s,Id:%s, error: %s\n", doc.AppId, doc.Id, rs.Error)
 		return false
 	} else {
 		if docData["id"] == nil {
-			log.Println("上架文档 error:"+id, "文档不存在或已经被上架")
+			log.Printf("上架文档 appId:%s,Id:%s, error: %s\n", doc.AppId, doc.Id, "文档不存在或已经被上架")
 			return false
 		}
 	}
 	statisticsData := map[string]interface{}{}
 	var downTimes int64
 	var viewTimes int64
-	result := jyDocsRpcUtil.GetJyDocsDB().Table("doc_statistics").Where("docId=?", id).Find(&statisticsData)
+	result := jyDocsRpcUtil.GetJyDocsDB().Table("doc_statistics").Where("docId=? and appId=?", doc.Id, doc.AppId).Find(&statisticsData)
 	if result.Error != nil {
-		log.Println("上架文档 查询浏览次数下载量出错 error:"+id, result.Error)
+		log.Printf("上架文档 查询浏览次数下载量出错 appId:%s,Id:%s, error:%s\n", doc.AppId, doc.Id, result.Error)
 		return false
 	} else {
 		if statisticsData["id"] != nil {
@@ -46,76 +47,77 @@ func ChangeDocumentOn(id string, reason int32) bool {
 	// 上架
 	err := jyDocsRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		// 更新大库状态为上架 1-上架
-		if err := tx.Exec("update doc set downOrUp=? where id=? ", DocOn, id).Error; err != nil {
+		if err := tx.Exec("update doc set downOrUp=? where id=? and appId=?", DocOn, doc.Id, doc.AppId).Error; err != nil {
 			return err
 		}
 		// 存上架记录
 		date := time.Now().Local().Format("2006-01-02 15:04:05")
-		if err := tx.Exec("insert into doc_change_record (docId,date,downOrUp,reason) values (?,?,?,?)", id, date, DocOn, reason).Error; err != nil {
+		if err := tx.Exec("insert into doc_change_record (docId,date,downOrUp,reason,appId) values (?,?,?,?,?)", doc.Id, date, DocOn, reason, doc.AppId).Error; err != nil {
 			return err
 		}
-		docData["_id"] = docData["id"]
 		saveData := map[string]interface{}{
-			"_id":              docData["id"],
-			"docName":          docData["docName"],
-			"docTags":          docData["docTags"],
-			"docClassLevelOne": docData["docClassLevelOne"],
-			"docClassLevelTwo": docData["docClassLevelTwo"],
-			"price":            docData["price"],
-			"downTimes":        downTimes,
-			"viewTimes":        viewTimes,
-			"docSummary":       docData["docSummary"],
-			"create_at":        docData["uploadDate"].(time.Time).Format("2006-01-02 15:04:05"),
+			"_id":         docData["id"],
+			"docName":     docData["docName"],
+			"docTags":     docData["docTags"],
+			"docClass":    docData["docClass"],
+			"price":       docData["price"],
+			"downTimes":   downTimes,
+			"viewTimes":   viewTimes,
+			"docSummary":  docData["docSummary"],
+			"uploadDate":  docData["uploadDate"].(time.Time).Format("2006-01-02 15:04:05"),
+			"docFileSize": docData["docFileSize"],
+			"docPageSize": docData["docPageSize"],
+			"docFileType": docData["docFileType"],
 		}
-		if rs := elastic.Save("jydoc", "_doc", saveData); rs != true {
+		if rs := elastic.Save(jyDocsRpcUtil.Es_JyDoc, "_doc", saveData); rs != true {
 			return errors.New("发布到检索库失败")
 		}
 		return nil
 	})
 	if err != nil {
-		log.Println("上架文档 error:"+id, err)
+		log.Printf("上架文档 appId:%s,Id:%s, error:%s\n", doc.AppId, doc.Id, err)
 		return false
 	}
-	log.Println("上架文档成功:" + id)
+	log.Println("上架文档成功:" + doc.Id)
 	return true
 }
 
 // 下架文档
-func ChangeDocumentOff(id string, reason int32) bool {
+func ChangeDocumentOff(doc *model.Doc, reason int32) bool {
 	// 查文档
 	docData := map[string]interface{}{}
-	rs := jyDocsRpcUtil.GetJyDocsDB().Table("doc").Where("id=? and isDelete=0 and downOrUp=1", id).Find(&docData)
+	rs := jyDocsRpcUtil.GetJyDocsDB().Table("doc").Where("id=? and isDelete=0 and downOrUp=1 and appId=?", doc.Id, doc.AppId).Find(&docData)
 	if rs.Error != nil {
-		log.Println("下架文档 error:"+id, rs.Error)
+		log.Printf("下架文档 appId:%s,Id:%s, error:%s\n", doc.AppId, doc.Id, rs.Error)
 		return false
 	} else {
 		if docData["id"] == nil {
-			log.Println("下架文档 error:"+id, "文档不存在或已经被下架")
+			log.Printf("下架文档 appId:%s,Id:%s, error:%s\n", doc.AppId, doc.Id, "文档不存在或已经被下架")
 			return false
 		}
 	}
 	// 下架
 	err := jyDocsRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		// 更新大库状态为下架 0-下架
-		if err := tx.Exec("update doc set downOrUp=? where id=? ", DocOff, id).Error; err != nil {
+		if err := tx.Exec("update doc set downOrUp=? where id=? and appId=?", DocOff, doc.Id, doc.AppId).Error; err != nil {
 			return err
 		}
 		// 存下架记录
 		date := time.Now().Local().Format("2006-01-02 15:04:05")
-		if err := tx.Exec("insert into doc_change_record (docId,date,downOrUp,reason) values (?,?,?,?)", id, date, DocOff, reason).Error; err != nil {
+		if err := tx.Exec("insert into doc_change_record (docId,date,downOrUp,reason,appId) values (?,?,?,?,?)", doc.Id, date, DocOff, reason, doc.AppId).Error; err != nil {
 			return err
 		}
-		//todo 从es删除数据 索引待替换 及测试
-		if rs := elastic.DelById("jydoc", "doc", id); rs != true {
+
+		if rs := elastic.DelById(jyDocsRpcUtil.Es_JyDoc, "doc", doc.Id); rs != true {
 			return errors.New("从检索库删除失败")
 		}
 		return nil
 	})
 
 	if err != nil {
-		log.Println("下架文档 error:"+id, err)
+		log.Printf("下架文档 appId:%s,Id:%s, error:%s:\n", doc.AppId, doc.Id, err)
 		return false
 	}
-	log.Println("下架文档成功:" + id)
+	log.Println("下架文档成功:" + doc.Id)
 	return true
 }