users

package
v0.0.0-...-f5147e6 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GENDERS_TEXTS = []string{"男", "女"}
View Source
var GENDERS_VALUES = []string{"male", "female"}
View Source
var ROLES_TEXTS = []string{"管理员", "调度员", "师傅"}
View Source
var ROLES_VALUES = []string{"admin", "operator", "workman"}

Functions

func T2V

func T2V(tArr []string, vArr []string, t string) string

T2V Text To Value

func V2T

func V2T(vArr []string, tArr []string, t string) string

V2T Value To Text

Types

type Address

type Address struct {
	gorm.Model
	UserID      uint
	ContactName string `form:"contact-name"`
	Phone       string `form:"phone"`
	City        string `form:"city"`
	Address1    string `form:"address1"`
	Address2    string `form:"address2"`
}

func (Address) Stringify

func (address Address) Stringify() string

type AuthIdentity

type AuthIdentity struct {
	gorm.Model
	Provider          string // phone, email, wechat, github...
	UID               string
	EncryptedPassword string
	AuthInfo          AuthInfo
	UserID            string
	State             string // unconfirmed, confirmed, expired

	Password             string `gorm:"-"`
	PasswordConfirmation string `gorm:"-"`
}

type AuthInfo

type AuthInfo struct {
	PhoneVerificationCode       string
	PhoneVerificationCodeExpiry *time.Time
	PhoneConfirmedAt            *time.Time
	UnconfirmedPhone            string // only use when changing phone number

	EmailConfirmedAt *time.Time
	UnconfirmedEmail string // only use when changing email

	SignInCount uint
	SignLogs    []SignLog
}

type AvatarImageStorage

type AvatarImageStorage struct{ oss.OSS }

func (AvatarImageStorage) GetSizes

func (AvatarImageStorage) GetSizes() map[string]*media.Size

type Controller

type Controller struct {
}

Controller User Controller

func (Controller) AddCredit

func (Controller) AddCredit(w http.ResponseWriter, req *http.Request)

func (Controller) Orders

func (Controller) Orders(w http.ResponseWriter, req *http.Request)

func (Controller) Profile

func (Controller) Profile(w http.ResponseWriter, req *http.Request)

func (Controller) Update

func (Controller) Update(w http.ResponseWriter, req *http.Request)

type SignLog

type SignLog struct {
	UserAgent string
	At        *time.Time
	IP        string
}

//////////////////////////////////////////////////////////////////////////////

type User

type User struct {
	gorm.Model
	Email    string `form:"email"`
	Password string
	Name     string `form:"name"`
	Gender   string
	Role     string
	Birthday *time.Time

	// 身份证号码
	IdentityCardNum string
	// 手机号码
	MobilePhone string
	// 车牌号码
	CarLicencePlateNum string
	// 车型 东风小货
	CarType string
	// 驾照类型 C1
	CarLicenseType string
	// 是否临时工
	IsCasual bool

	JDAppUser string
	HireDate  *time.Time

	Balance                float32
	DefaultBillingAddress  uint `form:"default-billing-address"`
	DefaultShippingAddress uint `form:"default-shipping-address"`
	Addresses              []Address
	Avatar                 AvatarImageStorage

	// Confirm
	ConfirmToken string
	Confirmed    bool

	// Recover
	RecoverToken       string
	RecoverTokenExpiry *time.Time

	// Accepts
	AcceptPrivate bool `form:"accept-private"`
	AcceptLicense bool `form:"accept-license"`
	AcceptNews    bool `form:"accept-news"`
}

func (User) AvailableLocales

func (user User) AvailableLocales() []string

func (User) DisplayName

func (user User) DisplayName() string

type WechatProfile

type WechatProfile struct {
	gorm.Model

	Openid     string `json:"openid"`
	Unionid    string `json:"unionid"`
	Nickname   string `json:"nickname"`
	Sex        int    `json:"sex"`
	City       string `json:"city"`
	Province   string `json:"province"`
	Country    string `json:"country"`
	Headimgurl string `json:"headimgurl"`

	MobilePhone string `json:"mobile_phone"`
	Role        string
}

WechatProfile 微信资料

Jump to

Keyboard shortcuts

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