ucenter

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMethodNil          = errors.New("method 不能为空")
	ErrAccountNil         = errors.New("account 不能为空")
	ErrPasswordNil        = errors.New("password 不能为空")
	ErrMethodNotContain   = errors.New("method 值不合法")
	ErrRegisterIPNil      = errors.New("registerIP 不能为空")
	ErrResetIPNil         = errors.New("resetIP 不能为空")
	ErrUserRegisted       = errors.New("该用户已注册")
	ErrPasswordNotContain = errors.New("password 错误")
	ErrUserNotRegister    = errors.New("该用户未注册")
	ErrUIDNil             = errors.New("uid 不能为空")
	ErrHasGroup           = errors.New("group 已存在")
	ErrGroupTitleNil      = errors.New("groupTitle 不能为空")
	ErrTypesNil           = errors.New("types 不能为空")
	ErrHasUserGroup       = errors.New("用户已经是该组成员")
	ErrGIDNil             = errors.New("gid 不能为空")
	ErrStatusNil          = errors.New("status 不能为空")
	ErrGroupUIDNil        = errors.New("groupUID 不能为空")
	ErrGroupTypesNil      = errors.New("groupTypes 不能为空")
	ErrJoinedUserGroup    = errors.New("用户已是本用户组成员")
	ErrFUIDNil            = errors.New("fuid 不能为空")
	ErrIsFriend           = errors.New("已经是好友")
	ErrCodeNil            = errors.New("code 不能为空")
	ErrRealnameNil        = errors.New("realname 不能为空")
	ErrIDNil              = errors.New("id 不能为空")
	ErrStatusdNotContain  = errors.New("status 不合法")
	ErrFealnameNil        = errors.New("frealname 不能为空")
	ErrAppIDNil           = errors.New("app_id 不能为空")
	ErrUserLoginNil       = errors.New("user_login 不能为空")
	ErrUserPassNil        = errors.New("user_pass 不能为空")
	ErrOpenidNil          = errors.New("openid 不能为空")
	ErrSexNotInSwitch     = errors.New("sex 值不合法")
)

@since 0.0.1

Functions

func APIGETUser added in v0.0.5

func APIGETUser(c *gin.Context)

APIGETUser 获取用户 @since 0.0.4

func APIGETUsers added in v0.0.5

func APIGETUsers(c *gin.Context)

APIGETUsers 获取用户数据 @since 0.0.4 @since 0.0.9 增加积分字段返回

func APIGETUsersBySearch added in v0.0.7

func APIGETUsersBySearch(c *gin.Context)

APIGETUsersSearch 用户的模糊搜索 @since 0.0.7

func APIPOSTToken added in v0.0.11

func APIPOSTToken(c *gin.Context)

APIPOSTToken 用户获取 token @since 0.0.10

func APIPUTUser added in v0.0.5

func APIPUTUser(c *gin.Context)

APIPUTUser 修改用户信息 @since 0.0.4

func APIPUTUserClose added in v0.0.6

func APIPUTUserClose(c *gin.Context)

APIPUTUserClose 关停账号 @since 0.0.6

func AddUser

func AddUser(account string, password string) (uint64, error)

AddUser (RC-04) This command creates a new RBAC user. The command is valid only if the new user is not already a member of the USERS data set. The USER data set is updated. The new user does not own any session at the time of its creation. 此命令将创建一个新的RBAC用户。 仅当新用户不是USERS数据集的成员时,该命令才有效。 USER数据集已更新。 新用户在创建时不拥有任何会话。 @since 0.0.1 @since 0.0.4 增加用微信注册用户 @since 0.0.9 修改返回值类型

func GETUserByID added in v0.0.6

func GETUserByID(uid uint64) (*model.DBUsers, error)

func GETUserByLogin added in v0.0.5

func GETUserByLogin(login string) (*model.DBUsers, error)

GETUserByLogin 通过登陆账号获取用户 @since 0.0.4

func GETUserByOpenid added in v0.0.5

func GETUserByOpenid(openid string) (*model.DBUsers, error)

GETUserByOpenid 通过微信 openid 查找用户 @since 0.0.4 @since 0.0.6 重写sql

func GETUsers added in v0.0.5

func GETUsers(offset int, count int) ([]model.DBUsers, error)

GETUsers 获取用户数据 @since 0.0.4

func GETUsersBySQL added in v0.0.5

func GETUsersBySQL(sqlStr string) (*[]model.DBUsers, error)

GETUsersBySQL 直接传入 sql 进行查询

func GETUsersCount added in v0.0.5

func GETUsersCount() (int, error)

func GetLogin

func GetLogin(c *gin.Context)

GetLogin 后台登录 @since 0.0.1

func GetLogout

func GetLogout(c *gin.Context)

GetLogout 注销登录 @since 0.0.1

func GetRegister

func GetRegister(c *gin.Context)

GetRegister 注册页 @since 0.0.1

func GetUser added in v0.0.5

func GetUser(c *gin.Context)

GetUser 用户详情编辑页面 @since 0.0.4

func GetUsers added in v0.0.5

func GetUsers(c *gin.Context)

GetUsers 用户列表页面 @since 0.0.4

func LoginByAccount

func LoginByAccount(account string, password string) (*wpsapi.User, error)

LoginByAccount 通过账号登录 @since 0.0.1 @since 0.0.10 防止泄露密码

func LoginByUserLogin added in v0.0.11

func LoginByUserLogin(userLogin string, userPass string) (*model.DBUsers, error)

TODO 和上面的方法合并,先确认引用链路无问题 @since 0.0.10

func NewJWT added in v0.0.11

func NewJWT(userID uint64, number string, userLogin string) (string, error)

NewJWT 创建token @since 0.0.10 从 wechat 包 拷贝过来的 后面要想办法合并

func NewNumber added in v0.0.5

func NewNumber(uid uint64) string

func NewNumberByLastInsertID added in v0.0.5

func NewNumberByLastInsertID(id int64) string

func NewUser

func NewUser() wpsapi.User

NewUser 基础结构体 @since 0.0.1

func PUTUser added in v0.0.5

func PUTUser(uid uint64, phone string, email string, oldPassword string, newPassword string, defaultPassword bool, nicename string, sex int, number string) (sql.Result, error)

PUTUser 修改用户信息 @since 0.0.4

func PUTUserClose added in v0.0.6

func PUTUserClose(uid uint64) (putUID uint64, err error)

func PostLogin

func PostLogin(c *gin.Context)

PostLogin 提交登录 @since 0.0.1

func PostRegister

func PostRegister(c *gin.Context)

PostRegister 提交注册 @since 0.0.1

func PostUserByOpenid added in v0.0.5

func PostUserByOpenid(openid string) (uint64, error)

PostUserByOpenid @since 0.0.4 通过openid 注册用户 使用场景 只有 openid 刚关注公众号,或没有授权使用个人信息的时候

func PostUserByWechat added in v0.0.5

func PostUserByWechat(openid string, displayName string, wechatHeadImgURL string, sex int) (uint64, error)

PostUserByWechat @since 0.0.4 通过微信注册 (网页授权,通过 openid 获取到完整信息后)

func PostWechatUser added in v0.0.5

func PostWechatUser(openid string, displayName string, wechatHeadImgURL string, sex int) (sql.Result, error)

PostWechatUser 添加微信用户 @since 0.0.4 TODO 将用户注册抽成独立的一个方法 不能这种分开对model层的 在抽离的注册方法中 实现用户 Number 也就是外码的首次生成逻辑

func Register

func Register()

Register 注册 @since 0.0.1

func RegisterByAccount

func RegisterByAccount(account string, password string) (uint64, error)

RegisterByAccount 通过账号登录 @since 0.0.1 @since 0.0.9 补全注册方法

func UserByUserLogin

func UserByUserLogin(userLogin string) (*wpsapi.User, error)

UserByUserLogin 通过用户名查询用户 @since 0.0.1

func UserPassword added in v0.0.5

func UserPassword(uid uint64, password string) error

UserPassword 检查用户名密码 @since 0.0.4

func UsersSearch added in v0.0.7

func UsersSearch(keyword string) (users *[]model.DBUsers, err error)

Types

type APIGETTokenForm added in v0.0.11

type APIGETTokenForm struct {
	UserLogin string `form:"user_login" json:"user_login" binding:"required"`
	UserPass  string `form:"user_pass" json:"user_pass" binding:"required"`
}

@since 0.0.10 增加登录的 token 相关操作

type APIGETUserForm added in v0.0.5

type APIGETUserForm struct {
	Action  string `json:"action" form:"action"`
	Account string `json:"account" form:"account"`
}

APIGETUserForm 表单 @since 0.0.4

type APIGETUsersBySearchForm added in v0.0.7

type APIGETUsersBySearchForm struct {
	Keyword string `form:"keyword" binding:"required"`
}

type APIPUTUserCloseForm added in v0.0.6

type APIPUTUserCloseForm struct {
	UID uint64 `binding:"required" form:"uid"`
}

type APIPUTUserForm added in v0.0.5

type APIPUTUserForm struct {
	UID             uint64 `form:"uid"`
	Email           string `form:"email"`
	Phone           string `form:"phone"`
	OldPassword     string `form:"oldPassword"`
	NewPassword     string `form:"newPassword"`
	DefaultPassword bool   `form:"defaultPassword"`
	Nicename        string `form:"nicename"`
	Sex             int    `form:"sex"`
	Number          string `form:"number"`
}

APIPUTUserForm form @since 0.0.4

type Claims added in v0.0.11

type Claims struct {
	Number    string `json:"number"`
	UserLogin string `json:"user_login"`
	UserID    uint64 `json:"user_id"`
	jwt.StandardClaims
}

Claims 这里现在是微信认证用的 后面看看再提出来 @since 0.0.1 @since 0.0.10 也是拖过来的

type FormPostLogin

type FormPostLogin struct {
	Account  string `form:"account" binding:"required"`
	Password string `form:"password" binding:"required"`
}

FormPostLogin 提交登录表单 @since 0.0.1

type FormPostRegister

type FormPostRegister struct {
	Account  string `form:"account" binding:"required"`
	Password string `form:"password" binding:"required"`
}

FormPostRegister 提交注册表单 @since 0.0.1

type GETUserAction added in v0.0.5

type GETUserAction string

GETUserAction 获取用户的多种方式 @since 0.0.4

const (
	GETUserActionLogin GETUserAction = "login"
	GETUserActionID    GETUserAction = "id"
	GETUserOpenid      GETUserAction = "openid"
)

获取用户的多种方式 @since 0.0.4

type JSONAccessToken added in v0.0.11

type JSONAccessToken struct {
	g.JSONErr
	AccessToken string
}

JSONAccessToken token 结构 @since 0.0.1 @since 0.0.10 同样是拖过来的 BUG TODO 这里的 accessToken 应该放在JSONErr 的 data 字段中

Jump to

Keyboard shortcuts

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