cart

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

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

Go to latest
Published: Nov 15, 2017 License: GPL-3.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cart

type Cart struct {
	CartID     int       `json:"cartID" db:"cart_id"`         // 表ID
	Active     bool      `json:"active" db:"active"`          // 是否可用
	Selected   bool      `json:"selected" db:"selected"`      // 是否选中
	Count      int       `json:"count" db:"count"`            // 数量
	UserID     int       `json:"userID" db:"user_id"`         // 用户ID
	StoreID    int       `json:"storeID" db:"store_id"`       // 店铺ID
	GoodsID    int       `json:"goodsID" db:"goods_id"`       // 商品ID
	ZoomImg    string    `json:"zoomImg" db:"zoom_img"`       // 缩放图
	GoodsLabel string    `json:"goodsLabel" db:"goods_label"` // 商品名称
	SpecID     int       `json:"specID" db:"spec_id"`         // 规格ID,0代表没有规格
	SpecLabel  string    `json:"specLabel" db:"spec_label"`   // 规格名称,下划线分割,例如:红色_L
	PayPrice   float32   `json:"payPrice" db:"pay_price"`     // 购买价
	CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间
	UpdateTime time.Time `json:"updateTime" db:"update_time"` // 更新时间
}

Cart 购物车

type CartDB

type CartDB struct {
	DB *sqlx.DB
}

func (*CartDB) Delete

func (db *CartDB) Delete(cartID int) error

Delete 删除购物车商品

func (*CartDB) DeleteStoreAll

func (db *CartDB) DeleteStoreAll(userID, storeID int) error

DeleteStoreAll 清空用户店铺购物车

func (*CartDB) GetByGoods

func (db *CartDB) GetByGoods(userID, goodsID, specID int) (*Cart, error)

GetByGoods 获取用户购物车内指定商品和商品规格

func (*CartDB) GetByID

func (db *CartDB) GetByID(cartID int) (*Cart, error)

GetByID 获取指定购物车

func (*CartDB) GetCount

func (db *CartDB) GetCount(userID int) (int, error)

GetCount 获取购物车数量

func (*CartDB) InsertCart

func (db *CartDB) InsertCart(count, userID, storeID, goodsID, specID int, zoomImg, goodsLabel, specLabel string, payPrice float32) error

InsertCart 添加活动购物车

func (*CartDB) ListAll

func (db *CartDB) ListAll(userID int) ([]Cart, error)

ListAll 列出所有有效的购物车

func (*CartDB) ListSelected

func (db *CartDB) ListSelected(userID int) ([]Cart, error)

ListSelected 列出所有选中的购物车

func (*CartDB) ListStoreAll

func (db *CartDB) ListStoreAll(userID, storeID int) ([]Cart, error)

ListStoreAll 列出店铺购物车商品

func (*CartDB) ListStoreSelected

func (db *CartDB) ListStoreSelected(userID, storeID int) ([]Cart, error)

ListStoreSelected 列出店铺购物车选中商品

func (*CartDB) ListStoreUnSelected

func (db *CartDB) ListStoreUnSelected(userID, storeID int) ([]Cart, error)

ListStoreUnSelected 列出店铺购物车未选中商品

func (*CartDB) Selected

func (db *CartDB) Selected(cartID int) error

Selected 选中购物车

func (*CartDB) SelectedAll

func (db *CartDB) SelectedAll(userID, storeID int) error

SelectedAll 选中店铺所有商品

func (*CartDB) UnSelected

func (db *CartDB) UnSelected(cartID int) error

UnSelected 取消选中购物车商品

func (*CartDB) UnSelectedAll

func (db *CartDB) UnSelectedAll(userID, storeID int) error

UnSelectedAll 取消选中店铺所有商品

func (*CartDB) UpdateCount

func (db *CartDB) UpdateCount(cartID, count int) error

UpdateCount 更新购物车商品数量

type CartTx

type CartTx struct {
	Tx *sqlx.Tx
}

func (*CartTx) Delete

func (tx *CartTx) Delete(cartID int) error

Delete 删除购物车商品

func (*CartTx) DeleteSelect

func (tx *CartTx) DeleteSelect(userID int) error

DeleteSelect 删除购物车选中商品

func (*CartTx) DeleteStoreSelected

func (tx *CartTx) DeleteStoreSelected(userID, storeID int) error

DeleteStoreSelected 清空用户店铺购物车

func (*CartTx) Update

func (tx *CartTx) Update(cartID int, zoomImg, goodsLabel, specLabel string, payPrice float32) error

Update 更新购物车商品信息

func (*CartTx) UpdateCount

func (tx *CartTx) UpdateCount(cartID, count int) error

UpdateCount 更新购物车商品数量

Jump to

Keyboard shortcuts

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