Documentation ¶
Overview ¶
用户中心模块 说来说去,还是只实现了基础的功能,要抓紧时间完善
Index ¶
- Variables
- func APIGETUser(c *gin.Context)
- func APIGETUsers(c *gin.Context)
- func APIGETUsersBySearch(c *gin.Context)
- func APIPOSTToken(c *gin.Context)
- func APIPUTUser(c *gin.Context)
- func APIPUTUserClose(c *gin.Context)
- func AddUser(account string, password string) (uint64, error)
- func GETUserByID(uid uint64) (*model.DBUsers, error)
- func GETUserByLogin(login string) (*model.DBUsers, error)
- func GETUserByOpenid(openid string) (*model.DBUsers, error)
- func GETUsers(offset int, count int) ([]model.DBUsers, error)
- func GETUsersBySQL(sqlStr string) (*[]model.DBUsers, error)
- func GETUsersCount() (int, error)
- func GetLogin(c *gin.Context)
- func GetLogout(c *gin.Context)
- func GetRegister(c *gin.Context)
- func GetUser(c *gin.Context)
- func GetUsers(c *gin.Context)
- func LoginByAccount(account string, password string) (*wpsapi.User, error)
- func LoginByUserLogin(userLogin string, userPass string) (*model.DBUsers, error)
- func NewJWT(userID uint64, number string, userLogin string) (string, error)
- func NewNumber(uid uint64) string
- func NewNumberByLastInsertID(id int64) string
- func NewUser() wpsapi.User
- func PUTUser(uid uint64, phone string, email string, oldPassword string, newPassword string, ...) (sql.Result, error)
- func PUTUserClose(uid uint64) (putUID uint64, err error)
- func PostLogin(c *gin.Context)
- func PostRegister(c *gin.Context)
- func PostUserByOpenid(openid string) (uint64, error)
- func PostUserByWechat(openid string, displayName string, wechatHeadImgURL string, sex int) (uint64, error)
- func PostWechatUser(openid string, displayName string, wechatHeadImgURL string, sex int) (sql.Result, error)
- func Register()
- func RegisterByAccount(account string, password string) (uint64, error)
- func UserByUserLogin(userLogin string) (*wpsapi.User, error)
- func UserPassword(uid uint64, password string) error
- func UsersSearch(keyword string) (users *[]model.DBUsers, err error)
- type APIGETTokenForm
- type APIGETUserForm
- type APIGETUsersBySearchForm
- type APIPUTUserCloseForm
- type APIPUTUserForm
- type Claims
- type FormPostLogin
- type FormPostRegister
- type GETUserAction
- type JSONAccessToken
Constants ¶
This section is empty.
Variables ¶
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 APIGETUsers ¶
APIGETUsers 获取用户数据 @since 0.0.4 @since 0.0.9 增加积分字段返回
func APIGETUsersBySearch ¶
APIGETUsersSearch 用户的模糊搜索 @since 0.0.7
func AddUser ¶
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 GETUserByLogin ¶
GETUserByLogin 通过登陆账号获取用户 @since 0.0.4
func GETUserByOpenid ¶
GETUserByOpenid 通过微信 openid 查找用户 @since 0.0.4 @since 0.0.6 重写sql
func GETUsers ¶
GETUsers 获取用户数据 @since 0.0.4
func GETUsersBySQL ¶
GETUsersBySQL 直接传入 sql 进行查询
func LoginByAccount ¶
LoginByAccount 通过账号登录 @since 0.0.1 @since 0.0.10 防止泄露密码
func LoginByUserLogin ¶
TODO 和上面的方法合并,先确认引用链路无问题 @since 0.0.10
func NewJWT ¶
NewJWT 创建token @since 0.0.10 从 wechat 包 拷贝过来的 后面要想办法合并
func PUTUser ¶
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 PostUserByOpenid ¶
PostUserByOpenid @since 0.0.4 通过openid 注册用户 使用场景 只有 openid 刚关注公众号,或没有授权使用个人信息的时候
func PostUserByWechat ¶
func PostUserByWechat(openid string, displayName string, wechatHeadImgURL string, sex int) (uint64, error)
PostUserByWechat @since 0.0.4 通过微信注册 (网页授权,通过 openid 获取到完整信息后)
func PostWechatUser ¶
func PostWechatUser(openid string, displayName string, wechatHeadImgURL string, sex int) (sql.Result, error)
PostWechatUser 添加微信用户 @since 0.0.4 TODO 将用户注册抽成独立的一个方法 不能这种分开对model层的 在抽离的注册方法中 实现用户 Number 也就是外码的首次生成逻辑
func RegisterByAccount ¶
RegisterByAccount 通过账号登录 @since 0.0.1 @since 0.0.9 补全注册方法
func UserByUserLogin ¶
UserByUserLogin 通过用户名查询用户 @since 0.0.1
func UserPassword ¶
UserPassword 检查用户名密码 @since 0.0.4
Types ¶
type APIGETTokenForm ¶
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 ¶
type APIGETUserForm struct { Action string `json:"action" form:"action"` Account string `json:"account" form:"account"` }
APIGETUserForm 表单 @since 0.0.4
type APIGETUsersBySearchForm ¶
type APIGETUsersBySearchForm struct {
Keyword string `form:"keyword" binding:"required"`
}
type APIPUTUserCloseForm ¶
type APIPUTUserCloseForm struct {
UID uint64 `binding:"required" form:"uid"`
}
type APIPUTUserForm ¶
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 ¶
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 ¶
type GETUserAction string
GETUserAction 获取用户的多种方式 @since 0.0.4
const ( GETUserActionLogin GETUserAction = "login" GETUserActionID GETUserAction = "id" GETUserOpenid GETUserAction = "openid" )
获取用户的多种方式 @since 0.0.4