Add the visit time feature.
This commit is contained in:
parent
da0e68f95c
commit
0d43439200
@ -54,11 +54,16 @@ func (this *DashboardService) Bootstrap() {
|
|||||||
go core.RunWithRecovery(this.Etl)
|
go core.RunWithRecovery(this.Etl)
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle the dashboard data.
|
|
||||||
func (this *DashboardService) Etl() {
|
func (this *DashboardService) Etl() {
|
||||||
|
this.etlOneDay(util.Yesterday())
|
||||||
|
this.etlOneDay(time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
startTime := util.FirstSecondOfDay(util.Yesterday())
|
// handle the dashboard data.
|
||||||
endTime := util.LastSecondOfDay(util.Yesterday())
|
func (this *DashboardService) etlOneDay(thenTime time.Time) {
|
||||||
|
|
||||||
|
startTime := util.FirstSecondOfDay(thenTime)
|
||||||
|
endTime := util.LastSecondOfDay(thenTime)
|
||||||
dt := util.ConvertTimeToDateString(startTime)
|
dt := util.ConvertTimeToDateString(startTime)
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
longTimeAgo := time.Now()
|
longTimeAgo := time.Now()
|
||||||
|
@ -348,7 +348,7 @@ func (this *MatterDao) Save(matter *Matter) *Matter {
|
|||||||
|
|
||||||
//download time add 1
|
//download time add 1
|
||||||
func (this *MatterDao) TimesIncrement(matterUuid string) {
|
func (this *MatterDao) TimesIncrement(matterUuid string) {
|
||||||
db := core.CONTEXT.GetDB().Model(&Matter{}).Where("uuid = ?", matterUuid).Update("times", gorm.Expr("times + 1"))
|
db := core.CONTEXT.GetDB().Model(&Matter{}).Where("uuid = ?", matterUuid).Update(map[string]interface{}{"times": gorm.Expr("times + 1"), "visit_time": time.Now()})
|
||||||
this.PanicError(db.Error)
|
this.PanicError(db.Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -43,6 +44,7 @@ type Matter struct {
|
|||||||
Parent *Matter `json:"parent" gorm:"-"`
|
Parent *Matter `json:"parent" gorm:"-"`
|
||||||
Children []*Matter `json:"-" gorm:"-"`
|
Children []*Matter `json:"-" gorm:"-"`
|
||||||
Prop string `json:"prop" gorm:"type:varchar(1024) not null;default:'{}'"`
|
Prop string `json:"prop" gorm:"type:varchar(1024) not null;default:'{}'"`
|
||||||
|
VisitTime time.Time `json:"visitTime" gorm:"type:timestamp not null;default:'2018-01-01 00:00:00'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// set File's table name to be `profiles`
|
// set File's table name to be `profiles`
|
||||||
@ -69,6 +71,7 @@ func NewRootMatter(user *User) *Matter {
|
|||||||
matter.Path = ""
|
matter.Path = ""
|
||||||
matter.CreateTime = user.CreateTime
|
matter.CreateTime = user.CreateTime
|
||||||
matter.UpdateTime = user.UpdateTime
|
matter.UpdateTime = user.UpdateTime
|
||||||
|
matter.VisitTime = user.UpdateTime
|
||||||
|
|
||||||
return matter
|
return matter
|
||||||
}
|
}
|
||||||
|
@ -361,6 +361,7 @@ func (this *MatterService) createNonDirMatter(dirMatter *Matter, filename string
|
|||||||
Privacy: privacy,
|
Privacy: privacy,
|
||||||
Path: fileRelativePath,
|
Path: fileRelativePath,
|
||||||
Prop: EMPTY_JSON_MAP,
|
Prop: EMPTY_JSON_MAP,
|
||||||
|
VisitTime: time.Now(),
|
||||||
}
|
}
|
||||||
matter = this.matterDao.Create(matter)
|
matter = this.matterDao.Create(matter)
|
||||||
|
|
||||||
@ -526,6 +527,7 @@ func (this *MatterService) createDirectory(request *http.Request, dirMatter *Mat
|
|||||||
Dir: true,
|
Dir: true,
|
||||||
Name: name,
|
Name: name,
|
||||||
Path: relativePath,
|
Path: relativePath,
|
||||||
|
VisitTime: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
matter = this.matterDao.Create(matter)
|
matter = this.matterDao.Create(matter)
|
||||||
@ -711,6 +713,7 @@ func (this *MatterService) copy(request *http.Request, srcMatter *Matter, destDi
|
|||||||
Privacy: srcMatter.Privacy,
|
Privacy: srcMatter.Privacy,
|
||||||
Path: destDirMatter.Path + "/" + name,
|
Path: destDirMatter.Path + "/" + name,
|
||||||
Prop: EMPTY_JSON_MAP,
|
Prop: EMPTY_JSON_MAP,
|
||||||
|
VisitTime: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
newMatter = this.matterDao.Create(newMatter)
|
newMatter = this.matterDao.Create(newMatter)
|
||||||
@ -743,6 +746,7 @@ func (this *MatterService) copy(request *http.Request, srcMatter *Matter, destDi
|
|||||||
Privacy: srcMatter.Privacy,
|
Privacy: srcMatter.Privacy,
|
||||||
Path: destDirMatter.Path + "/" + name,
|
Path: destDirMatter.Path + "/" + name,
|
||||||
Prop: EMPTY_JSON_MAP,
|
Prop: EMPTY_JSON_MAP,
|
||||||
|
VisitTime: time.Now(),
|
||||||
}
|
}
|
||||||
newMatter = this.matterDao.Create(newMatter)
|
newMatter = this.matterDao.Create(newMatter)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user