models

package
v0.0.0-...-8a2246e Latest Latest
Warning

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

Go to latest
Published: May 9, 2017 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AGENCY_OPR_CREATE_ORDER = iota
	AGENCY_OPR_DELETE_ORDER
	AGENCY_OPR_UPDATE_ORDER
)

Variables

View Source
var (
	OrderState = transition.New(&Order{})
	ItemState  = transition.New(&OrderItem{})
)
View Source
var (
	AGENCY_OPR_ORDER = []string{"创建订单", "删除订单", "更新订单"}
)

Functions

This section is empty.

Types

type Address

type Address struct {
	gorm.Model
	UserID      uint
	ContactName string
	Phone       string
	City        string
	Address1    string
	Address2    string
}

func (Address) Stringify

func (address Address) Stringify() string

type Agency

type Agency struct {
	gorm.Model
	CustomerID   uint
	Customer     Customer
	AgencyItemID uint
	AgencyItem   AgencyItem
	Balance      float32
}

type AgencyItem

type AgencyItem struct {
	gorm.Model
	Type   string
	Amount uint
	Rate   uint
}

func AgencyItems

func AgencyItems() []AgencyItem

func (AgencyItem) Stringify

func (ai AgencyItem) Stringify() string

func (AgencyItem) Validate

func (ai AgencyItem) Validate(db *gorm.DB)

type AgencyLog

type AgencyLog struct {
	gorm.Model
	CustomerID    uint
	Customer      Customer
	AgencyBalance float32
	Opr           string
	Desc          string
}

type Article

type Article struct {
	gorm.Model
	Author   User
	AuthorID uint
	Title    string
	Content  string `gorm:"type:text"`
	publish2.Version
	publish2.Schedule
	publish2.Visible
}

type Category

type Category struct {
	gorm.Model
	sorting.Sorting
	Name string
	Code string
}

func (Category) DefaultPath

func (category Category) DefaultPath() string

func (Category) Validate

func (category Category) Validate(db *gorm.DB)

type Chart

type Chart struct {
	Total string
	Date  time.Time
}

func GetChartData

func GetChartData(table, start, end string) (res []Chart)

date format 2015-01-23

type Collection

type Collection struct {
	gorm.Model
	Name string
}

type Color

type Color struct {
	gorm.Model
	sorting.Sorting
	Name string
	Code string `l10n:"sync"`
}

func (Color) Validate

func (color Color) Validate(db *gorm.DB)

type ColorVariation

type ColorVariation struct {
	gorm.Model
	ProductID      uint
	Product        Product
	ColorID        uint
	Color          Color
	ColorCode      string
	Images         media_library.MediaBox
	SizeVariations []SizeVariation
}

func (ColorVariation) ColorSizeInfo

func (colorVariation ColorVariation) ColorSizeInfo() string

func (ColorVariation) MainImageURL

func (colorVariation ColorVariation) MainImageURL() string

type ColorVariationImage

type ColorVariationImage struct {
	gorm.Model
	ColorVariationID uint
	Image            ColorVariationImageStorage `sql:"type:varchar(4096)"`
}

type ColorVariationImageStorage

type ColorVariationImageStorage struct{ oss.OSS }

func (ColorVariationImageStorage) GetSizes

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

type Customer

type Customer struct {
	gorm.Model
	Name   string // wx name
	Wechat string // wx id
	Phone  string
}

func (Customer) AvailableLocales

func (customer Customer) AvailableLocales() []string

func (Customer) DisplayName

func (customer Customer) DisplayName() string

type FeeSetting

type FeeSetting struct {
	ShippingFee     uint
	GiftWrappingFee uint
	CODFee          uint `gorm:"column:cod_fee"`
	TaxRate         int
}

type Material

type Material struct {
	gorm.Model
	l10n.Locale
	Name string
	Code string `l10n:"sync"`
}

type MediaLibrary

type MediaLibrary struct {
	Title string
	media_library.MediaLibrary
}

type Order

type Order struct {
	gorm.Model
	CustomerID    uint
	Customer      Customer
	PaymentAmount float32
	//AbandonedReason   string
	DiscountValue     uint
	TrackingNumber    *string
	ShippedAt         *time.Time
	ReturnedAt        *time.Time
	ShippingAddressID uint
	ShippingAddress   Address
	OrderItems        []OrderItem
	State             string
}

func (*Order) AfterCreate

func (o *Order) AfterCreate(tx *gorm.DB) (err error)

func (*Order) AfterDelete

func (o *Order) AfterDelete(tx *gorm.DB) (err error)

func (Order) Amount

func (order Order) Amount() (amount float32)

func (*Order) BeforeUpdate

func (o *Order) BeforeUpdate(tx *gorm.DB) (err error)

type OrderItem

type OrderItem struct {
	gorm.Model
	OrderID         uint
	SizeVariationID uint
	SizeVariation   SizeVariation
	Quantity        uint
	Price           float32
	//DiscountRate    uint
	State string
}

func (*OrderItem) AfterCreate

func (oi *OrderItem) AfterCreate(tx *gorm.DB) (err error)

func (OrderItem) Amount

func (item OrderItem) Amount() float32

func (*OrderItem) BeforeUpdate

func (oi *OrderItem) BeforeUpdate(tx *gorm.DB) (err error)

func (OrderItem) SizeVariationInfo

func (item OrderItem) SizeVariationInfo()

type Owner

type Owner struct {
	Name    string
	Contact string
	Email   string
}

func (*Owner) Scan

func (owner *Owner) Scan(value interface{}) error

func (Owner) Value

func (owner Owner) Value() (driver.Value, error)

type Page

type Page struct {
	gorm.Model

	Title         string
	TitleWithSlug slug.Slug

	QorWidgetSettings       []widget.QorWidgetSetting `gorm:"many2many:page_qor_widget_settings;ForeignKey:id;AssociationForeignKey:name"`
	QorWidgetSettingsSorter sorting.SortableCollection

	publish2.Version
	publish2.Schedule
	publish2.Visible
}

type Product

type Product struct {
	gorm.Model
	sorting.SortingDESC

	Name string
	//NameWithSlug          slug.Slug    `l10n:"sync"`
	Code                  string       `l10n:"sync"`
	CategoryID            uint         `l10n:"sync"`
	Category              Category     `l10n:"sync"`
	Collections           []Collection `l10n:"sync" gorm:"many2many:product_collections;"`
	MadeCountry           string       `l10n:"sync"`
	MainImage             media_library.MediaBox
	Price                 float32          `l10n:"sync"`
	Description           string           `sql:"size:2000"`
	ColorVariations       []ColorVariation `l10n:"sync"`
	ColorVariationsSorter sorting.SortableCollection
	ProductProperties     ProductProperties `sql:"type:text"`
	Seo                   qor_seo.Setting
}

func (Product) DefaultPath

func (product Product) DefaultPath() string

func (Product) GetSEO

func (product Product) GetSEO() *qor_seo.SEO

func (Product) MainImageURL

func (product Product) MainImageURL(styles ...string) string

func (Product) Validate

func (product Product) Validate(db *gorm.DB)

type ProductImage

type ProductImage struct {
	gorm.Model
	Title        string
	Color        Color
	ColorID      uint
	Category     Category
	CategoryID   uint
	SelectedType string
	File         media_library.MediaLibraryStorage `sql:"size:4294967295;" media_library:"url:/system/{{class}}/{{primary_key}}/{{column}}.{{extension}}"`
}

func (*ProductImage) GetMediaOption

func (productImage *ProductImage) GetMediaOption() (mediaOption media_library.MediaOption)

func (*ProductImage) GetSelectedType

func (productImage *ProductImage) GetSelectedType() string

func (*ProductImage) ScanMediaOptions

func (productImage *ProductImage) ScanMediaOptions(mediaOption media_library.MediaOption) error

func (*ProductImage) SetSelectedType

func (productImage *ProductImage) SetSelectedType(typ string)

func (ProductImage) Validate

func (productImage ProductImage) Validate(db *gorm.DB)

type ProductProperties

type ProductProperties []ProductProperty

func (*ProductProperties) Scan

func (productProperties *ProductProperties) Scan(value interface{}) error

func (ProductProperties) Value

func (productProperties ProductProperties) Value() (driver.Value, error)

type ProductProperty

type ProductProperty struct {
	Name  string
	Value string
}

type Setting

type Setting struct {
	gorm.Model
	//FeeSetting
	location.Location `location:"name:Company Address"`
}

type Size

type Size struct {
	gorm.Model
	sorting.Sorting
	Name string
	Code string `l10n:"sync"`
}

func (Size) Validate

func (size Size) Validate(db *gorm.DB)

type SizeVariation

type SizeVariation struct {
	gorm.Model
	ColorVariationID  uint
	ColorVariation    ColorVariation
	SizeID            uint
	Size              Size
	AvailableQuantity uint
}

func SizeVariations

func SizeVariations() []SizeVariation

func (SizeVariation) Stringify

func (sizeVariation SizeVariation) Stringify() string

type Store

type Store struct {
	gorm.Model
	StoreName string
	Owner     Owner
	Phone     string
	Email     string
	location.Location
	sorting.Sorting
}

type User

type User struct {
	gorm.Model
	Email     string
	Password  string
	Name      sql.NullString
	Gender    string
	Role      string
	Addresses []Address

	// Confirm
	ConfirmToken string
	Confirmed    bool

	// Recover
	RecoverToken       string
	RecoverTokenExpiry *time.Time
}

func (User) AvailableLocales

func (user User) AvailableLocales() []string

func (User) DisplayName

func (user User) DisplayName() string

Jump to

Keyboard shortcuts

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