瀏覽代碼

获取活动文档列表

xuzhiheng 4 年之前
父節點
當前提交
a4254b88d0

+ 20 - 3
rpc/stdlib/internal/logic/docactivitylogic.go

@@ -5,6 +5,7 @@ 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"
 
 	"github.com/tal-tech/go-zero/core/logx"
 )
@@ -23,8 +24,24 @@ func NewDocActivityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocAc
 	}
 }
 
-func (l *DocActivityLogic) DocActivity(in *stdlib.DocActivityReq) (*stdlib.DocQueryResponse, error) {
+func (l *DocActivityLogic) DocActivity(in *stdlib.DocActivityReq) (*stdlib.DocActivityResp, error) {
 	// todo: add your logic here and delete this line
-
-	return &stdlib.DocQueryResponse{}, nil
+	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: count}
+	for _, v := range res {
+		docActivityResp.Docs = append(docActivityResp.Docs, &stdlib.DocActivity{
+			DocId:      res.DocId,
+			DocImg:     res.DocImg,
+			DocTitle:   res.DocTitle,
+			DocSummary: res.DocSummary,
+			ActivityId: res.ActivityId,
+			Price:      res.Price,
+			CostPrice:  res.CostPrice,
+		})
+	}
+	return docActivityResp, nil
 }

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

@@ -51,7 +51,7 @@ func (s *StdlibServer) DocGetContent(ctx context.Context, in *stdlib.DocGetCheck
 	return l.DocGetContent(in)
 }
 
-func (s *StdlibServer) DocActivity(ctx context.Context, in *stdlib.DocActivityReq) (*stdlib.DocQueryResponse, error) {
+func (s *StdlibServer) DocActivity(ctx context.Context, in *stdlib.DocActivityReq) (*stdlib.DocActivityResp, error) {
 	l := logic.NewDocActivityLogic(ctx, s.svcCtx)
 	return l.DocActivity(in)
 }

+ 18 - 1
rpc/stdlib/stdlib.proto

@@ -73,6 +73,23 @@ message DocActivityReq {
   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); //文档上架
@@ -80,5 +97,5 @@ service Stdlib {
   rpc DocStatistics(DocStatisticsReq) returns(DocChangeResp); //文档浏览次数下载次数处理
   rpc DocGetCheck(DocGetCheckReq) returns(DocGetCheckResp); //获取文档-检查文档是否可获取,返回页面数据
   rpc DocGetContent(DocGetCheckReq) returns(DocGetContentResp); //获取文档-页面打开pdf调用查询oss
-  rpc DocActivity(DocActivityReq) returns(DocQueryResponse); //活动文档列表
+  rpc DocActivity(DocActivityReq) returns(DocActivityResp); //活动文档列表
 }

+ 268 - 55
rpc/stdlib/stdlib/stdlib.pb.go

@@ -747,6 +747,172 @@ func (x *DocActivityReq) GetPageSize() int32 {
 	return 0
 }
 
+type DocActivity struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	DocId      string `protobuf:"bytes,1,opt,name=docId,proto3" json:"docId,omitempty"`            //文档id
+	ActivityId int32  `protobuf:"varint,2,opt,name=activityId,proto3" json:"activityId,omitempty"` //活动id
+	DocTitle   string `protobuf:"bytes,3,opt,name=docTitle,proto3" json:"docTitle,omitempty"`      //文档标题
+	DocSummary string `protobuf:"bytes,4,opt,name=docSummary,proto3" json:"docSummary,omitempty"`  //文档摘要
+	DocImg     string `protobuf:"bytes,5,opt,name=docImg,proto3" json:"docImg,omitempty"`          //文档配图
+	Price      int32  `protobuf:"varint,6,opt,name=price,proto3" json:"price,omitempty"`           //活动价
+	CostPrice  int32  `protobuf:"varint,7,opt,name=costPrice,proto3" json:"costPrice,omitempty"`   //成本价
+}
+
+func (x *DocActivity) Reset() {
+	*x = DocActivity{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_stdlib_proto_msgTypes[10]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *DocActivity) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DocActivity) ProtoMessage() {}
+
+func (x *DocActivity) ProtoReflect() protoreflect.Message {
+	mi := &file_stdlib_proto_msgTypes[10]
+	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 DocActivity.ProtoReflect.Descriptor instead.
+func (*DocActivity) Descriptor() ([]byte, []int) {
+	return file_stdlib_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *DocActivity) GetDocId() string {
+	if x != nil {
+		return x.DocId
+	}
+	return ""
+}
+
+func (x *DocActivity) GetActivityId() int32 {
+	if x != nil {
+		return x.ActivityId
+	}
+	return 0
+}
+
+func (x *DocActivity) GetDocTitle() string {
+	if x != nil {
+		return x.DocTitle
+	}
+	return ""
+}
+
+func (x *DocActivity) GetDocSummary() string {
+	if x != nil {
+		return x.DocSummary
+	}
+	return ""
+}
+
+func (x *DocActivity) GetDocImg() string {
+	if x != nil {
+		return x.DocImg
+	}
+	return ""
+}
+
+func (x *DocActivity) GetPrice() int32 {
+	if x != nil {
+		return x.Price
+	}
+	return 0
+}
+
+func (x *DocActivity) GetCostPrice() int32 {
+	if x != nil {
+		return x.CostPrice
+	}
+	return 0
+}
+
+type DocActivityResp struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Code  int32          `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`   //响应代码
+	Msg   string         `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`      //响应消息
+	Docs  []*DocActivity `protobuf:"bytes,3,rep,name=docs,proto3" json:"docs,omitempty"`    //活动文档列表
+	Total int32          `protobuf:"varint,4,opt,name=total,proto3" json:"total,omitempty"` //总数
+}
+
+func (x *DocActivityResp) Reset() {
+	*x = DocActivityResp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_stdlib_proto_msgTypes[11]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *DocActivityResp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DocActivityResp) ProtoMessage() {}
+
+func (x *DocActivityResp) ProtoReflect() protoreflect.Message {
+	mi := &file_stdlib_proto_msgTypes[11]
+	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 DocActivityResp.ProtoReflect.Descriptor instead.
+func (*DocActivityResp) Descriptor() ([]byte, []int) {
+	return file_stdlib_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *DocActivityResp) GetCode() int32 {
+	if x != nil {
+		return x.Code
+	}
+	return 0
+}
+
+func (x *DocActivityResp) GetMsg() string {
+	if x != nil {
+		return x.Msg
+	}
+	return ""
+}
+
+func (x *DocActivityResp) GetDocs() []*DocActivity {
+	if x != nil {
+		return x.Docs
+	}
+	return nil
+}
+
+func (x *DocActivityResp) GetTotal() int32 {
+	if x != nil {
+		return x.Total
+	}
+	return 0
+}
+
 var File_stdlib_proto protoreflect.FileDescriptor
 
 var file_stdlib_proto_rawDesc = []byte{
@@ -830,35 +996,55 @@ var file_stdlib_proto_rawDesc = []byte{
 	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, 0x32, 0xbb, 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,
+	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, 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, 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, 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, 0x3f, 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, 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,
+	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,
+	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, 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 (
@@ -873,7 +1059,7 @@ func file_stdlib_proto_rawDescGZIP() []byte {
 	return file_stdlib_proto_rawDescData
 }
 
-var file_stdlib_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
+var file_stdlib_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
 var file_stdlib_proto_goTypes = []interface{}{
 	(*DocQueryRequest)(nil),   // 0: stdlib.DocQueryRequest
 	(*DocQueryResponse)(nil),  // 1: stdlib.DocQueryResponse
@@ -885,28 +1071,31 @@ var file_stdlib_proto_goTypes = []interface{}{
 	(*DocGetCheckResp)(nil),   // 7: stdlib.DocGetCheckResp
 	(*DocGetContentResp)(nil), // 8: stdlib.DocGetContentResp
 	(*DocActivityReq)(nil),    // 9: stdlib.DocActivityReq
+	(*DocActivity)(nil),       // 10: stdlib.DocActivity
+	(*DocActivityResp)(nil),   // 11: stdlib.DocActivityResp
 }
 var file_stdlib_proto_depIdxs = []int32{
-	2, // 0: stdlib.DocQueryResponse.docs:type_name -> stdlib.Doc
-	0, // 1: stdlib.Stdlib.DocQuery:input_type -> stdlib.DocQueryRequest
-	3, // 2: stdlib.Stdlib.DocOn:input_type -> stdlib.DocChangeReq
-	3, // 3: stdlib.Stdlib.DocOff:input_type -> stdlib.DocChangeReq
-	5, // 4: stdlib.Stdlib.DocStatistics:input_type -> stdlib.DocStatisticsReq
-	6, // 5: stdlib.Stdlib.DocGetCheck:input_type -> stdlib.DocGetCheckReq
-	6, // 6: stdlib.Stdlib.DocGetContent:input_type -> stdlib.DocGetCheckReq
-	9, // 7: stdlib.Stdlib.DocActivity:input_type -> stdlib.DocActivityReq
-	1, // 8: stdlib.Stdlib.DocQuery:output_type -> stdlib.DocQueryResponse
-	4, // 9: stdlib.Stdlib.DocOn:output_type -> stdlib.DocChangeResp
-	4, // 10: stdlib.Stdlib.DocOff:output_type -> stdlib.DocChangeResp
-	4, // 11: stdlib.Stdlib.DocStatistics:output_type -> stdlib.DocChangeResp
-	7, // 12: stdlib.Stdlib.DocGetCheck:output_type -> stdlib.DocGetCheckResp
-	8, // 13: stdlib.Stdlib.DocGetContent:output_type -> stdlib.DocGetContentResp
-	1, // 14: stdlib.Stdlib.DocActivity:output_type -> stdlib.DocQueryResponse
-	8, // [8:15] is the sub-list for method output_type
-	1, // [1:8] 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
+	2,  // 0: stdlib.DocQueryResponse.docs:type_name -> stdlib.Doc
+	10, // 1: stdlib.DocActivityResp.docs:type_name -> stdlib.DocActivity
+	0,  // 2: stdlib.Stdlib.DocQuery:input_type -> stdlib.DocQueryRequest
+	3,  // 3: stdlib.Stdlib.DocOn:input_type -> stdlib.DocChangeReq
+	3,  // 4: stdlib.Stdlib.DocOff:input_type -> stdlib.DocChangeReq
+	5,  // 5: stdlib.Stdlib.DocStatistics:input_type -> stdlib.DocStatisticsReq
+	6,  // 6: stdlib.Stdlib.DocGetCheck:input_type -> stdlib.DocGetCheckReq
+	6,  // 7: stdlib.Stdlib.DocGetContent:input_type -> stdlib.DocGetCheckReq
+	9,  // 8: stdlib.Stdlib.DocActivity:input_type -> stdlib.DocActivityReq
+	1,  // 9: stdlib.Stdlib.DocQuery:output_type -> stdlib.DocQueryResponse
+	4,  // 10: stdlib.Stdlib.DocOn:output_type -> stdlib.DocChangeResp
+	4,  // 11: stdlib.Stdlib.DocOff:output_type -> stdlib.DocChangeResp
+	4,  // 12: stdlib.Stdlib.DocStatistics:output_type -> stdlib.DocChangeResp
+	7,  // 13: stdlib.Stdlib.DocGetCheck:output_type -> stdlib.DocGetCheckResp
+	8,  // 14: stdlib.Stdlib.DocGetContent:output_type -> stdlib.DocGetContentResp
+	11, // 15: stdlib.Stdlib.DocActivity:output_type -> stdlib.DocActivityResp
+	9,  // [9:16] is the sub-list for method output_type
+	2,  // [2:9] is the sub-list for method input_type
+	2,  // [2:2] is the sub-list for extension type_name
+	2,  // [2:2] is the sub-list for extension extendee
+	0,  // [0:2] is the sub-list for field type_name
 }
 
 func init() { file_stdlib_proto_init() }
@@ -1035,6 +1224,30 @@ func file_stdlib_proto_init() {
 				return nil
 			}
 		}
+		file_stdlib_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*DocActivity); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_stdlib_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*DocActivityResp); 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{
@@ -1042,7 +1255,7 @@ func file_stdlib_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_stdlib_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   10,
+			NumMessages:   12,
 			NumExtensions: 0,
 			NumServices:   1,
 		},
@@ -1074,7 +1287,7 @@ type StdlibClient interface {
 	DocStatistics(ctx context.Context, in *DocStatisticsReq, opts ...grpc.CallOption) (*DocChangeResp, error)
 	DocGetCheck(ctx context.Context, in *DocGetCheckReq, opts ...grpc.CallOption) (*DocGetCheckResp, error)
 	DocGetContent(ctx context.Context, in *DocGetCheckReq, opts ...grpc.CallOption) (*DocGetContentResp, error)
-	DocActivity(ctx context.Context, in *DocActivityReq, opts ...grpc.CallOption) (*DocQueryResponse, error)
+	DocActivity(ctx context.Context, in *DocActivityReq, opts ...grpc.CallOption) (*DocActivityResp, error)
 }
 
 type stdlibClient struct {
@@ -1139,8 +1352,8 @@ func (c *stdlibClient) DocGetContent(ctx context.Context, in *DocGetCheckReq, op
 	return out, nil
 }
 
-func (c *stdlibClient) DocActivity(ctx context.Context, in *DocActivityReq, opts ...grpc.CallOption) (*DocQueryResponse, error) {
-	out := new(DocQueryResponse)
+func (c *stdlibClient) DocActivity(ctx context.Context, in *DocActivityReq, opts ...grpc.CallOption) (*DocActivityResp, error) {
+	out := new(DocActivityResp)
 	err := c.cc.Invoke(ctx, "/stdlib.Stdlib/DocActivity", in, out, opts...)
 	if err != nil {
 		return nil, err
@@ -1156,7 +1369,7 @@ type StdlibServer interface {
 	DocStatistics(context.Context, *DocStatisticsReq) (*DocChangeResp, error)
 	DocGetCheck(context.Context, *DocGetCheckReq) (*DocGetCheckResp, error)
 	DocGetContent(context.Context, *DocGetCheckReq) (*DocGetContentResp, error)
-	DocActivity(context.Context, *DocActivityReq) (*DocQueryResponse, error)
+	DocActivity(context.Context, *DocActivityReq) (*DocActivityResp, error)
 }
 
 // UnimplementedStdlibServer can be embedded to have forward compatible implementations.
@@ -1181,7 +1394,7 @@ func (*UnimplementedStdlibServer) DocGetCheck(context.Context, *DocGetCheckReq)
 func (*UnimplementedStdlibServer) DocGetContent(context.Context, *DocGetCheckReq) (*DocGetContentResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocGetContent not implemented")
 }
-func (*UnimplementedStdlibServer) DocActivity(context.Context, *DocActivityReq) (*DocQueryResponse, error) {
+func (*UnimplementedStdlibServer) DocActivity(context.Context, *DocActivityReq) (*DocActivityResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocActivity not implemented")
 }
 

+ 7 - 5
rpc/stdlib/stdlibclient/stdlib.go

@@ -14,16 +14,18 @@ import (
 )
 
 type (
-	DocQueryResponse  = stdlib.DocQueryResponse
 	Doc               = stdlib.Doc
+	DocChangeReq      = stdlib.DocChangeReq
 	DocChangeResp     = stdlib.DocChangeResp
-	DocGetCheckReq    = stdlib.DocGetCheckReq
 	DocGetCheckResp   = stdlib.DocGetCheckResp
+	DocActivity       = stdlib.DocActivity
+	DocActivityResp   = stdlib.DocActivityResp
 	DocQueryRequest   = stdlib.DocQueryRequest
+	DocQueryResponse  = stdlib.DocQueryResponse
 	DocStatisticsReq  = stdlib.DocStatisticsReq
+	DocGetCheckReq    = stdlib.DocGetCheckReq
 	DocGetContentResp = stdlib.DocGetContentResp
 	DocActivityReq    = stdlib.DocActivityReq
-	DocChangeReq      = stdlib.DocChangeReq
 
 	Stdlib interface {
 		DocQuery(ctx context.Context, in *DocQueryRequest) (*DocQueryResponse, error)
@@ -32,7 +34,7 @@ type (
 		DocStatistics(ctx context.Context, in *DocStatisticsReq) (*DocChangeResp, error)
 		DocGetCheck(ctx context.Context, in *DocGetCheckReq) (*DocGetCheckResp, error)
 		DocGetContent(ctx context.Context, in *DocGetCheckReq) (*DocGetContentResp, error)
-		DocActivity(ctx context.Context, in *DocActivityReq) (*DocQueryResponse, error)
+		DocActivity(ctx context.Context, in *DocActivityReq) (*DocActivityResp, error)
 	}
 
 	defaultStdlib struct {
@@ -76,7 +78,7 @@ func (m *defaultStdlib) DocGetContent(ctx context.Context, in *DocGetCheckReq) (
 	return client.DocGetContent(ctx, in)
 }
 
-func (m *defaultStdlib) DocActivity(ctx context.Context, in *DocActivityReq) (*DocQueryResponse, error) {
+func (m *defaultStdlib) DocActivity(ctx context.Context, in *DocActivityReq) (*DocActivityResp, error) {
 	client := stdlib.NewStdlibClient(m.cli.Conn())
 	return client.DocActivity(ctx, in)
 }

+ 15 - 0
services/model/stdlib.go

@@ -47,3 +47,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 *UserDoc) TableName() string {
+	return "doc_activity"
+}

+ 24 - 0
services/stdlib/docActivity.go

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