소스 검색

文档统计

xuzhiheng 4 년 전
부모
커밋
364cad245e
2개의 변경된 파일22개의 추가작업 그리고 10개의 파일을 삭제
  1. 14 10
      services/model/stdlib.go
  2. 8 0
      services/stdlib/docStatistics.go

+ 14 - 10
services/model/stdlib.go

@@ -25,18 +25,22 @@ type UserMoneyRecord struct {
 	DocSummary       string `json:"docSummary"`
 }
 
+func (ud *UserMoneyRecord) TableName() string {
+	return "doc"
+}
+
 type UserDoc struct {
 	BaseModel
-	UserId        string `json:"user_id"  gorm:"column:userId"`
-	DocId         string `json:"doc_id" gorm:"column:docId"`
-	DocCategory   int    `json:"doc_category" gorm:"column:docCategory"`
-	IsDelete      int    `json:"is_delete" gorm:"column:isDelete"`
-	DocName       string `json:"doc_name" gorm:"column:docName"`
-	DocFileType   int    `json:"doc_file_type" gorm:"column:docFileType"`
-	DocFileSuffix string `json:"doc_file_suffix" gorm:"column:docFileSuffix"`
-	DocFileSize   int    `json:"doc_file_size" gorm:"column:docFileSize"`
-	DocPageSize   int    `json:"doc_page_size" gorm:"column:docPageSize"`
-	DocSummary    string `json:"doc_summary" gorm:"column:docSummary"`
+	UserId          string `json:"user_id"  gorm:"column:userId"`
+	DocId           string `json:"doc_id" gorm:"column:docId"`
+	DocCategory     int    `json:"doc_category" gorm:"column:docCategory"`
+	IsDelete        int    `json:"is_delete" gorm:"column:isDelete"`
+	DocName         string `json:"doc_name" gorm:"column:docName"`
+	DocFileType     int    `json:"doc_file_type" gorm:"column:docFileType"`
+	DocFileSuffix   string `json:"doc_file_suffix" gorm:"column:docFileSuffix"`
+	DocFileSize     int    `json:"doc_file_size" gorm:"column:docFileSize"`
+	DocPageSize     int    `json:"doc_page_size" gorm:"column:docPageSize"`
+	DocSummary      string `json:"doc_summary" gorm:"column:docSummary"`
 	DocSourceUserId string `json:"doc_source_user_id" gorm:"column:docSourceUserId"`
 }
 

+ 8 - 0
services/stdlib/docStatistics.go

@@ -6,4 +6,12 @@ import (
 
 func DocStatistics(docId string, dtype int) {
 	jyDocsRpcUtil.GetJyDocsDB()
+	if dtype == 1 { //下载次数增加1
+		//mysql
+
+		//es
+
+	} else if dtype == 2 { //浏览次数增加1
+
+	}
 }