@@ -10,6 +10,11 @@ import (
func DocStatistics(docId, appId string, dtype int) bool {
sqlStr := ""
state := false
+ var count int64
+ jyDocsRpcUtil.GetJyDocsDB().Table("doc_statistics").Where("docId = ? and appId = ?", docId, appId).Count(&count)
+ if count < 1 {
+ jyDocsRpcUtil.GetJyDocsDB().Exec("insert into doc_statistics (docId,appId,updateDate,score,downTimes,viewTimes) values (?,?,?,?,?,?)", docId, appId, time.Now().Format("2006-01-02 15:04:05"), 0, 0, 0)
+ }
if dtype == 1 { //下载次数增加1
sqlStr = "update doc_statistics set downTimes = downTimes + 1,updateDate = ? where docId = ? and appId = ?"
} else if dtype == 2 { //浏览次数增加1