Documentation ¶
Index ¶
- Constants
- Variables
- func GetBcrypt(raw string) string
- func GetConfPath() string
- func GetExtension(filename string) string
- func GetGender(genderString string) string
- func GetHomePath() string
- func GetHtmlPath() string
- func GetIpAddress(r *http.Request) string
- func GetMd5(raw string) string
- func GetMimeType(filename string) string
- func GetRole(roleString string) string
- func GetUserFilePath(username string) (string, string)
- func HumanFileSize(bytes int64) string
- func InstallDatabase()
- func LoadConfigFromArguments()
- func LoadConfigFromEnvironment()
- func LoadConfigFromFile()
- func Log(prefix string, content string)
- func LogDebug(content string)
- func LogError(content string)
- func LogInfo(content string)
- func LogPanic(content interface{})
- func LogWarning(content string)
- func MakeDirAll(dirPath string) string
- func MatchBcrypt(raw string, bcryptStr string) bool
- func PathExists(path string) (bool, error)
- func PrepareConfigs()
- func ValidateEmail(email string) bool
- type AlienController
- func (this *AlienController) CheckRequestUser(email, password string) *User
- func (this *AlienController) Confirm(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *AlienController) Crawl(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *AlienController) Download(writer http.ResponseWriter, request *http.Request, uuid string, ...)
- func (this *AlienController) FetchDownloadToken(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *AlienController) FetchUploadToken(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *AlienController) HandleRoutes(writer http.ResponseWriter, request *http.Request) (func(writer http.ResponseWriter, request *http.Request), bool)
- func (this *AlienController) Init(context *Context)
- func (this *AlienController) RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
- func (this *AlienController) Upload(writer http.ResponseWriter, request *http.Request) *WebResult
- type Base
- type BaseController
- func (this *BaseController) Error(err interface{}) *WebResult
- func (this *BaseController) HandleRoutes(writer http.ResponseWriter, request *http.Request) (func(writer http.ResponseWriter, request *http.Request), bool)
- func (this *BaseController) Init(context *Context)
- func (this *BaseController) RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
- func (this *BaseController) Success(data interface{}) *WebResult
- func (this *BaseController) Wrap(f func(writer http.ResponseWriter, request *http.Request) *WebResult, ...) func(w http.ResponseWriter, r *http.Request)
- type BaseDao
- type Bean
- type Config
- type Context
- type DownloadToken
- type DownloadTokenDao
- func (this *DownloadTokenDao) CheckByUuid(uuid string) *DownloadToken
- func (this *DownloadTokenDao) Create(downloadToken *DownloadToken) *DownloadToken
- func (this *DownloadTokenDao) FindByUuid(uuid string) *DownloadToken
- func (this *DownloadTokenDao) Save(downloadToken *DownloadToken) *DownloadToken
- type IBean
- type IController
- type Matter
- type MatterController
- func (this *MatterController) ChangePrivacy(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *MatterController) Crawl(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *MatterController) CreateDirectory(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *MatterController) Delete(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *MatterController) DeleteBatch(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *MatterController) Detail(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *MatterController) Init(context *Context)
- func (this *MatterController) Move(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *MatterController) Page(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *MatterController) RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
- func (this *MatterController) Rename(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *MatterController) Upload(writer http.ResponseWriter, request *http.Request) *WebResult
- type MatterDao
- func (this *MatterDao) CheckByUuid(uuid string) *Matter
- func (this *MatterDao) CheckByUuidAndUserUuid(uuid string, userUuid string) *Matter
- func (this *MatterDao) CountByUserUuidAndPuuidAndDirAndName(userUuid string, puuid string, dir bool, name string) int
- func (this *MatterDao) Create(matter *Matter) *Matter
- func (this *MatterDao) Delete(matter *Matter)
- func (this *MatterDao) FindByUserUuidAndPuuidAndNameAndDirTrue(userUuid string, puuid string, name string) *Matter
- func (this *MatterDao) FindByUuid(uuid string) *Matter
- func (this *MatterDao) List(puuid string, userUuid string, sortArray []OrderPair) []*Matter
- func (this *MatterDao) ListByUserUuidAndPuuidAndDirAndName(userUuid string, puuid string, dir bool, name string) []*Matter
- func (this *MatterDao) Page(page int, pageSize int, puuid string, userUuid string, name string, dir string, ...) *Pager
- func (this *MatterDao) Save(matter *Matter) *Matter
- type MatterService
- func (this *MatterService) Crawl(url string, filename string, user *User, puuid string, privacy bool) *Matter
- func (this *MatterService) Detail(uuid string) *Matter
- func (this *MatterService) DownloadFile(writer http.ResponseWriter, request *http.Request, matter *Matter)
- func (this *MatterService) GetDirUuid(userUuid string, dir string) string
- func (this *MatterService) Init(context *Context)
- func (this *MatterService) ResizeImage(writer http.ResponseWriter, request *http.Request, matter *Matter)
- func (this *MatterService) Upload(file multipart.File, user *User, puuid string, filename string, privacy bool, ...) *Matter
- type OrderPair
- type Pager
- type Preference
- type PreferenceController
- func (this *PreferenceController) Edit(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *PreferenceController) Fetch(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *PreferenceController) Init(context *Context)
- func (this *PreferenceController) RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
- type PreferenceDao
- type PreferenceService
- type Router
- type Session
- type SessionDao
- type Time
- type UploadToken
- type UploadTokenDao
- type User
- type UserController
- func (this *UserController) ChangePassword(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *UserController) Create(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *UserController) Detail(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *UserController) Disable(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *UserController) Edit(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *UserController) Enable(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *UserController) Init(context *Context)
- func (this *UserController) Login(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *UserController) Logout(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *UserController) Page(writer http.ResponseWriter, request *http.Request) *WebResult
- func (this *UserController) RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
- func (this *UserController) ResetPassword(writer http.ResponseWriter, request *http.Request) *WebResult
- type UserDao
- func (this *UserDao) CheckByUuid(uuid string) *User
- func (this *UserDao) CountByEmail(email string) int
- func (this *UserDao) CountByUsername(username string) int
- func (this *UserDao) Create(user *User) *User
- func (this *UserDao) FindByEmail(email string) *User
- func (this *UserDao) FindByUuid(uuid string) *User
- func (this *UserDao) Page(page int, pageSize int, username string, email string, phone string, ...) *Pager
- func (this *UserDao) Save(user *User) *User
- type WebError
- type WebResult
- type WherePair
Constants ¶
const ( //用户身份的cookie字段名 COOKIE_AUTH_KEY = "_ak" //数据库表前缀 tank100表示当前应用版本是tank:1.0.x版,数据库结构发生变化必然是中型升级 TABLE_PREFIX = "tank10_" //当前版本 VERSION = "1.0.5" )
const ( //游客身份 USER_ROLE_GUEST = "GUEST" //普通注册用户 USER_ROLE_USER = "USER" //管理员 USER_ROLE_ADMINISTRATOR = "ADMINISTRATOR" )
const ( USER_GENDER_MALE = "MALE" USER_GENDER_FEMALE = "FEMALE" USER_GENDER_UNKNOWN = "UNKNOWN" )
const ( //正常状态 USER_STATUS_OK = "OK" //被禁用 USER_STATUS_DISABLED = "DISABLED" )
const ( //正常 RESULT_CODE_OK = 200 //未登录 RESULT_CODE_LOGIN = -400 //没有权限 RESULT_CODE_UNAUTHORIZED = -401 //请求错误 RESULT_CODE_BAD_REQUEST = -402 //没有找到 RESULT_CODE_NOT_FOUND = -404 //登录过期 RESULT_CODE_LOGIN_EXPIRED = -405 //该登录用户不是有效用户 RESULT_CODE_LOGIN_INVALID = -406 //提交的表单验证不通过 RESULT_CODE_FORM_INVALID = -410 //请求太频繁 RESULT_CODE_FREQUENCY = -420 //服务器出错。 RESULT_CODE_SERVER_ERROR = -500 //远程服务不可用 RESULT_CODE_NOT_AVAILABLE = -501 //并发异常 RESULT_CODE_CONCURRENCY = -511 //远程微服务没有找到 RESULT_CODE_SERVICE_NOT_FOUND = -600 //远程微服务连接超时 RESULT_CODE_SERVICE_TIME_OUT = -610 //通用的异常 RESULT_CODE_UTIL_EXCEPTION = -700 )
Variables ¶
var ( CONFIG = &Config{ ServerPort: 6010, LogToConsole: true, LogPath: "", MatterPath: "", MysqlPort: 3306, MysqlHost: "127.0.0.1", MysqlSchema: "tank", MysqlUsername: "tank", MysqlPassword: "tank123", MysqlUrl: "%MysqlUsername:%MysqlPassword@tcp(%MysqlHost:%MysqlPort)/%MysqlSchema?charset=utf8&parseTime=True&loc=Local", AdminUsername: "admin", AdminEmail: "admin@tank.eyeblue.cn", AdminPassword: "123456", } )
如果你需要在本地127.0.0.1创建默认的数据库和账号,使用以下语句。 create database tank; grant all privileges on tank.* to tank identified by 'tank123'; flush privileges;
你也可以在运行时的参数中临时修改一些配置项:
-MysqlHost=127.0.0.1 -MysqlPort=3306 -MysqlSchema=tank -MysqlUsername=tank -MysqlPassword=tank123
Functions ¶
func GetConfPath ¶
func GetConfPath() string
获取配置文件存放的位置 例如:C:\Users\lishuang\AppData\Local\Temp/conf
func GetHtmlPath ¶
func GetHtmlPath() string
获取前端静态资源的位置。如果你在开发模式下,可以将这里直接返回tank/build下面的html路径。 例如:C:/Users/lishuang/AppData/Local/Temp/html
func GetUserFilePath ¶
获取某个用户文件应该存放的位置。这个是相对GetFilePath的路径 例如:/zicla/2006-01-02/1510122428000
func LogWarning ¶
func LogWarning(content string)
func MakeDirAll ¶ added in v1.0.3
如果文件夹存在就不管,不存在就创建。 例如:/var/www/matter
func MatchBcrypt ¶
func ValidateEmail ¶ added in v1.0.2
Types ¶
type AlienController ¶
type AlienController struct { BaseController // contains filtered or unexported fields }
func (*AlienController) CheckRequestUser ¶
func (this *AlienController) CheckRequestUser(email, password string) *User
直接使用邮箱和密码获取用户
func (*AlienController) Confirm ¶
func (this *AlienController) Confirm(writer http.ResponseWriter, request *http.Request) *WebResult
系统中的用户x 拿着某个文件的uuid来确认是否其信任的用户已经上传好了。
func (*AlienController) Crawl ¶ added in v1.0.5
func (this *AlienController) Crawl(writer http.ResponseWriter, request *http.Request) *WebResult
给一个指定的url,从该url中去拉取文件回来。
func (*AlienController) Download ¶
func (this *AlienController) Download(writer http.ResponseWriter, request *http.Request, uuid string, filename string)
下载一个文件。既可以使用登录的方式下载,也可以使用授权的方式下载。
func (*AlienController) FetchDownloadToken ¶
func (this *AlienController) FetchDownloadToken(writer http.ResponseWriter, request *http.Request) *WebResult
系统中的用户x要获取一个DownloadToken,用于提供给x信任的用户下载文件。
func (*AlienController) FetchUploadToken ¶
func (this *AlienController) FetchUploadToken(writer http.ResponseWriter, request *http.Request) *WebResult
系统中的用户x要获取一个UploadToken,用于提供给x信任的用户上传文件。
func (*AlienController) HandleRoutes ¶
func (this *AlienController) HandleRoutes(writer http.ResponseWriter, request *http.Request) (func(writer http.ResponseWriter, request *http.Request), bool)
处理一些特殊的接口,比如参数包含在路径中,一般情况下,controller不将参数放在url路径中
func (*AlienController) RegisterRoutes ¶
func (this *AlienController) RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
注册自己的路由。
func (*AlienController) Upload ¶
func (this *AlienController) Upload(writer http.ResponseWriter, request *http.Request) *WebResult
系统中的用户x 信任的用户上传文件。这个接口需要支持跨域。
type Base ¶
type BaseController ¶
type BaseController struct { Bean // contains filtered or unexported fields }
func (*BaseController) Error ¶
func (this *BaseController) Error(err interface{}) *WebResult
返回错误的结果。
func (*BaseController) HandleRoutes ¶
func (this *BaseController) HandleRoutes(writer http.ResponseWriter, request *http.Request) (func(writer http.ResponseWriter, request *http.Request), bool)
处理一些特殊的接口,比如参数包含在路径中,一般情况下,controller不将参数放在url路径中
func (*BaseController) Init ¶
func (this *BaseController) Init(context *Context)
func (*BaseController) RegisterRoutes ¶
func (this *BaseController) RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
注册自己的路由。
func (*BaseController) Success ¶
func (this *BaseController) Success(data interface{}) *WebResult
返回成功的结果。
func (*BaseController) Wrap ¶
func (this *BaseController) Wrap(f func(writer http.ResponseWriter, request *http.Request) *WebResult, qualifiedRole string) func(w http.ResponseWriter, r *http.Request)
需要进行登录验证的wrap包装
type Bean ¶
type Bean struct {
// contains filtered or unexported fields
}
func (*Bean) PanicWebError ¶ added in v1.0.4
处理错误的统一方法
type Config ¶
type Config struct { //默认监听端口号 ServerPort int //将日志输出到控制台。 LogToConsole bool //日志的保存路径,要求不以/结尾。如果没有指定,默认在根目录下的log文件夹中。eg: /var/log/tank LogPath string //上传的文件路径,要求不以/结尾。如果没有指定,默认在根目录下的matter文件夹中。eg: /var/www/matter MatterPath string //mysql相关配置。 //数据库端口 MysqlPort int //数据库Host MysqlHost string //数据库名字 MysqlSchema string //用户名 MysqlUsername string //密码 MysqlPassword string //数据库连接信息。 MysqlUrl string //超级管理员用户名,只能包含英文和数字 AdminUsername string //超级管理员邮箱 AdminEmail string //超级管理员密码 AdminPassword string }
依赖外部定义的变量。
type Context ¶
type Context struct { //数据库连接 DB *gorm.DB //处理所有路由请求 Router *Router //各类的Bean Map。这里面是包含ControllerMap中所有元素 BeanMap map[string]IBean //只包含了Controller的map ControllerMap map[string]IController }
上下文,管理数据库连接,管理所有路由请求,管理所有的单例component.
type DownloadToken ¶
type DownloadToken struct { Base UserUuid string `json:"userUuid"` MatterUuid string `json:"matterUuid"` ExpireTime time.Time `json:"expireTime"` Ip string `json:"ip"` }
func (DownloadToken) TableName ¶
func (DownloadToken) TableName() string
type DownloadTokenDao ¶
type DownloadTokenDao struct {
BaseDao
}
func (*DownloadTokenDao) CheckByUuid ¶
func (this *DownloadTokenDao) CheckByUuid(uuid string) *DownloadToken
按照Id查询
func (*DownloadTokenDao) Create ¶
func (this *DownloadTokenDao) Create(downloadToken *DownloadToken) *DownloadToken
创建一个session并且持久化到数据库中。
func (*DownloadTokenDao) FindByUuid ¶
func (this *DownloadTokenDao) FindByUuid(uuid string) *DownloadToken
按照Id查询
func (*DownloadTokenDao) Save ¶
func (this *DownloadTokenDao) Save(downloadToken *DownloadToken) *DownloadToken
修改一个downloadToken
type IController ¶
type IController interface { IBean //注册自己固定的路由。 RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request) //处理一些特殊的路由。 HandleRoutes(writer http.ResponseWriter, request *http.Request) (func(writer http.ResponseWriter, request *http.Request), bool) }
type Matter ¶
type Matter struct { Base Puuid string `json:"puuid"` UserUuid string `json:"userUuid"` Dir bool `json:"dir"` Alien bool `json:"alien"` Name string `json:"name"` Md5 string `json:"md5"` Size int64 `json:"size"` Privacy bool `json:"privacy"` Path string `json:"path"` Parent *Matter `gorm:"-" json:"parent"` }
*
- 文件。alien表示是否是应用内使用的文件,比如说蓝眼云盘的头像,alien = true 这种文件在上传时不需要指定存放目录,会统一放在同一个文件夹下。
type MatterController ¶
type MatterController struct { BaseController // contains filtered or unexported fields }
func (*MatterController) ChangePrivacy ¶
func (this *MatterController) ChangePrivacy(writer http.ResponseWriter, request *http.Request) *WebResult
改变一个文件的公私有属性
func (*MatterController) Crawl ¶ added in v1.0.5
func (this *MatterController) Crawl(writer http.ResponseWriter, request *http.Request) *WebResult
从一个Url中去爬取资源
func (*MatterController) CreateDirectory ¶
func (this *MatterController) CreateDirectory(writer http.ResponseWriter, request *http.Request) *WebResult
创建一个文件夹。
func (*MatterController) Delete ¶
func (this *MatterController) Delete(writer http.ResponseWriter, request *http.Request) *WebResult
删除一个文件
func (*MatterController) DeleteBatch ¶
func (this *MatterController) DeleteBatch(writer http.ResponseWriter, request *http.Request) *WebResult
删除一系列文件。
func (*MatterController) Detail ¶
func (this *MatterController) Detail(writer http.ResponseWriter, request *http.Request) *WebResult
查看某个文件的详情。
func (*MatterController) Move ¶
func (this *MatterController) Move(writer http.ResponseWriter, request *http.Request) *WebResult
将一个文件夹或者文件移入到另一个文件夹下。
func (*MatterController) Page ¶
func (this *MatterController) Page(writer http.ResponseWriter, request *http.Request) *WebResult
按照分页的方式获取某个文件夹下文件和子文件夹的列表,通常情况下只有一页。
func (*MatterController) RegisterRoutes ¶
func (this *MatterController) RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
注册自己的路由。
func (*MatterController) Rename ¶
func (this *MatterController) Rename(writer http.ResponseWriter, request *http.Request) *WebResult
重命名一个文件或一个文件夹
func (*MatterController) Upload ¶
func (this *MatterController) Upload(writer http.ResponseWriter, request *http.Request) *WebResult
上传文件
type MatterDao ¶
type MatterDao struct {
BaseDao
}
func (*MatterDao) CheckByUuidAndUserUuid ¶ added in v1.0.2
按照id和userUuid来查找。找不到抛异常。
func (*MatterDao) CountByUserUuidAndPuuidAndDirAndName ¶
func (this *MatterDao) CountByUserUuidAndPuuidAndDirAndName(userUuid string, puuid string, dir bool, name string) int
统计某个用户的某个文件夹下的某个名字的文件(或文件夹)数量。
func (*MatterDao) FindByUserUuidAndPuuidAndNameAndDirTrue ¶
func (this *MatterDao) FindByUserUuidAndPuuidAndNameAndDirTrue(userUuid string, puuid string, name string) *Matter
按照名字查询文件夹
func (*MatterDao) ListByUserUuidAndPuuidAndDirAndName ¶
func (this *MatterDao) ListByUserUuidAndPuuidAndDirAndName(userUuid string, puuid string, dir bool, name string) []*Matter
获取某个用户的某个文件夹下的某个名字的文件(或文件夹)列表
type MatterService ¶
type MatterService struct { Bean // contains filtered or unexported fields }
@Service
func (*MatterService) Crawl ¶ added in v1.0.5
func (this *MatterService) Crawl(url string, filename string, user *User, puuid string, privacy bool) *Matter
去指定的url中爬文件
func (*MatterService) Detail ¶ added in v1.0.2
func (this *MatterService) Detail(uuid string) *Matter
获取某个文件的详情,会把父级依次倒着装进去。如果中途出错,直接抛出异常。
func (*MatterService) DownloadFile ¶ added in v1.0.4
func (this *MatterService) DownloadFile(writer http.ResponseWriter, request *http.Request, matter *Matter)
文件下载功能。 下载功能参考:https://github.com/Masterminds/go-fileserver
func (*MatterService) GetDirUuid ¶
func (this *MatterService) GetDirUuid(userUuid string, dir string) string
根据一个文件夹路径,找到最后一个文件夹的uuid,如果中途出错,返回err.
func (*MatterService) ResizeImage ¶ added in v1.0.4
func (this *MatterService) ResizeImage(writer http.ResponseWriter, request *http.Request, matter *Matter)
图片预处理功能。
type Pager ¶
type Pager struct { Page int `json:"page"` PageSize int `json:"pageSize"` TotalItems int `json:"totalItems"` TotalPages int `json:"totalPages"` Data interface{} `json:"data"` }
分页类
type Preference ¶
type Preference struct { Base Name string `json:"name"` LogoUrl string `json:"logoUrl"` FaviconUrl string `json:"faviconUrl"` Version string `json:"version"` }
func (Preference) TableName ¶
func (Preference) TableName() string
set File's table name to be `profiles`
type PreferenceController ¶
type PreferenceController struct { BaseController // contains filtered or unexported fields }
func (*PreferenceController) Edit ¶
func (this *PreferenceController) Edit(writer http.ResponseWriter, request *http.Request) *WebResult
修改
func (*PreferenceController) Fetch ¶
func (this *PreferenceController) Fetch(writer http.ResponseWriter, request *http.Request) *WebResult
查看某个偏好设置的详情。
func (*PreferenceController) RegisterRoutes ¶
func (this *PreferenceController) RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
注册自己的路由。
type PreferenceDao ¶
type PreferenceDao struct {
BaseDao
}
func (*PreferenceDao) Create ¶
func (this *PreferenceDao) Create(preference *Preference) *Preference
创建
func (*PreferenceDao) Save ¶
func (this *PreferenceDao) Save(preference *Preference) *Preference
修改一个偏好设置
type PreferenceService ¶
type PreferenceService struct { Bean // contains filtered or unexported fields }
@Service
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
用于处理所有前来的请求
func (*Router) GlobalPanicHandler ¶
func (this *Router) GlobalPanicHandler(writer http.ResponseWriter, request *http.Request)
全局的异常捕获
type Session ¶
type SessionDao ¶
type SessionDao struct {
BaseDao
}
func (*SessionDao) CheckByUuid ¶
func (this *SessionDao) CheckByUuid(uuid string) *Session
按照Id查询session.
func (*SessionDao) Create ¶
func (this *SessionDao) Create(session *Session) *Session
创建一个session并且持久化到数据库中。
func (*SessionDao) Delete ¶
func (this *SessionDao) Delete(uuid string)
func (*SessionDao) FindByAuthentication ¶
func (this *SessionDao) FindByAuthentication(authentication string) *Session
按照authentication查询用户。
func (*SessionDao) FindByUuid ¶
func (this *SessionDao) FindByUuid(uuid string) *Session
按照Id查询session.
type UploadToken ¶
type UploadToken struct { Base UserUuid string `json:"userUuid"` FolderUuid string `json:"folderUuid"` MatterUuid string `json:"matterUuid"` ExpireTime time.Time `json:"expireTime"` Filename string `json:"filename"` Privacy bool `json:"privacy"` Size int64 `json:"size"` Ip string `json:"ip"` }
func (UploadToken) TableName ¶
func (UploadToken) TableName() string
type UploadTokenDao ¶
type UploadTokenDao struct {
BaseDao
}
func (*UploadTokenDao) Create ¶
func (this *UploadTokenDao) Create(uploadToken *UploadToken) *UploadToken
创建一个session并且持久化到数据库中。
func (*UploadTokenDao) FindByUuid ¶
func (this *UploadTokenDao) FindByUuid(uuid string) *UploadToken
按照Id查询
func (*UploadTokenDao) Save ¶
func (this *UploadTokenDao) Save(uploadToken *UploadToken) *UploadToken
修改一个uploadToken
type User ¶
type User struct { Base Role string `json:"role"` Username string `json:"username"` Password string `json:"-"` Email string `json:"email"` Phone string `json:"phone"` Gender string `json:"gender"` City string `json:"city"` AvatarUrl string `json:"avatarUrl"` LastIp string `json:"lastIp"` LastTime time.Time `json:"lastTime"` SizeLimit int64 `json:"sizeLimit"` Status string `json:"status"` }
type UserController ¶
type UserController struct {
BaseController
}
func (*UserController) ChangePassword ¶
func (this *UserController) ChangePassword(writer http.ResponseWriter, request *http.Request) *WebResult
用户修改密码
func (*UserController) Create ¶
func (this *UserController) Create(writer http.ResponseWriter, request *http.Request) *WebResult
创建一个用户
func (*UserController) Detail ¶
func (this *UserController) Detail(writer http.ResponseWriter, request *http.Request) *WebResult
获取用户详情
func (*UserController) Disable ¶
func (this *UserController) Disable(writer http.ResponseWriter, request *http.Request) *WebResult
禁用用户
func (*UserController) Edit ¶
func (this *UserController) Edit(writer http.ResponseWriter, request *http.Request) *WebResult
编辑一个用户的资料。
func (*UserController) Enable ¶
func (this *UserController) Enable(writer http.ResponseWriter, request *http.Request) *WebResult
启用用户
func (*UserController) Login ¶
func (this *UserController) Login(writer http.ResponseWriter, request *http.Request) *WebResult
使用用户名和密码进行登录。 参数: @email:邮箱 @password:密码
func (*UserController) Logout ¶
func (this *UserController) Logout(writer http.ResponseWriter, request *http.Request) *WebResult
退出登录
func (*UserController) Page ¶
func (this *UserController) Page(writer http.ResponseWriter, request *http.Request) *WebResult
获取用户列表 管理员的权限。
func (*UserController) RegisterRoutes ¶
func (this *UserController) RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
注册自己的路由。
func (*UserController) ResetPassword ¶
func (this *UserController) ResetPassword(writer http.ResponseWriter, request *http.Request) *WebResult
管理员重置用户密码
type UserDao ¶
type UserDao struct {
BaseDao
}
func (*UserDao) CheckByUuid ¶
按照Id查询用户,找不到抛panic
func (*UserDao) CountByUsername ¶
查询某个用户名是否已经有用户了
Source Files ¶
- alien_controller.go
- base_controller.go
- base_dao.go
- base_model.go
- bean.go
- config.go
- context.go
- download_token_dao.go
- download_token_model.go
- install.go
- matter_controller.go
- matter_dao.go
- matter_model.go
- matter_service.go
- preference_controller.go
- preference_dao.go
- preference_model.go
- preference_service.go
- router.go
- session_dao.go
- session_model.go
- sql_builder.go
- upload_token_dao.go
- upload_token_model.go
- user_controller.go
- user_dao.go
- user_model.go
- util_encode.go
- util_log.go
- util_mime.go
- util_network.go
- util_path.go
- util_string.go
- util_validation.go
- web_error.go
- web_result.go