nbus

package
v0.0.0-...-2c5cb3b Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseService

type BaseService struct {
	Ctx *context.Context
	// contains filtered or unexported fields
}

func (*BaseService) Logger

func (self *BaseService) Logger() *zerolog.Logger

func (*BaseService) ResetLogger

func (self *BaseService) ResetLogger()

type CommonService

type CommonService struct {
	BaseService
}

func NewCommonService

func NewCommonService(ctx *context.Context) *CommonService

func (*CommonService) CreateNewVerifyCode

func (self *CommonService) CreateNewVerifyCode(notifyType, notifyTo string) error

func (*CommonService) VerifyCode

func (self *CommonService) VerifyCode(code string) bool

type LoginStateService

type LoginStateService struct {
	BaseService
	// contains filtered or unexported fields
}

LoginStateService 登录状态管理

主要登录逻辑:

  1. GetUser: 登录状态检测,如果当前未登录,直接截断请求,并返回 http code 401;当请求头包含明确的登录方式 header 'nb-user-type' 字段时,按具体的登录方式返回 http body 内容;否则 body 内容为空

func NewLoginStateService

func NewLoginStateService(ctx *context.Context) *LoginStateService

func (*LoginStateService) EmailLogin

func (self *LoginStateService) EmailLogin(exId, exPassword string) (*nbum.User, error)

func (*LoginStateService) GetUser

func (self *LoginStateService) GetUser() *nbum.User

func (*LoginStateService) IsSignReq

func (self *LoginStateService) IsSignReq() bool

func (*LoginStateService) JustGetUser

func (self *LoginStateService) JustGetUser() *nbum.User

func (*LoginStateService) Logout

func (self *LoginStateService) Logout()

func (*LoginStateService) WXInitAccessTokenByCode

func (self *LoginStateService) WXInitAccessTokenByCode(code string) error

type UserService

type UserService struct {
	BaseService
}

func NewUserService

func NewUserService(ctx *context.Context) *UserService

func (*UserService) BindNewLoginTypeForUser

func (self *UserService) BindNewLoginTypeForUser(userId int64, exType, exId, exPassword string, o ...orm.Ormer) (
	ult *nbum.UserLoginTypes, err error)

func (*UserService) CreateNewUserWithLoginType

func (self *UserService) CreateNewUserWithLoginType(u *nbum.User, exType, exId, exPassword string) (err error)

func (*UserService) GetRequestUserType

func (self *UserService) GetRequestUserType() string

GetRequestUserType 获取用户登录方式 如果 http header 指定 nb-user-type,这优先按 header 指定的方式处理;服务端可配置默认的处理方式;兜底为 unkown

func (*UserService) GetUserByExternalInfo

func (self *UserService) GetUserByExternalInfo(exType, exId, exPassword string) (u *nbum.User, err error)

Jump to

Keyboard shortcuts

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