Finish the System Cleanup feature.

This commit is contained in:
zicla
2019-04-04 03:14:47 +08:00
parent 7697891807
commit 5936f917b3
15 changed files with 158 additions and 15 deletions

View File

@ -1,7 +1,6 @@
package rest
import (
"github.com/nu7hatch/gouuid"
"time"
)
@ -138,3 +137,10 @@ func (this *UserDao) Save(user *User) *User {
this.PanicError(db.Error)
return user
}
//执行清理操作
func (this *UserDao) Cleanup() {
this.logger.Info("[UserDao]执行清理清除数据库中所有User记录。")
db := CONTEXT.DB.Where("uuid is not null and role != ?", USER_ROLE_ADMINISTRATOR).Delete(User{})
this.PanicError(db.Error)
}