user

package
v0.0.0-...-4f3821b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StudentType = iota
	DesignerType
	PublicType
)
View Source
const (
	Success = iota
	E发起方不存在
	E越权
	E工作组不存在
	E受邀者未受认证
	E不得增加组长
	E未知错误 = 255
)
View Source
const (
	Normal = iota
	Manager
	Owner
)

Variables

View Source
var NoAccountError = errors.New("NO THIS ACCOUNT")
View Source
var UnauthorizedError = errors.New("THE ACCOUNT IS NOT AUTHORIZED")

Functions

func AddPeopleToWorkShop

func AddPeopleToWorkShop(do, who int64, workshop int32, position int16) uint8

func Authorized

func Authorized(who int64) bool

func ChangeMemberPosition

func ChangeMemberPosition(workshop int32, do int64, who int64, to int16) uint8

func ChangeWorkshop

func ChangeWorkshop(do int64, workshop int32, headImage int64) uint8

func ChangeWorkshopLevel

func ChangeWorkshopLevel(workshop int32, level int16) uint8

just call from the control platform

func CheckAuthorized

func CheckAuthorized(id int64) bool

func Follow

func Follow(doer, doee int64) bool

func GenPasswordInBack

func GenPasswordInBack(pw string) string

func LoadFollow

func LoadFollow(doer int64) ([]int64, error)

func LoadUserDescription

func LoadUserDescription(userId int64) (*ComplexString.ComplexString, error)

func MakePasswordInFront

func MakePasswordInFront(password string) string

func PrepareUserDir

func PrepareUserDir()

func PrepareWorkshopDir

func PrepareWorkshopDir()

func RemovePeopleFromWorkshop

func RemovePeopleFromWorkshop(do, who int64, workshop int32) uint8

func SaveUsersLongDescription

func SaveUsersLongDescription(new *ComplexString.ComplexString, who int64) error

func Unauthorized

func Unauthorized(who int64) bool

Types

type Designer

type Designer struct {
	Works []Work `json:"works"`
}

func (*Designer) Type

func (*Designer) Type() uint8

type Email

type Email string

func (*Email) CheckRight

func (e *Email) CheckRight() bool

type Identity

type Identity interface {
	Type() uint8
}

type Password

type Password string

func (*Password) CheckRight

func (p *Password) CheckRight() bool

type PhoneNumber

type PhoneNumber string

func (PhoneNumber) CheckRight

func (p PhoneNumber) CheckRight() bool

type Public

type Public struct {
	Industry int32 `json:"industry"`
	Position int32 `json:"position"`
}

func (*Public) Type

func (*Public) Type() uint8

type School

type School struct {
	Public  bool  `json:"public"`
	Diploma uint8 `json:"diploma"`
	Country int32 `json:"country"`
	Name    int32 `json:"name"`
}

type Student

type Student struct {
	Schools []School `json:"schools"`
}

func (*Student) Type

func (*Student) Type() uint8

type TimeJson

type TimeJson time.Time

func (*TimeJson) MarshalJSON

func (t *TimeJson) MarshalJSON() ([]byte, error)

func (*TimeJson) UnmarshalJSON

func (t *TimeJson) UnmarshalJSON(m []byte) (err error)

type UserBase

type UserBase struct {
	ID             int64  `json:"id"`
	UserName       string `json:"name"`
	Password       Password
	Email          Email    `json:"email"`
	Coin           uint64   `json:"coin"`
	FansNumber     uint64   `json:"fans_number"`    // 粉丝
	FollowerNumber uint64   `json:"follow_number"`  // 关注
	PassageNumber  uint64   `json:"passage_number"` // 文章总数
	HeadImage      int64    `json:"head_image"`
	BackImage      int64    `json:"back_image"`
	Identity       Identity `json:"identity"`
}

func LoadUserBase

func LoadUserBase(id int64) (*UserBase, uint8)

func LoginByEmail

func LoginByEmail(email Email, password Password) (*UserBase, uint8)

func LoginById

func LoginById(id int64, password Password) (*UserBase, uint8)

func (*UserBase) ChangePassword

func (u *UserBase) ChangePassword(oldPassword, newPassword Password) bool

func (*UserBase) SignUp

func (u *UserBase) SignUp() uint8

func (*UserBase) ToMini

func (u *UserBase) ToMini() *UserMini

func (*UserBase) Update

func (u *UserBase) Update() uint8

func (*UserBase) UpdateIdentity

func (u *UserBase) UpdateIdentity() bool

func (*UserBase) UpdateInTransition

func (u *UserBase) UpdateInTransition(tx *sql.Tx) error

func (*UserBase) UserType

func (u *UserBase) UserType() uint8

type UserMini

type UserMini struct {
	UserId    int64  `json:"id"`
	UserName  string `json:"name"`
	HeadImage int64  `json:"head_image"`
	Identity  uint8  `json:"identity"`
}

func GetOneUserMini

func GetOneUserMini(id int64) (*UserMini, bool)

func GetUserMini

func GetUserMini(ids []int64) []*UserMini

type Work

type Work struct {
	Start    TimeJson `json:"start"`
	End      TimeJson `json:"end"`
	Company  string   `json:"company"`
	Industry int32    `json:"industry"`
	Position int32    `json:"position"`
}

type WorkShopBase

type WorkShopBase struct {
	Member        []int64
	Position      []int16
	Id            int64
	Name          string
	HeadImage     int64
	FansNumber    int32
	PassageNumber int32
	Level         int16
}

type Workshop

type Workshop struct {
	*WorkShopBase
	LongDescription *ComplexString.ComplexString
}

func LoadWorkshop

func LoadWorkshop(id int64) (*Workshop, error)

func OpenWorkshop

func OpenWorkshop(name string, headImage int64, longDescription *ComplexString.ComplexString, who int64) (*Workshop, error)

type WorkshopMember

type WorkshopMember struct {
	UserId   int64
	Position int16
}

func ListWorkshopMember

func ListWorkshopMember(id int64) ([]WorkshopMember, error)

Jump to

Keyboard shortcuts

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