category

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: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	CategoryID int       `json:"categoryID" db:"category_id"` // 商品分类ID
	Active     bool      `json:"active" db:"active"`          // 是否可用
	ParentID   int       `json:"parentID" db:"parent_id"`     // 父级分类ID
	Level      int       `json:"level" db:"level"`            // 分类等级,最多为3
	Label      string    `json:"label" db:"label"`            // 名称
	ZoomImg    string    `json:"zoomImg" db:"zoom_img"`       // 缩略图
	CoverImg   string    `json:"coverImg" db:"cover_img"`     // 封面图
	Weight     int       `json:"weight" db:"weight"`          // 权重,数字越大越靠前
	CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间
	UpdateTime time.Time `json:"updateTime" db:"update_time"` // 更新时间
}

Category 商品分类

type CategoryDB

type CategoryDB struct {
	DB *sqlx.DB
}

func (*CategoryDB) DeleteCategory

func (db *CategoryDB) DeleteCategory(CategoryID int) error

DeleteCategory 删除商品分类

func (*CategoryDB) GetByID

func (db *CategoryDB) GetByID(CategoryID int) (*Category, error)

GetByID 通过分类ID获取分类

func (*CategoryDB) InsertCategory

func (db *CategoryDB) InsertCategory(c *InsertCategoryParam) (int, error)

InsertCategory 添加活动商品分类

func (*CategoryDB) ListAll

func (db *CategoryDB) ListAll() ([]Category, error)

ListAll 列出所有有效商品分类,按照权重和创建开始时间排序

func (*CategoryDB) ListChildren

func (db *CategoryDB) ListChildren(parentID int) ([]Category, error)

ListChildren 列出子分类

func (*CategoryDB) UpdateCategory

func (db *CategoryDB) UpdateCategory(c *UpdateCategoryParam) error

UpdateCategory 更新商品分类信息

type CategoryTx

type CategoryTx struct {
	Tx *sqlx.Tx
}

type InsertCategoryParam

type InsertCategoryParam struct {
	ParentID int    `json:"parentID" form:"parentID"` // 父级分类ID
	Level    int    `json:"level" form:"level"`       // 分类等级,最多为3
	Label    string `json:"label" form:"label"`       // 名称
	ZoomImg  string `json:"zoomImg" form:"zoomImg"`   // 缩略图
	CoverImg string `json:"coverImg" form:"coverImg"` // 封面图
	Weight   int    `json:"weight" form:"weight"`     // 权重,数字越大越靠前
}

InsertCategoryParam 添加商品分类

type UpdateCategoryParam

type UpdateCategoryParam struct {
	Label      string `json:"label" form:"label"`           // 名称
	ZoomImg    string `json:"zoomImg" form:"zoomImg"`       // 缩略图
	CoverImg   string `json:"coverImg" form:"coverImg"`     // 封面图
	Weight     int    `json:"weight" form:"weight"`         // 权重,数字越大越靠前
	CategoryID int    `json:"categoryID" form:"categoryID"` // 商品分类ID
}

UpdateCategoryParam 修改商品分类

Jump to

Keyboard shortcuts

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