Documentation ¶
Index ¶
- Constants
- func UpdateLoginStatus(token string, status int) error
- type Login
- type User
- func (u User) CheckPassword() bool
- func (u User) FindAll() ([]User, error)
- func (u User) FindOne() (User, error)
- func (u User) FindPageFilter(page, limit int, query, selector interface{}, fields ...string) ([]User, error)
- func (u User) FindPageTreeFilter(page, limit int, query, selector interface{}, fields ...string) ([]User, error)
- func (u User) FindRoles() (User, error)
- func (u User) FindTreeOne() (User, error)
- func (u *User) Insert() error
- func (u User) Remove() error
- func (u User) ToJson() string
- func (u User) TotalCount(query, selector interface{}) (int, error)
- func (u User) Update() error
- func (u User) UpdateAvatar() error
- func (u User) UpdateMail() error
- func (u User) UpdatePassword() error
Constants ¶
View Source
const ( //StatusNormal = 0 StatusLogin = 1 StatusLogout = 2 )
View Source
const ( //UserPermissionAll = "USER_ALL" UserPermissionSelect = "USER_SELECT" UserPermissionCreate = "USER_CREATE" UserPermissionEdit = "USER_EDIT" UserPermissionDelete = "USER_DELETE" )
Variables ¶
This section is empty.
Functions ¶
func UpdateLoginStatus ¶
status 0 退出登录,1 登录
return mongo.Update(shareDB.DocManagerDBName(), todoCollection, bson.M{"_id": t.Id}, bson.M{"$set": bson.M{"title": t.Title, "completed": t.Completed, "updated_at": t.UpdatedAt}})
Types ¶
type Login ¶
type Login struct { Id int64 `json:"id,omitempty" bson:"_id,omitempty"` UserId int64 `bson:"user_id"` // 用户ID Token string `bson:"token"` // 用户TOKEN CreateTime int64 `bson:"create_time"` // 登录日期 LoginIp string `bson:"login_ip"` // 登录IP Status state `bson:"status"` //status 1 已登录,2表示退出登录 Forbidden bool `bson:"forbidden"` //false 表示未禁言 UserAgent string `bson:"user_agent"` //用户UA UpdatedAt int64 `json:"updated_at,omitempty" bson:"updated_at"` }
func FindLoginByToken ¶
type User ¶
type User struct { Id int64 `json:"id,omitempty" bson:"_id,omitempty"` Username string `json:"username,omitempty" bson:"username,omitempty"` //用户名 Password string `json:"password,omitempty" bson:"password,omitempty"` Avatar string `json:"avatar,omitempty" bson:"avatar,omitempty"` Email string `json:"email,omitempty" bson:"email,omitempty"` Phone string `json:"phone,omitempty" bson:"phone,omitempty"` Gender int `json:"gender,omitempty" bson:"gender,omitempty"` // 1男 2女 Name string `json:"name,omitempty" bson:"name,omitempty"` // 名字! Nick string `json:"nick,omitempty" bson:"nick,omitempty"` // 昵称 Title string `json:"title,omitempty" bson:"title,omitempty"` Enabled bool `json:"enabled,omitempty" bson:"enabled"` //1 激活, Note string `json:"note,omitempty" bson:"note,omitempty"` //备注, CreateTime int64 `json:"createTime,omitempty" bson:"create_time,omitempty"` Roles []model_role.Role `json:"roles,omitempty" bson:"roles,omitempty"` RolesString []string `json:"roles_string,omitempty" bson:"roles_string,omitempty"` Permissions []string `json:"permissions,omitempty" bson:"permissions,omitempty"` }
func (User) CheckPassword ¶
func (User) FindPageFilter ¶
func (User) FindPageTreeFilter ¶
func (User) FindTreeOne ¶
func (User) TotalCount ¶
func (User) UpdateAvatar ¶
func (User) UpdateMail ¶
func (User) UpdatePassword ¶
Click to show internal directories.
Click to hide internal directories.