Refine the structure of this project.

This commit is contained in:
zicla
2019-04-26 14:32:15 +08:00
parent e88930e13a
commit c251ed9f1b
69 changed files with 5494 additions and 2251 deletions

View File

@ -1,10 +1,10 @@
package rest
import (
"github.com/eyebluecn/tank/code/config"
"github.com/eyebluecn/tank/code/tool/cache"
"github.com/eyebluecn/tank/code/tool/result"
"net/http"
"tank/code/config"
cache2 "tank/code/tool/cache"
"tank/code/tool/result"
"time"
)
@ -15,7 +15,7 @@ type UserService struct {
sessionDao *SessionDao
//操作文件的锁。
locker *cache2.Table
locker *cache.Table
}
//初始化方法
@ -34,10 +34,9 @@ func (this *UserService) Init() {
}
//创建一个用于存储用户文件锁的缓存。
this.locker = cache2.NewTable()
this.locker = cache.NewTable()
}
//对某个用户进行加锁。加锁阶段用户是不允许操作文件的。
func (this *UserService) MatterLock(userUuid string) {
//如果已经是锁住的状态,直接报错
@ -58,7 +57,6 @@ func (this *UserService) MatterLock(userUuid string) {
this.locker.Add(userUuid, duration, true)
}
//对某个用户解锁,解锁后用户可以操作文件。
func (this *UserService) MatterUnlock(userUuid string) {
@ -71,7 +69,6 @@ func (this *UserService) MatterUnlock(userUuid string) {
}
}
//装载session信息如果session没有了根据cookie去装填用户信息。
//在所有的路由最初会调用这个方法
func (this *UserService) bootstrap(writer http.ResponseWriter, request *http.Request) {