user

package
v0.0.0-...-478090f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionMarkUser = "user_info"
)

Variables

This section is empty.

Functions

func CheckNickName

func CheckNickName(nickname string) bool

检查昵称是否符合规范(目前仅检查唯一性),存在返回false,否则true

func CheckPassport

func CheckPassport(passport string) bool

检查账号是否符合规范(目前仅检查唯一性),存在返回false,否则true

func GetProfile

func GetProfile(session *ghttp.Session) (u *user.Entity)

获得用户信息详情

func IsSignedIn

func IsSignedIn(session *ghttp.Session) bool

判断用户是否已经登录

func Register

func Register(data *VoRegisterRequest) error

用户注册

func SignIn

func SignIn(passport, password string, session *ghttp.Session) error

用户登录,成功返回用户信息,否则返回nil; passport应当会md5值字符串

func SignOut

func SignOut(session *ghttp.Session) error

用户注销

Types

type VoCheckNickName

type VoCheckNickName struct {
	Nickname string
}

账号唯一性检测请求参数,用于前后端交互参数格式约定

type VoCheckPassport

type VoCheckPassport struct {
	Passport string
}

账号唯一性检测请求参数,用于前后端交互参数格式约定

type VoCurrentUser

type VoCurrentUser struct {
	Name        string                 `json:"name" v:""`
	Avatar      string                 `json:"avatar" v:""`
	UserId      string                 `json:"userid" v:""`
	Email       string                 `json:"email" v:""`
	Signature   string                 `json:"signature" v:""`
	Title       string                 `json:"title" v:""`
	Group       string                 `json:"group" v:""`
	Tags        map[string]string      `json:"tags" v:""`
	NotifyCount int                    `json:"notifyCount" v:""`
	UnreadCount int                    `json:"unreadCount" v:""`
	Geographic  map[string]interface{} `json:"geographic" v:""`
	Address     string                 `json:"address" v:""`
	Phone       string                 `json:"phone" v:""`
}

当前登录的用户信息,用于前后端交互参数格式约定

type VoRegisterRequest

type VoRegisterRequest struct {
	Passport  string `v:"required|length:6,16#账号不能为空|账号长度应当在:min到:max之间"`
	Password  string `v:"required|length:6,16#请输入确认密码|密码长度应当在:min到:max之间"`
	Password2 string `v:"required|length:6,16|same:Password#密码不能为空|密码长度应当在:min到:max之间|两次密码输入不相等"`
	Nickname  string
}

注册输入对象,用于前后端交互参数格式约定

type VoSignIn

type VoSignIn struct {
	Passport string `v:"required#账号不能为空"`
	Password string `v:"required#密码不能为空"`
}

登录请求参数,用于前后端交互参数格式约定

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL