Documentation ¶
Overview ¶
模型的行为动作,可见不支持泛型写这些东西是多么的啰嗦
模型结构
Index ¶
- func ConvPayStateToString(state PayState) string
- type Account
- type Advertisement
- type BaseModel
- type Item
- type PayState
- type Payment
- type Product
- func (s *Product) Create() (int64, error)
- func (s *Product) Delete(id ...uint) (int64, error)
- func (s *Product) FindAll() (r []Product, err error)
- func (s *Product) FindByIDs(ids []uint) (r []Product, err error)
- func (s *Product) Get(id uint) (*Product, error)
- func (s *Product) Update() (int64, error)
- type Purchase
- type Settlement
- type Specification
- type Stockpile
- type Wallet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvPayStateToString ¶
Types ¶
type Account ¶
type Account struct { BaseModel Username string `json:"username" binding:"required"` Name string `json:"name" binding:"required"` Password string `json:"password,omitempty" binding:"required"` Avatar string `json:"avatar"` Telephone string `json:"telephone" binding:"required,numeric,startswith=1,len=11"` Email string `json:"email" binding:"required,email"` Location string `json:"location"` }
用户
func (*Account) FindByNameOrEmailOrTelephone ¶
type Advertisement ¶
type Advertisement struct { BaseModel ProductId uint `json:"productId"` Image string `json:"image"` }
广告实体
func (*Advertisement) FindAll ¶
func (s *Advertisement) FindAll() (r []Advertisement, err error)
type BaseModel ¶
type Payment ¶
type Payment struct { BaseModel CreateTime time.Time `json:"createTime"` PayId string `json:"payId"` TotalPrice float64 `json:"totalPrice"` Expires int64 `json:"expires"` PaymentLink string `json:"paymentLink" gorm:"-"` PayState PayState `json:"payState"` }
支付单模型 就是传到客户端让用户给扫码或者其他别的方式付钱的对象
func NewPaymentWithInfo ¶
type Product ¶
type Product struct { BaseModel Title string `json:"title"` Price float64 `json:"price"` // 用浮点数来表示金额是很不好的行为,这里只是方便演示 Rate float32 `json:"rate"` Description string `json:"description"` Cover string `json:"cover"` Detail string `json:"detail"` Specifications []Specification `json:"specifications" gorm:"foreignKey:ProductId"` }
产品实例
type Purchase ¶
type Purchase struct { Delivery bool `json:"delivery"` Pay string `json:"pay"` Name string `json:"name" binding:"required"` Telephone string `json:"telephone" binding:"required,numeric,startswith=1,len=11"` Location string `json:"location"` }
结算单中的配送信息
type Settlement ¶
type Settlement struct { Items []Item `json:"items"` Purchase Purchase `json:"purchase"` ProductMap map[uint]*Product `json:"productMap"` }
支付结算单模型
type Specification ¶
type Specification struct { BaseModel Item string `json:"item"` Value string `json:"value"` ProductId uint `json:"productId"` }
产品规格
type Stockpile ¶
type Stockpile struct { BaseModel Amount int `json:"amount"` Frozen int `json:"frozen"` ProductId uint `json:"productId"` }
商品库存
Click to show internal directories.
Click to hide internal directories.