Finish most of Lock things.

This commit is contained in:
zicla
2019-04-25 01:27:30 +08:00
parent f2bed9ac33
commit 53b0af2321
6 changed files with 423 additions and 363 deletions

View File

@ -49,9 +49,12 @@ func (this *MatterDao) CheckByUuid(uuid string) *Matter {
return matter
}
//按照uuid查找一个文件夹可能返回root对应的matter.
func (this *MatterDao) CheckDirByUuid(uuid string, user *User) *Matter {
func (this *MatterDao) CheckWithRootByUuid(uuid string, user *User) *Matter {
if uuid == "" {
this.PanicBadRequest("uuid cannot be nil.")
}
var matter *Matter
if uuid == MATTER_ROOT {
@ -66,6 +69,25 @@ func (this *MatterDao) CheckDirByUuid(uuid string, user *User) *Matter {
return matter
}
//按照path查找一个matter可能返回root对应的matter.
func (this *MatterDao) CheckWithRootByPath(path string, user *User) *Matter {
var matter *Matter
if user == nil {
this.PanicBadRequest("user cannot be nil.")
}
//目标文件夹matter
if path == "" || path == "/" {
matter = NewRootMatter(user)
} else {
matter = this.checkByUserUuidAndPath(user.Uuid, path)
}
return matter
}
//按照名字查询文件夹
func (this *MatterDao) FindByUserUuidAndPuuidAndNameAndDirTrue(userUuid string, puuid string, name string) *Matter {