WH01243 %!s(int64=4) %!d(string=hai) anos
pai
achega
e62f69d56c
Modificáronse 35 ficheiros con 1297 adicións e 481 borrados
  1. 1 1
      go.mod
  2. 1 1
      jydocs.go
  3. 1 1
      rpc/stdlib/internal/config/config.go
  4. 47 0
      rpc/stdlib/internal/logic/docactivitylogic.go
  5. 32 0
      rpc/stdlib/internal/logic/docgetchecklogic.go
  6. 31 0
      rpc/stdlib/internal/logic/docgetcontentlogic.go
  7. 8 13
      rpc/stdlib/internal/logic/docofflogic.go
  8. 5 13
      rpc/stdlib/internal/logic/doconlogic.go
  9. 3 3
      rpc/stdlib/internal/logic/docquerylogic.go
  10. 5 5
      rpc/stdlib/internal/logic/docstatisticslogic.go
  11. 18 3
      rpc/stdlib/internal/server/stdlibserver.go
  12. 1 1
      rpc/stdlib/internal/svc/servicecontext.go
  13. 5 5
      rpc/stdlib/stdlib.go
  14. 61 19
      rpc/stdlib/stdlib.proto
  15. 772 101
      rpc/stdlib/stdlib/stdlib.pb.go
  16. 17 7
      rpc/stdlib/test/doc_test.go
  17. 1 1
      rpc/userlib/internal/config/config.go
  18. 4 4
      rpc/userlib/internal/logic/doccollectlogic.go
  19. 13 4
      rpc/userlib/internal/logic/docdeletelogic.go
  20. 2 2
      rpc/userlib/internal/logic/docrestorelogic.go
  21. 2 2
      rpc/userlib/internal/logic/userdocslogic.go
  22. 3 3
      rpc/userlib/internal/server/userlibserver.go
  23. 1 1
      rpc/userlib/internal/svc/servicecontext.go
  24. 21 4
      rpc/userlib/test/userLib_test.go
  25. 5 5
      rpc/userlib/userlib.go
  26. 1 2
      rpc/userlib/userlib.proto
  27. 47 228
      rpc/userlib/userlib/userlib.pb.go
  28. 1 1
      rpc/userlib/userlibclient/userlib.go
  29. 17 3
      services/model/stdlib.go
  30. 18 0
      services/stdlib/docActivity.go
  31. 37 23
      services/stdlib/docChangeService.go
  32. 43 0
      services/stdlib/docGet.go
  33. 1 1
      services/stdlib/docService.go
  34. 27 8
      services/stdlib/docStatistics.go
  35. 45 16
      services/userlib/userDocService.go

+ 1 - 1
go.mod

@@ -1,4 +1,4 @@
-module app.yhyue.com/moapp/jydocs
+module app.yhyue.com/moapp/jy_docs
 
 go 1.14
 

+ 1 - 1
jydocs.go

@@ -1,4 +1,4 @@
 /**
  剑鱼文库
 */
-package jydocs
+package jy_docs

+ 1 - 1
rpc/stdlib/internal/config/config.go

@@ -1,7 +1,7 @@
 package config
 
 import "github.com/tal-tech/go-zero/zrpc"
-import jyDocRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
+import jyDocRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 
 type Config struct {
 	zrpc.RpcServerConf

+ 47 - 0
rpc/stdlib/internal/logic/docactivitylogic.go

@@ -0,0 +1,47 @@
+package logic
+
+import (
+	"context"
+
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
+
+	"github.com/tal-tech/go-zero/core/logx"
+)
+
+type DocActivityLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDocActivityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocActivityLogic {
+	return &DocActivityLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DocActivityLogic) DocActivity(in *stdlib.DocActivityReq) (*stdlib.DocActivityResp, error) {
+	// todo: add your logic here and delete this line
+	pageNum := 0
+	if int(in.PageNum) <= 0 {
+		pageNum = 0
+	}
+	res, count := stdlibService.DocActivityList(int(in.PageSize), pageNum)
+	docActivityResp := &stdlib.DocActivityResp{Code: 0, Msg: "ok", Total: int32(count)}
+	for _, v := range res {
+		docActivityResp.Docs = append(docActivityResp.Docs, &stdlib.DocActivity{
+			DocId:      v.DocId,
+			DocImg:     v.DocImg,
+			DocTitle:   v.DocTitle,
+			DocSummary: v.DocSummary,
+			ActivityId: int32(v.ActivityId),
+			Price:      int32(v.Price),
+			CostPrice:  int32(v.CostPrice),
+		})
+	}
+	return docActivityResp, nil
+}

+ 32 - 0
rpc/stdlib/internal/logic/docgetchecklogic.go

@@ -0,0 +1,32 @@
+package logic
+
+import (
+	"context"
+
+	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
+
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+
+	"github.com/tal-tech/go-zero/core/logx"
+)
+
+type DocGetCheckLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDocGetCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocGetCheckLogic {
+	return &DocGetCheckLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DocGetCheckLogic) DocGetCheck(in *stdlib.DocGetCheckReq) (*stdlib.DocGetCheckResp, error) {
+	// todo: add your logic here and delete this line
+	res := stdlibService.DocGetCheck(in.DocId, in.UserId)
+	return &res, nil
+}

+ 31 - 0
rpc/stdlib/internal/logic/docgetcontentlogic.go

@@ -0,0 +1,31 @@
+package logic
+
+import (
+	"context"
+
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
+
+	"github.com/tal-tech/go-zero/core/logx"
+)
+
+type DocGetContentLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDocGetContentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocGetContentLogic {
+	return &DocGetContentLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DocGetContentLogic) DocGetContent(in *stdlib.DocGetCheckReq) (*stdlib.DocGetContentResp, error) {
+	// todo: add your logic here and delete this line
+	res := stdlibService.DocGetContent(in.DocId, in.UserId)
+	return &res, nil
+}

+ 8 - 13
rpc/stdlib/internal/logic/docofflogic.go

@@ -1,14 +1,12 @@
 package logic
 
 import (
-	stdlibService "app.yhyue.com/moapp/jydocs/services/stdlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
 	"context"
-	"fmt"
-
-	"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"
+	"log"
 )
 
 type DocOffLogic struct {
@@ -27,11 +25,8 @@ 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
-	err := stdlibService.ChangeDocumentOff(in.Id, in.Reason)
-	fmt.Print(err)
-	if err == nil {
-		return &stdlib.DocChangeResp{State: true}, nil
-	} else {
-		return &stdlib.DocChangeResp{State: false}, nil
-	}
+	status := stdlibService.ChangeDocumentOff(in.Id, in.Reason)
+	log.Println(status, "返回值-----------")
+	return &stdlib.DocChangeResp{State: status}, nil
+
 }

+ 5 - 13
rpc/stdlib/internal/logic/doconlogic.go

@@ -1,12 +1,10 @@
 package logic
 
 import (
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib"
-	stdlibService "app.yhyue.com/moapp/jydocs/services/stdlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
 	"context"
-	"fmt"
-
 	"github.com/tal-tech/go-zero/core/logx"
 )
 
@@ -26,12 +24,6 @@ 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
-	err := stdlibService.ChangeDocumentOn(in.Id, in.Reason)
-	fmt.Println(err)
-	if err == nil {
-		return &stdlib.DocChangeResp{State: true}, nil
-	} else {
-		return &stdlib.DocChangeResp{State: false}, nil
-	}
-
+	status := stdlibService.ChangeDocumentOn(in.Id, in.Reason)
+	return &stdlib.DocChangeResp{State: status}, nil
 }

+ 3 - 3
rpc/stdlib/internal/logic/docquerylogic.go

@@ -3,10 +3,10 @@ package logic
 import (
 	"context"
 
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
 
-	stdlibService "app.yhyue.com/moapp/jydocs/services/stdlib"
+	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
 	"github.com/tal-tech/go-zero/core/logx"
 )
 

+ 5 - 5
rpc/stdlib/internal/logic/docstatisticslogic.go

@@ -3,9 +3,9 @@ package logic
 import (
 	"context"
 
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib"
-	stdlibService "app.yhyue.com/moapp/jydocs/services/stdlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
 	"github.com/tal-tech/go-zero/core/logx"
 )
 
@@ -25,6 +25,6 @@ func NewDocStatisticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Doc
 
 func (l *DocStatisticsLogic) DocStatistics(in *stdlib.DocStatisticsReq) (*stdlib.DocChangeResp, error) {
 	// todo: add your logic here and delete this line
-	stdlibService.DocStatistics(in.DocId, int(in.DocStatisticsType))
-	return &stdlib.DocChangeResp{State: true}, nil
+	state := stdlibService.DocStatistics(in.DocId, int(in.DocStatisticsType))
+	return &stdlib.DocChangeResp{State: state}, nil
 }

+ 18 - 3
rpc/stdlib/internal/server/stdlibserver.go

@@ -6,9 +6,9 @@ package server
 import (
 	"context"
 
-	"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"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/logic"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
 )
 
 type StdlibServer struct {
@@ -40,3 +40,18 @@ func (s *StdlibServer) DocStatistics(ctx context.Context, in *stdlib.DocStatisti
 	l := logic.NewDocStatisticsLogic(ctx, s.svcCtx)
 	return l.DocStatistics(in)
 }
+
+func (s *StdlibServer) DocGetCheck(ctx context.Context, in *stdlib.DocGetCheckReq) (*stdlib.DocGetCheckResp, error) {
+	l := logic.NewDocGetCheckLogic(ctx, s.svcCtx)
+	return l.DocGetCheck(in)
+}
+
+func (s *StdlibServer) DocGetContent(ctx context.Context, in *stdlib.DocGetCheckReq) (*stdlib.DocGetContentResp, error) {
+	l := logic.NewDocGetContentLogic(ctx, s.svcCtx)
+	return l.DocGetContent(in)
+}
+
+func (s *StdlibServer) DocActivity(ctx context.Context, in *stdlib.DocActivityReq) (*stdlib.DocActivityResp, error) {
+	l := logic.NewDocActivityLogic(ctx, s.svcCtx)
+	return l.DocActivity(in)
+}

+ 1 - 1
rpc/stdlib/internal/svc/servicecontext.go

@@ -1,7 +1,7 @@
 package svc
 
 import (
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/config"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/config"
 )
 
 type ServiceContext struct {

+ 5 - 5
rpc/stdlib/stdlib.go

@@ -1,11 +1,11 @@
 package main
 
 import (
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/config"
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/server"
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib"
-	jyDocsRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/config"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/server"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	"flag"
 	"github.com/tal-tech/go-zero/core/conf"
 	"github.com/tal-tech/go-zero/zrpc"

+ 61 - 19
rpc/stdlib/stdlib.proto

@@ -2,37 +2,33 @@ syntax = "proto3";
 
 package stdlib;
 
-
-
 message DocQueryRequest {
-  string keyWords = 1; //检索词  文档名检索  模糊
-                       // 分类 []string
-                    	// 标签 []string
-						// 发布时间排序
-						// 下载次数排序
-						// 浏览量排
-  int32 pageNum = 2; //页码
-  int32 pageSize = 3; //每页数量
+  int32 pageNum = 1; //页码 
+  int32 pageSize = 2; //每页数量
+  string keyWords = 3; //检索词  文档名检索  模糊
+  repeated string itemArr = 4;  // 分类 []string
+  repeated string tagArr = 5;  // 标签 []string
+  int32 publishTimeSort = 6;  // 发布时间排序 1正序 -1倒
+  int32 downloadSort = 7;		// 下载次数排序 1正序 -1倒序
+  int32	viewSort = 8;			// 浏览量排序 1正序 -1倒序
 }
 
 message DocQueryResponse {
   int32 code = 1;    //响应代码
-  string message = 2; //响应消息
+  string msg = 2; //响应消息
   repeated Doc docs = 3;//文档列表集合,没有分页参数
   int32 total = 4; //总数
 }
 
-
-
 message Doc {
-  string id = 1;//文档id
-  string name = 2;//文档名称
-  int32 type = 3;//文档类型
-  int32 fileSize = 4;//文档大小
-  int32 pageSize = 5;//文档页码数
+  string docId = 1;//文档id
+  string docName = 2;//文档名称
+  int32 docType = 3;//文档类型
+  int32 docFileSize = 4;//文档大小
+  int32 docPageSize = 5;//文档页码数
   string tags = 6;//文档标签
   string userId = 7;//上传人id
-                         //摘要
+  string docSummary = 8; //摘要
 }
 
 message DocChangeReq {
@@ -49,11 +45,57 @@ message DocStatisticsReq {
   int32 DocStatisticsType = 2; //文档统计类型 1增加下载次数 2增加浏览次数 3评分
 }
 
+message DocGetCheckReq {
+  string docId = 1; //文档id
+  string userId = 2; //用户id
+}
+
+message DocGetCheckResp {
+  int32 code = 1;    //响应代码
+  string msg = 2; //响应消息
+  string docName = 3;//文档名称
+  int32 docType = 4;//文档类型
+  int32 docFileSize = 5;//文档大小
+  int32 docPageSize = 6;//文档页码数
+  string tags = 7;//文档标签
+  string userId = 8;//上传人id
+  string docSummary = 9; //摘要
+}
+
+message DocGetContentResp {
+  int32 code = 1;    //响应代码
+  string msg = 2; //响应消息
+  bytes docContent = 3; //文件内容
+}
+
+message DocActivityReq {
+  int32 pageNum = 1; //页码 
+  int32 pageSize = 2; //每页数量
+}
+
+message DocActivity {
+  string docId = 1; //文档id
+  int32 activityId = 2; //活动id
+  string docTitle = 3; //文档标题
+  string docSummary = 4; //文档摘要
+  string docImg = 5; //文档配图
+  int32 price = 6; //活动价
+  int32 costPrice = 7; //成本价
+}
 
+message DocActivityResp {
+  int32 code = 1;    //响应代码
+  string msg = 2; //响应消息
+  repeated DocActivity docs = 3;//活动文档列表
+  int32 total = 4; //总数
+}
 
 service Stdlib {
   rpc DocQuery(DocQueryRequest) returns(DocQueryResponse); //文档检索
   rpc DocOn(DocChangeReq) returns(DocChangeResp); //文档上架
   rpc DocOff(DocChangeReq) returns(DocChangeResp); //文档下架
   rpc DocStatistics(DocStatisticsReq) returns(DocChangeResp); //文档浏览次数下载次数处理
+  rpc DocGetCheck(DocGetCheckReq) returns(DocGetCheckResp); //获取文档-检查文档是否可获取,返回页面数据
+  rpc DocGetContent(DocGetCheckReq) returns(DocGetContentResp); //获取文档-页面打开pdf调用查询oss
+  rpc DocActivity(DocActivityReq) returns(DocActivityResp); //活动文档列表
 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 772 - 101
rpc/stdlib/stdlib/stdlib.pb.go


+ 17 - 7
rpc/stdlib/test/doc_test.go

@@ -1,8 +1,8 @@
 package test
 
 import (
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlib"
-	"app.yhyue.com/moapp/jydocs/rpc/stdlib/stdlibclient"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlibclient"
 	"context"
 	"github.com/tal-tech/go-zero/core/discov"
 	"github.com/tal-tech/go-zero/zrpc"
@@ -12,18 +12,28 @@ import (
 )
 
 func Test_DocOn(t *testing.T) {
-	ctx, _ := context.WithTimeout(context.Background(), 5*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: 1}
 	res, err := std.DocOn(ctx, req)
 	log.Println("err ", err)
-	log.Println("req ", res.State)
+	if res.State == true {
+		log.Println("req true")
+	} else {
+		log.Println("req false", res)
+	}
 }
 func Test_DocOff(t *testing.T) {
-	ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
+	ctx, _ := context.WithTimeout(context.Background(), 120*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}
 	res, err := std.DocOff(ctx, req)
 	log.Println("err ", err)
-	log.Println("req ", res.State)
-}
+	if res.State == true {
+		log.Println("req true")
+	} else {
+		log.Println("req false", res)
+	}
+	//log.Println("err ", err)
+	//log.Println("req ", res)
+}

+ 1 - 1
rpc/userlib/internal/config/config.go

@@ -1,7 +1,7 @@
 package config
 
 import (
-	jyDocRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
+	jyDocRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	"github.com/tal-tech/go-zero/zrpc"
 )
 

+ 4 - 4
rpc/userlib/internal/logic/doccollectlogic.go

@@ -1,14 +1,14 @@
 package logic
 
 import (
-	"app.yhyue.com/moapp/jydocs/services/model"
+	"app.yhyue.com/moapp/jy_docs/services/model"
 	"context"
 	"log"
 
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
 
-	userLibService "app.yhyue.com/moapp/jydocs/services/userlib"
+	userLibService "app.yhyue.com/moapp/jy_docs/services/userlib"
 	"github.com/tal-tech/go-zero/core/logx"
 )
 

+ 13 - 4
rpc/userlib/internal/logic/docdeletelogic.go

@@ -1,10 +1,11 @@
 package logic
 
 import (
+	userLibService "app.yhyue.com/moapp/jy_docs/services/userlib"
 	"context"
 
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
 
 	"github.com/tal-tech/go-zero/core/logx"
 )
@@ -25,6 +26,14 @@ func NewDocDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocDele
 
 func (l *DocDeleteLogic) DocDelete(in *userlib.UserDeleteRequest) (*userlib.UserDeleteResponse, error) {
 	// todo: add your logic here and delete this line
-
-	return &userlib.UserDeleteResponse{}, nil
+	result := &userlib.UserDeleteResponse{}
+	b := userLibService.UserDocDelete(in.DocId)
+	if b {
+		result.Code = 1
+		result.Message = "删除成功"
+		return result,nil
+	}
+	result.Code = 0
+	result.Message = "删除失败"
+	return result, nil
 }

+ 2 - 2
rpc/userlib/internal/logic/docrestorelogic.go

@@ -3,8 +3,8 @@ package logic
 import (
 	"context"
 
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
 
 	"github.com/tal-tech/go-zero/core/logx"
 )

+ 2 - 2
rpc/userlib/internal/logic/userdocslogic.go

@@ -3,8 +3,8 @@ package logic
 import (
 	"context"
 
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
 
 	"github.com/tal-tech/go-zero/core/logx"
 )

+ 3 - 3
rpc/userlib/internal/server/userlibserver.go

@@ -6,9 +6,9 @@ package server
 import (
 	"context"
 
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/logic"
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/logic"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
 )
 
 type UserLibServer struct {

+ 1 - 1
rpc/userlib/internal/svc/servicecontext.go

@@ -1,6 +1,6 @@
 package svc
 
-import "app.yhyue.com/moapp/jydocs/rpc/userlib/internal/config"
+import "app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/config"
 
 type ServiceContext struct {
 	Config config.Config

+ 21 - 4
rpc/userlib/test/userLib_test.go

@@ -1,8 +1,7 @@
 package test
 
 import (
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlibclient"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlibclient"
 	"context"
 	"github.com/tal-tech/go-zero/core/discov"
 	"github.com/tal-tech/go-zero/zrpc"
@@ -20,7 +19,8 @@ func Test_UserDocCollect(t *testing.T) {
 	})
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocCollect(context.Background(), &userlibclient.UserCollectRequest{
-		DocId:        "1",
+
+		/*DocId:        "1",
 		UserId:       "1",
 		SourceUserId: "2",
 		DocName:      "2020招标文件白皮书.docx",
@@ -29,7 +29,24 @@ func Test_UserDocCollect(t *testing.T) {
 		DocPageSize:  20,
 		DocCategory:  userlib.UserDocCategory_Collect,
 		DocFileSuffix:"docx",
-		Cost:0,
+		Cost:0,*/
+	})
+	if err != nil {
+		log.Println("UserDoc Collect call error:", err)
+	}
+	log.Print("UserDoc Collect call response:", resp)
+}
+
+func Test_UserDocDelete(t *testing.T)  {
+	client := zrpc.MustNewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: []string{"192.168.3.240:2379"},
+			Key:   "jydocs.userlib.rpc",
+		},
+	})
+	userLib := userlibclient.NewUserLib(client)
+	resp, err := userLib.DocDelete(context.Background(), &userlibclient.UserDeleteRequest{
+		//DocId: "8",
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)

+ 5 - 5
rpc/userlib/userlib.go

@@ -1,15 +1,15 @@
 package main
 
 import (
-	jyDocsRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
+	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	"flag"
 	"fmt"
 	"log"
 
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/config"
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/server"
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/config"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/server"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
 
 	"github.com/tal-tech/go-zero/core/conf"
 	"github.com/tal-tech/go-zero/zrpc"

+ 1 - 2
rpc/userlib/userlib.proto

@@ -94,6 +94,5 @@ service  UserLib {
 	rpc DocDelete(UserDeleteRequest) returns(UserDeleteResponse); //文档删除
 	rpc DocRestore(UserRestoreRequest) returns(UserRestoreResponse); //文档恢复
 	rpc DocDownload(UserCollectRequest) returns(UserCollectResponse); //文档转存
-	rpc DocRecycle(UserRecoveryRequest
-	) returns(UserCollectResponse); //回收站
+	rpc DocRecycle(go) returns(UserCollectResponse); //回收站
 }

+ 47 - 228
rpc/userlib/userlib/userlib.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.1
+// 	protoc        v3.15.5
 // source: userlib.proto
 
 package userlib
@@ -758,78 +758,6 @@ func (x *UserDoc) GetDocName() string {
 	return ""
 }
 
-//回收站操作1进入回收站2永久删除3删除改为未删除
-type UserRecoveryRequest struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
-
-	UserId        string        `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`                                           //用户id
-	DocId         string        `protobuf:"bytes,2,opt,name=docId,proto3" json:"docId,omitempty"`                                             //文档id
-	Id            string        `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`                                                   //记录标识
-	UserDocStatus UserDocStatus `protobuf:"varint,4,opt,name=userDocStatus,proto3,enum=userlib.UserDocStatus" json:"userDocStatus,omitempty"` //记录状态
-}
-
-func (x *UserRecoveryRequest) Reset() {
-	*x = UserRecoveryRequest{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_userlib_proto_msgTypes[9]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
-	}
-}
-
-func (x *UserRecoveryRequest) String() string {
-	return protoimpl.X.MessageStringOf(x)
-}
-
-func (*UserRecoveryRequest) ProtoMessage() {}
-
-func (x *UserRecoveryRequest) ProtoReflect() protoreflect.Message {
-	mi := &file_userlib_proto_msgTypes[9]
-	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 UserRecoveryRequest.ProtoReflect.Descriptor instead.
-func (*UserRecoveryRequest) Descriptor() ([]byte, []int) {
-	return file_userlib_proto_rawDescGZIP(), []int{9}
-}
-
-func (x *UserRecoveryRequest) GetUserId() string {
-	if x != nil {
-		return x.UserId
-	}
-	return ""
-}
-
-func (x *UserRecoveryRequest) GetDocId() string {
-	if x != nil {
-		return x.DocId
-	}
-	return ""
-}
-
-func (x *UserRecoveryRequest) GetId() string {
-	if x != nil {
-		return x.Id
-	}
-	return ""
-}
-
-func (x *UserRecoveryRequest) GetUserDocStatus() UserDocStatus {
-	if x != nil {
-		return x.UserDocStatus
-	}
-	return UserDocStatus_Normal
-}
-
 var File_userlib_proto protoreflect.FileDescriptor
 
 var file_userlib_proto_rawDesc = []byte{
@@ -897,57 +825,38 @@ var file_userlib_proto_rawDesc = []byte{
 	0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
 	0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 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,
-	0x22, 0x91, 0x01, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72,
-	0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72,
-	0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
-	0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f,
-	0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e,
-	0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x53,
-	0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74,
-	0x61, 0x74, 0x75, 0x73, 0x2a, 0x3c, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43,
-	0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x65, 0x6c, 0x66, 0x55,
-	0x70, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c,
-	0x6f, 0x61, 0x64, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
-	0x10, 0x02, 0x2a, 0x4c, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c,
-	0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x6f, 0x72, 0x64, 0x10, 0x00, 0x12,
-	0x07, 0x0a, 0x03, 0x50, 0x44, 0x46, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x58, 0x43, 0x45,
-	0x4c, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x50, 0x54, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03,
-	0x54, 0x58, 0x54, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x10, 0x05,
-	0x2a, 0x43, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75,
-	0x73, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x10, 0x00, 0x12, 0x0f, 0x0a,
-	0x0b, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x01, 0x12, 0x15,
-	0x0a, 0x11, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x44, 0x65, 0x6c,
-	0x65, 0x74, 0x65, 0x10, 0x02, 0x32, 0xb6, 0x03, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69,
-	0x62, 0x12, 0x3f, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x18, 0x2e,
-	0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73,
-	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69,
-	0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
-	0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
-	0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43,
-	0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e,
-	0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c,
-	0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x09, 0x44,
-	0x6f, 0x63, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c,
-	0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71,
-	0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55,
-	0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
-	0x65, 0x12, 0x47, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12,
-	0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
-	0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75,
-	0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f,
-	0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0b, 0x44, 0x6f,
-	0x63, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72,
+	0x2a, 0x3c, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67,
+	0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x65, 0x6c, 0x66, 0x55, 0x70, 0x6c, 0x6f, 0x61,
+	0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10,
+	0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x10, 0x02, 0x2a, 0x4c,
+	0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70,
+	0x65, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x6f, 0x72, 0x64, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50,
+	0x44, 0x46, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x58, 0x43, 0x45, 0x4c, 0x10, 0x02, 0x12,
+	0x07, 0x0a, 0x03, 0x50, 0x50, 0x54, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x58, 0x54, 0x10,
+	0x04, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x10, 0x05, 0x2a, 0x43, 0x0a, 0x0d,
+	0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0a, 0x0a,
+	0x06, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4c, 0x6f, 0x67,
+	0x69, 0x63, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x65,
+	0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10,
+	0x02, 0x32, 0xa2, 0x02, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x62, 0x12, 0x3f, 0x0a,
+	0x08, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72,
+	0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75,
+	0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73,
+	0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47,
+	0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x12, 0x1b, 0x2e, 0x75,
+	0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65,
+	0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72,
 	0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52,
-	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62,
-	0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70,
-	0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x63, 0x79, 0x63,
-	0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65,
-	0x72, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
-	0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43,
-	0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06,
-	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x09, 0x44, 0x6f, 0x63, 0x44, 0x65,
+	0x6c, 0x65, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55,
+	0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+	0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44,
+	0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a,
+	0x0a, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x1b, 0x2e, 0x75, 0x73,
+	0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72,
+	0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c,
+	0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65,
+	0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -963,7 +872,7 @@ func file_userlib_proto_rawDescGZIP() []byte {
 }
 
 var file_userlib_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
-var file_userlib_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
+var file_userlib_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
 var file_userlib_proto_goTypes = []interface{}{
 	(UserDocCategory)(0),        // 0: userlib.UserDocCategory
 	(UserDocFileType)(0),        // 1: userlib.UserDocFileType
@@ -977,31 +886,25 @@ var file_userlib_proto_goTypes = []interface{}{
 	(*UserDocsRequest)(nil),     // 9: userlib.UserDocsRequest
 	(*UserDocsResponse)(nil),    // 10: userlib.UserDocsResponse
 	(*UserDoc)(nil),             // 11: userlib.UserDoc
-	(*UserRecoveryRequest)(nil), // 12: userlib.UserRecoveryRequest
 }
 var file_userlib_proto_depIdxs = []int32{
 	0,  // 0: userlib.UserCollectRequest.docCategory:type_name -> userlib.UserDocCategory
 	1,  // 1: userlib.UserCollectRequest.docFileType:type_name -> userlib.UserDocFileType
 	0,  // 2: userlib.UserDocsRequest.userDocCategory:type_name -> userlib.UserDocCategory
 	11, // 3: userlib.UserDocsResponse.docs:type_name -> userlib.UserDoc
-	2,  // 4: userlib.UserRecoveryRequest.userDocStatus:type_name -> userlib.UserDocStatus
-	9,  // 5: userlib.UserLib.UserDocs:input_type -> userlib.UserDocsRequest
-	3,  // 6: userlib.UserLib.DocCollect:input_type -> userlib.UserCollectRequest
-	5,  // 7: userlib.UserLib.DocDelete:input_type -> userlib.UserDeleteRequest
-	7,  // 8: userlib.UserLib.DocRestore:input_type -> userlib.UserRestoreRequest
-	3,  // 9: userlib.UserLib.DocDownload:input_type -> userlib.UserCollectRequest
-	12, // 10: userlib.UserLib.DocRecycle:input_type -> userlib.UserRecoveryRequest
-	10, // 11: userlib.UserLib.UserDocs:output_type -> userlib.UserDocsResponse
-	4,  // 12: userlib.UserLib.DocCollect:output_type -> userlib.UserCollectResponse
-	6,  // 13: userlib.UserLib.DocDelete:output_type -> userlib.UserDeleteResponse
-	8,  // 14: userlib.UserLib.DocRestore:output_type -> userlib.UserRestoreResponse
-	4,  // 15: userlib.UserLib.DocDownload:output_type -> userlib.UserCollectResponse
-	4,  // 16: userlib.UserLib.DocRecycle:output_type -> userlib.UserCollectResponse
-	11, // [11:17] is the sub-list for method output_type
-	5,  // [5:11] is the sub-list for method input_type
-	5,  // [5:5] is the sub-list for extension type_name
-	5,  // [5:5] is the sub-list for extension extendee
-	0,  // [0:5] is the sub-list for field type_name
+	9,  // 4: userlib.UserLib.UserDocs:input_type -> userlib.UserDocsRequest
+	3,  // 5: userlib.UserLib.DocCollect:input_type -> userlib.UserCollectRequest
+	5,  // 6: userlib.UserLib.DocDelete:input_type -> userlib.UserDeleteRequest
+	7,  // 7: userlib.UserLib.DocRestore:input_type -> userlib.UserRestoreRequest
+	10, // 8: userlib.UserLib.UserDocs:output_type -> userlib.UserDocsResponse
+	4,  // 9: userlib.UserLib.DocCollect:output_type -> userlib.UserCollectResponse
+	6,  // 10: userlib.UserLib.DocDelete:output_type -> userlib.UserDeleteResponse
+	8,  // 11: userlib.UserLib.DocRestore:output_type -> userlib.UserRestoreResponse
+	8,  // [8:12] is the sub-list for method output_type
+	4,  // [4:8] is the sub-list for method input_type
+	4,  // [4:4] is the sub-list for extension type_name
+	4,  // [4:4] is the sub-list for extension extendee
+	0,  // [0:4] is the sub-list for field type_name
 }
 
 func init() { file_userlib_proto_init() }
@@ -1118,18 +1021,6 @@ func file_userlib_proto_init() {
 				return nil
 			}
 		}
-		file_userlib_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*UserRecoveryRequest); 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{
@@ -1137,7 +1028,7 @@ func file_userlib_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_userlib_proto_rawDesc,
 			NumEnums:      3,
-			NumMessages:   10,
+			NumMessages:   9,
 			NumExtensions: 0,
 			NumServices:   1,
 		},
@@ -1168,8 +1059,6 @@ type UserLibClient interface {
 	DocCollect(ctx context.Context, in *UserCollectRequest, opts ...grpc.CallOption) (*UserCollectResponse, error)
 	DocDelete(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error)
 	DocRestore(ctx context.Context, in *UserRestoreRequest, opts ...grpc.CallOption) (*UserRestoreResponse, error)
-	DocDownload(ctx context.Context, in *UserCollectRequest, opts ...grpc.CallOption) (*UserCollectResponse, error)
-	DocRecycle(ctx context.Context, in *UserRecoveryRequest, opts ...grpc.CallOption) (*UserCollectResponse, error)
 }
 
 type userLibClient struct {
@@ -1216,32 +1105,12 @@ func (c *userLibClient) DocRestore(ctx context.Context, in *UserRestoreRequest,
 	return out, nil
 }
 
-func (c *userLibClient) DocDownload(ctx context.Context, in *UserCollectRequest, opts ...grpc.CallOption) (*UserCollectResponse, error) {
-	out := new(UserCollectResponse)
-	err := c.cc.Invoke(ctx, "/userlib.UserLib/DocDownload", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *userLibClient) DocRecycle(ctx context.Context, in *UserRecoveryRequest, opts ...grpc.CallOption) (*UserCollectResponse, error) {
-	out := new(UserCollectResponse)
-	err := c.cc.Invoke(ctx, "/userlib.UserLib/DocRecycle", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
 // UserLibServer is the server API for UserLib service.
 type UserLibServer interface {
 	UserDocs(context.Context, *UserDocsRequest) (*UserDocsResponse, error)
 	DocCollect(context.Context, *UserCollectRequest) (*UserCollectResponse, error)
 	DocDelete(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error)
 	DocRestore(context.Context, *UserRestoreRequest) (*UserRestoreResponse, error)
-	DocDownload(context.Context, *UserCollectRequest) (*UserCollectResponse, error)
-	DocRecycle(context.Context, *UserRecoveryRequest) (*UserCollectResponse, error)
 }
 
 // UnimplementedUserLibServer can be embedded to have forward compatible implementations.
@@ -1260,12 +1129,6 @@ func (*UnimplementedUserLibServer) DocDelete(context.Context, *UserDeleteRequest
 func (*UnimplementedUserLibServer) DocRestore(context.Context, *UserRestoreRequest) (*UserRestoreResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocRestore not implemented")
 }
-func (*UnimplementedUserLibServer) DocDownload(context.Context, *UserCollectRequest) (*UserCollectResponse, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method DocDownload not implemented")
-}
-func (*UnimplementedUserLibServer) DocRecycle(context.Context, *UserRecoveryRequest) (*UserCollectResponse, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method DocRecycle not implemented")
-}
 
 func RegisterUserLibServer(s *grpc.Server, srv UserLibServer) {
 	s.RegisterService(&_UserLib_serviceDesc, srv)
@@ -1343,42 +1206,6 @@ func _UserLib_DocRestore_Handler(srv interface{}, ctx context.Context, dec func(
 	return interceptor(ctx, in, info, handler)
 }
 
-func _UserLib_DocDownload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(UserCollectRequest)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(UserLibServer).DocDownload(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/userlib.UserLib/DocDownload",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(UserLibServer).DocDownload(ctx, req.(*UserCollectRequest))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _UserLib_DocRecycle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(UserRecoveryRequest)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(UserLibServer).DocRecycle(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/userlib.UserLib/DocRecycle",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(UserLibServer).DocRecycle(ctx, req.(*UserRecoveryRequest))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
 var _UserLib_serviceDesc = grpc.ServiceDesc{
 	ServiceName: "userlib.UserLib",
 	HandlerType: (*UserLibServer)(nil),
@@ -1399,14 +1226,6 @@ var _UserLib_serviceDesc = grpc.ServiceDesc{
 			MethodName: "DocRestore",
 			Handler:    _UserLib_DocRestore_Handler,
 		},
-		{
-			MethodName: "DocDownload",
-			Handler:    _UserLib_DocDownload_Handler,
-		},
-		{
-			MethodName: "DocRecycle",
-			Handler:    _UserLib_DocRecycle_Handler,
-		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "userlib.proto",

+ 1 - 1
rpc/userlib/userlibclient/userlib.go

@@ -8,7 +8,7 @@ package userlibclient
 import (
 	"context"
 
-	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
 
 	"github.com/tal-tech/go-zero/zrpc"
 )

+ 17 - 3
services/model/stdlib.go

@@ -4,7 +4,7 @@ import (
 	"time"
 )
 
-type UserMoneyRecord struct {
+type Doc struct {
 	Id               string    `json:"id"`
 	UserId           string    `json:"userId"`
 	DocName          string    `json:"before"`
@@ -31,8 +31,7 @@ type UserMoneyRecord struct {
 	UpdateAt         time.Time `json:"-" gorm:"autoUpdateTime"`
 	DeletedAt        time.Time `json:"-" gorm:"column:delete_at"`
 }
-
-func (ud *UserMoneyRecord) TableName() string {
+func (ud *Doc) TableName() string {
 	return "doc"
 }
 
@@ -58,3 +57,18 @@ type UserDoc struct {
 func (ud *UserDoc) TableName() string {
 	return "user_doc"
 }
+
+type DocActivity struct {
+	Id         int    `json:"id" gorm:"primaryKey"`
+	DocId      string `json:"docId"`
+	ActivityId int    `json:"activityId"`
+	DocTitle   string `json:"docTitle"`
+	DocSummary string `json:"docSummary"`
+	DocImg     string `json:"docImg"`
+	Price      int    `json:"price"`
+	CostPrice  int    `json:"costPrice"`
+}
+
+func (ud *DocActivity) TableName() string {
+	return "doc_activity"
+}

+ 18 - 0
services/stdlib/docActivity.go

@@ -0,0 +1,18 @@
+package stdlib
+
+import (
+	"app.yhyue.com/moapp/jy_docs/services/model"
+	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
+)
+
+func DocActivityList(pageSize, pageNum int) ([]model.DocActivity, int) {
+	docActivity := []model.DocActivity{}
+	var count int64
+	jyDocsRpcUtil.GetJyDocsDB().Model(&model.DocActivity{}).Count(&count)
+	if count > 0 {
+		jyDocsRpcUtil.GetJyDocsDB().Model(&model.DocActivity{}).Offset(pageNum * pageSize).Limit(pageSize).Find(&docActivity)
+	} else {
+		count = 0
+	}
+	return docActivity, int(count)
+}

+ 37 - 23
services/stdlib/docChangeService.go

@@ -1,28 +1,30 @@
 package stdlib
 
 import (
+	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
+	elastic "app.yhyue.com/moapp/jybase/esv7"
 	"errors"
-	"time"
-
-	jyDocsRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
 	"gorm.io/gorm"
+	"log"
+	"time"
 )
 
 const DocOn = 1
 const DocOff = 0
 
 // 上架文档
-func ChangeDocumentOn(id string, reason int32) error {
+func ChangeDocumentOn(id string, reason int32) bool {
 	// 查文档
 	docData := map[string]interface{}{}
-	rs := jyDocsRpcUtil.GetJyDocsDB().Table("doc").Where("id=? and isDelete=0", id).Find(&docData)
+	rs := jyDocsRpcUtil.GetJyDocsDB().Table("doc").Where("id=? and isDelete=0 and downOrUp=0", id).Find(&docData)
 	if rs.Error != nil {
-		return rs.Error
+		log.Println("上架文档 error:"+id, rs.Error)
+		return false
 	} else {
 		if docData["id"] == nil {
-			return errors.New("文档不存在")
+			log.Println("上架文档 error:"+id, "文档不存在或已经被上架")
+			return false
 		}
-
 	}
 	// 上架
 	err := jyDocsRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
@@ -35,26 +37,33 @@ func ChangeDocumentOn(id string, reason int32) error {
 		if err := tx.Exec("insert into doc_change_record (docId,date,downOrUp,reason) values (?,?,?,?)", id, date, DocOn, reason).Error; err != nil {
 			return err
 		}
-		// todo es加数据
-		//if rs := elastic.Save("index", "doc", docData); rs != true {
-		//	return errors.New("发布到检索库失败")
-		//}
+		docData["_id"] = docData["id"]
+		// todo es加数据 索引待替换 测试
+		if rs := elastic.Save("doc_lib", "doc", docData); rs != true {
+			return errors.New("发布到检索库失败")
+		}
 		return nil
 	})
-
-	return err
+	if err != nil {
+		log.Println("上架文档 error:"+id, err)
+		return false
+	}
+	log.Println("上架文档成功:" + id)
+	return true
 }
 
 // 下架文档
-func ChangeDocumentOff(id string, reason int32) error {
+func ChangeDocumentOff(id string, reason int32) bool {
 	// 查文档
 	docData := map[string]interface{}{}
-	rs := jyDocsRpcUtil.GetJyDocsDB().Table("doc").Where("id=? and isDelete=0", id).Find(&docData)
+	rs := jyDocsRpcUtil.GetJyDocsDB().Table("doc").Where("id=? and isDelete=0 and downOrUp=1", id).Find(&docData)
 	if rs.Error != nil {
-		return rs.Error
+		log.Println("下架文档 error:"+id, rs.Error)
+		return false
 	} else {
 		if docData["id"] == nil {
-			return errors.New("文档不存在")
+			log.Println("下架文档 error:"+id, "文档不存在或已经被下架")
+			return false
 		}
 	}
 	// 下架
@@ -68,12 +77,17 @@ func ChangeDocumentOff(id string, reason int32) error {
 		if err := tx.Exec("insert into doc_change_record (docId,date,downOrUp,reason) values (?,?,?,?)", id, date, DocOff, reason).Error; err != nil {
 			return err
 		}
-		//todo 从es删除数据
-		//if rs := elastic.DelById("index", "doc", id); rs != true {
-		//	return errors.New("从检索库删除失败")
-		//}
+		//todo 从es删除数据 索引待替换 及测试
+		if rs := elastic.DelById("doc_lib", "doc", id); rs != true {
+			return errors.New("从检索库删除失败")
+		}
 		return nil
 	})
 
-	return err
+	if err != nil {
+		log.Println("下架文档 error:"+id, err)
+		return false
+	}
+	log.Println("下架文档成功:" + id)
+	return true
 }

+ 43 - 0
services/stdlib/docGet.go

@@ -0,0 +1,43 @@
+package stdlib
+
+import (
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	"app.yhyue.com/moapp/jy_docs/services/model"
+	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
+)
+
+func DocGetCheck(docId, userId string) stdlib.DocGetCheckResp {
+	// docPrice := 0
+	var buyCount int64
+	jyDocsRpcUtil.GetJyDocsDB().Table("doc").Where("docId = ? and userId = ?", docId, userId).Count(&buyCount)
+	if buyCount > 0 {
+		//已购买
+		doc := &model.Doc{}
+		jyDocsRpcUtil.GetJyDocsDB().Where("id = ?", docId).Find(doc)
+		if doc.DocName != "" {
+			// docPrice = docData["price"].(int)
+			docCheck := stdlib.DocGetCheckResp{
+				Code:        0,
+				Msg:         "ok",
+				DocName:     doc.DocName,
+				DocType:     int32(doc.DocFileType),
+				DocFileSize: int32(doc.DocFileSize),
+				DocPageSize: int32(doc.DocPageSize),
+				Tags:        doc.DocTags,
+				UserId:      doc.UserId,
+				DocSummary:  doc.DocSummary,
+			}
+			return docCheck
+		}
+	}
+	return stdlib.DocGetCheckResp{Code: -1, Msg: "查询失败"}
+}
+
+func DocGetContent(docId, userId string) stdlib.DocGetContentResp {
+	doc := &model.Doc{}
+	jyDocsRpcUtil.GetJyDocsDB().Where("id = ?", docId).Find(doc)
+	if doc.DocName != "" {
+
+	}
+	return stdlib.DocGetContentResp{}
+}

+ 1 - 1
services/stdlib/docService.go

@@ -1,7 +1,7 @@
 package stdlib
 
 import (
-	jyDocsRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
+	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	"log"
 )
 

+ 27 - 8
services/stdlib/docStatistics.go

@@ -1,17 +1,36 @@
 package stdlib
 
 import (
-	jyDocsRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
+	"log"
+	"time"
+
+	elastic "app.yhyue.com/moapp/jybase/esv7"
+	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 )
 
-func DocStatistics(docId string, dtype int) {
-	jyDocsRpcUtil.GetJyDocsDB()
+func DocStatistics(docId string, dtype int) bool {
+	sqlStr := ""
+	state := false
 	if dtype == 1 { //下载次数增加1
-		//mysql
-
-		//es
-
+		sqlStr = "update doc_statistics set downTimes = downTimes + 1,updateDate = ? where docId = ?"
 	} else if dtype == 2 { //浏览次数增加1
-
+		sqlStr = "update doc_statistics set viewTimes = viewTimes + 1,updateDate = ? where docId = ?"
+	}
+	//mysql
+	log.Println("sql ", sqlStr)
+	updateDate := time.Now().Format("2006-01-02 15:04:05")
+	err := jyDocsRpcUtil.GetJyDocsDB().Exec(sqlStr, updateDate, docId).Error
+	if err != nil {
+		//es
+		data := map[string]interface{}{}
+		jyDocsRpcUtil.GetJyDocsDB().Table("doc_statistics").Where("docId = ?", docId).Find(&data)
+		if len(data) > 0 {
+			//是否缓存
+			//TODO
+			if ok := elastic.UpdateNewDoc("jydocs", "jydocs", data); ok {
+				state = true
+			}
+		}
 	}
+	return state
 }

+ 45 - 16
services/userlib/userDocService.go

@@ -2,10 +2,10 @@ package userlib
 
 import (
 	"app.yhyue.com/moapp/jyPoints/rpc/integralclient"
+	"app.yhyue.com/moapp/jy_docs/services/model"
+	docRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	"app.yhyue.com/moapp/jydocs/services/model"
 	docRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
-	"context"
-	"github.com/tal-tech/go-zero/zrpc"
 	"gorm.io/gorm"
 	"log"
 	"time"
@@ -53,22 +53,22 @@ func UserDocDownload(userDoc *model.UserDoc, cost int) bool {
 		}
 		//先扣除积分
 		//rpc
-		ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
-		FileSystem :=integralclient.NewIntegral(zrpc.MustNewClient(c.FileSystemConf))
-		req := &integral.Req{UserId: "111111",PointType:2003,BusinessTypeId:1,BusinessType:"1", Point: 110,EndDate:"2021-03-11",AppId: 10000}
+	/*	ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
+		FileSystem := integralclient.NewIntegral(zrpc.MustNewClient(c.FileSystemConf))
+		req := &integral.Req{UserId: "111111", PointType: 2003, BusinessTypeId: 1, BusinessType: "1", Point: 110, EndDate: "2021-03-11", AppId: 10000}
 		res, err := FileSystem.IntegralConsume(ctx, req)
 		log.Println("err ", err)
-		log.Println("req ", res)
+		log.Println("req ", res)*/
 
 		//查询之前有无收藏记录 有收藏记录类型改为下载,状态改为未删除、有收藏记录插入一条新纪录
 		userDocCollectionList := []model.UserDoc{}
 		err = docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and docId=? and docCategory=? and (isDelete=? or isDelete=?)", userDoc.UserId, userDoc.DocId, model.UserDocCategory_Collect, model.UserDocStatus_Normal, model.UserDocStatus_LogicDelete).Find(&userDocCollectionList)
-		if  err.Error != nil {
+		if err.Error != nil {
 			return err.Error
 		}
-		if len(userDocCollectionList)>0{
+		if len(userDocCollectionList) > 0 {
 			//修改收藏为下载
-			if err := tx.Exec("update user_doc set docCategory=? , isDelete=?  ,update_at=?  where  id =?", model.UserDocCategory_Download,model.UserDocStatus_Normal,time.Now(), userDocCollectionList[0].ID).Error; err != nil {
+			if err := tx.Exec("update user_doc set docCategory=? , isDelete=?  ,update_at=?  where  id =?", model.UserDocCategory_Download, model.UserDocStatus_Normal, time.Now(), userDocCollectionList[0].ID).Error; err != nil {
 				return err
 			}
 			if err.Error != nil {
@@ -77,25 +77,25 @@ func UserDocDownload(userDoc *model.UserDoc, cost int) bool {
 				return err.Error
 			}
 			//用户收藏、转存记录表添加记录
-			err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost,date) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, model.UserDocCategory_Download, cost,time.Now())
+			err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost,date) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, model.UserDocCategory_Download, cost, time.Now())
 			if err.Error != nil {
 				log.Println("userDocCollect record insert error:", err)
 				tx.Rollback()
 				return nil
 			}
-		}else{
+		} else {
 			//用户文库表添加记录
-			userDoc.CreateAt=time.Now()
-			userDoc.UpdateAt=time.Now()
-			userDoc.DeletedAt=time.Now()
-			err= docRpcUtil.GetJyDocsDB().Create(userDoc)
+			userDoc.CreateAt = time.Now()
+			userDoc.UpdateAt = time.Now()
+			userDoc.DeletedAt = time.Now()
+			err = docRpcUtil.GetJyDocsDB().Create(userDoc)
 			if err.Error != nil {
 				log.Println("userDocCollect error:", err)
 				tx.Rollback()
 				return err.Error
 			}
 			//用户收藏、转存记录表添加记录
-			err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost,date) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, model.UserDocCategory_Download, cost,time.Now())
+			err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost,date) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, model.UserDocCategory_Download, cost, time.Now())
 			if err.Error != nil {
 				log.Println("userDocCollect record insert error:", err)
 				tx.Rollback()
@@ -109,3 +109,32 @@ func UserDocDownload(userDoc *model.UserDoc, cost int) bool {
 	}
 	return true
 }
+func UserDocDelete(docId string) bool {
+	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
+		orm := docRpcUtil.GetJyDocsDB()
+		docData := model.UserDoc{}
+		//查询用户文档详情
+		orm.Select("userId,docId").First(&docData, docId)
+		log.Println(docData.UserId)
+		log.Println(docData.DocId)
+
+		//逻辑删除
+		err := docRpcUtil.GetJyDocsDB().Exec("UPDATE user_doc SET isDelete = 1 WHERE id = ?", docId).Error
+		if err != nil {
+			tx.Rollback()
+			return err
+		}
+		//删除记录
+		err = docRpcUtil.GetJyDocsDB().Exec("insert into del_record (docId, userId, date, operate, viewType, source, shareUserId) values (?,?,?,?,?,?,?)", docId, docData.UserId, time.Now(), 1, 1, 1, 1).Error
+		if err != nil {
+			tx.Rollback()
+			return err
+		}
+		return nil
+	})
+	if err != nil {
+		return false
+	}
+	return true
+
+}

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio