models

package
v0.0.0-...-b705d59 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodRoyalPayWechat   PaymentMethodType = "RoyalPayWechat"
	MethodRoyalPayAlipay   PaymentMethodType = "RoyalPayAlipay"
	MethodWechatVoucher    PaymentMethodType = "WechatVoucher"
	MethodOverage          PaymentMethodType = "Overage"
	LinkShowCategoryParent LinkType          = "ShowCategoryParent"
	LinkShowCategory       LinkType          = "ShowCategory"
	LinkGoods              LinkType          = "Goods"
)
View Source
const (
	Overage          FinanceType = 1
	Gold             FinanceType = 2
	Recharge         FromType    = 1
	Consume          FromType    = 2
	Withdraw         FromType    = 3
	Reward           FromType    = 4
	Reimburse        FromType    = 5
	WithdrawFreeze   FromType    = 6 //提现冻结
	WithdrawUnfreeze FromType    = 7 //提现取消解冻
	CancelRecharge   FromType    = 8
)
View Source
const (
	AUD       Currency = "AUD"
	RMB       Currency = "CNY"
	China     Region   = "china"
	Australia Region   = "australia"
)

Variables

View Source
var (
	Db   *gorm.DB
	Conf map[string]interface{}
)

Functions

func InitDb

func InitDb(logMode bool, clear bool, models ...interface{})

func Init自动开户

func Init自动开户(t *Tenant, r *Role, u *User)

自动开户,平台租户系统

Types

type Activity

type Activity struct {
	gorm.Model
	No                 string         `sql:"-" json:"id"`
	TenantId           string         `gorm:"primary_key" sql:"type:char(20);index" description:"租户ID" json:"-" `
	Links              []ActivityLink `gorm:"ForeignKey:ActivityId;save_associations:false" json:"links"`
	Name               string         `sql:"type:varchar(100)" description:"活动名称" json:"name"`
	Description        string         `sql:"type:text" description:"描述" json:"description"`
	IndexImg           string         `sql:"type:varchar(255)" description:"大图专区" json:"index_img"`
	BgImg              string         `sql:"type:varchar(255)" description:"背景图" json:"bg_img"`
	Status             Status         `sql:"integer;default(1)" description:"状态" json:"status" validate:"required"`
	StartAt            time.Time      `sql:"index" description:"开始时间" json:"start_at"`
	EndAt              time.Time      `sql:"index" description:"结束时间" json:"end_at"`
	Sort               int            `description:"排序" json:"sort"`
	ActivityType       ActivityType   `sql:"type:varchar(50);index" description:"活动类型" json:"activity_type"`
	Metadata           []byte         `description:"附加信息" json:"-"`
	Meta               interface{}    `sql:"-" description:"附加信息结构" json:"meta"`
	Extend             ExtendActivity `sql:"-" description:"活动扩展字段" json:"extend"`
	ExtendData         []byte         `sql:"type:json" description:"活动扩展数据字段" json:"-"`
	MemberLevelIds     []string       `sql:"-" description:"可参加的客户等级ID集" json:"member_level_ids"`
	MemberLevelIdsData string         `sql:"type:text" description:"可参加的客户等级ID集" json:"-"`
	WarehouseIds       []string       `sql:"-" description:"发货仓ID集" json:"warehouse_ids"`
	WarehouseIdsData   string         `sql:"type:text" description:"发货仓ID集" json:"-"`
}

func (*Activity) AfterFind

func (e *Activity) AfterFind() (err error)

func (*Activity) AfterSave

func (e *Activity) AfterSave(tx *gorm.DB) (err error)

func (*Activity) BeforeSave

func (e *Activity) BeforeSave() (err error)
type ActivityLink struct {
	ID           uint         `gorm:"primary_key"`
	No           string       `sql:"-" json:"id"`
	TenantId     string       `gorm:"primary_key" sql:"type:char(20);index" description:"租户ID" json:"-" `
	ActivityId   int          `sql:"index" description:"活动ID" json:"activity_id"`
	Activity     *Activity    `gorm:"save_associations:false" json:"activity" validate:"-"`
	LinkType     LinkType     `sql:"type:varchar(50);index" description:"关联类型" json:"link_type"`
	ActivityType ActivityType `sql:"type:varchar(50);index" description:"活动类型" json:"activity_type"`
	LinkId       string       `sql:"type:char(20);index" description:"关联ID" json:"link_id"`
	Name         string       `sql:"type:varchar(100)" description:"名称" json:"name"`
	Image        string       `sql:"type:varchar(255)" description:"图片" json:"image"`
	CreatedAt    time.Time
}

func (*ActivityLink) AfterFind

func (e *ActivityLink) AfterFind() (err error)

type ActivityType

type ActivityType string
const (
	ActivityFullGift      ActivityType = "FullGift"      //满赠
	ActivityFullReduction ActivityType = "FullReduction" //满减
	ActivityPanicBuying   ActivityType = "PanicBuying"   //秒杀、抢购
	ActivityFreeShipping  ActivityType = "FreeShipping"  //包邮
)

type Attribute

type Attribute struct {
	Name       string     `json:"name"`
	Items      []string   `json:"items"`
	SelectType SelectType `json:"select_type"`
}

type AuthorizeRequest

type AuthorizeRequest struct {
	ResponseType string   `json:"response_type"`
	ClientId     uint     `json:"client_id"`
	Scopes       []string `json:"scopes"`
	State        string   `json:"state"`
	RedirectUri  string   `json:"redirect_uri"`
}

type AuthorizeResponse

type AuthorizeResponse struct {
	Code  string `json:"code"`
	State string `json:"state"`
	Token *Token `json:"token"`
}

type BatchSelected

type BatchSelected struct {
	Select string
	Cancel string
}

type BatchUseGoods

type BatchUseGoods struct {
	ShowCategoryId string   `json:"show_category_id"`
	GoodsInfoIds   []string `json:"goods_info_ids"`
}

type Brand

type Brand struct {
	gorm.Model
	No          string `sql:"-" json:"id"`
	NameZh      string `sql:"type:varchar(100)" description:"中文名称" json:"name_zh" validate:"required"`
	NameEn      string `sql:"type:varchar(100)" description:"英文名称" json:"name_en" validate:"required"`
	SiteUrl     string `sql:"type:varchar(255)" description:"品牌网址" json:"site_url"`
	IndexImg    string `sql:"type:varchar(255)" description:"大图专区" json:"index_img"`
	BgImg       string `sql:"type:varchar(255)" description:"背景图" json:"bg_img"`
	Description string `sql:"type:text" description:"描述" json:"description"`
	Sort        int    `sql:"integer;default(0)" description:"排序" json:"sort"`
	Status      Status `sql:"integer;default(1)" description:"状态" json:"status" validate:"required"`
}

func (*Brand) AfterFind

func (b *Brand) AfterFind() error

func (*Brand) AfterSave

func (b *Brand) AfterSave() error

func (*Brand) BeforeSave

func (b *Brand) BeforeSave() error

type Category

type Category struct {
	gorm.Model
	ParentId    string         `json:"parent_id"`
	No          string         `sql:"-" json:"id"`
	Name        string         `sql:"type:varchar(100)" description:"名称" json:"name" validate:"required"`
	Alias       string         `sql:"type:varchar(100)" description:"别名" json:"alias"`
	Description string         `sql:"text" description:"描述" json:"description"`
	Sort        int            `sql:"default(0)" description:"排序" json:"sort"`
	Img         string         `sql:"type:varchar(255)" description:"图片" json:"img"`
	Tag         string         `sql:"type:varchar(255)" description:"商品标签" json:"tag"`
	PackRule    []byte         `sql:"type:json" description:"关联的物流规则ID" json:"-"`
	PackRules   []PackRule     `sql:"-" json:"pack_rules"`
	Children    []ShowCategory `gorm:"ForeignKey:ParentId" json:"children"`
}

func (*Category) AfterFind

func (c *Category) AfterFind() error

func (*Category) AfterSave

func (c *Category) AfterSave() (err error)

func (*Category) BeforeSave

func (c *Category) BeforeSave() error

type CheckInventory

type CheckInventory struct {
	GoodsId         string `form:"goods_id" json:"goods_id"`
	SpecificationId string `form:"specification_id" json:"specification_id"`
	WarehouseId     string `form:"warehouse_id" json:"warehouse_id"`
	Stage           int    `form:"stage" json:"stage"`
	Quantity        int    `form:"quantity" json:"quantity" validate:"required"`
}

type Class

type Class struct {
	gorm.Model
	Category        Category    `json:"category" validate:"-"`
	No              string      `sql:"-" json:"id"`
	CategoryId      string      `json:"category_id"`
	Name            string      `sql:"type:varchar(100)" description:"名称" json:"name" validate:"required"`
	Attributes      []byte      `sql:"jsonb" description:"属性分组" json:"-"`
	AttributesArray []Attribute `sql:"-" json:"attributes"`
	Status          Status      `sql:"default(1)" description:"状态" json:"status"`
}

func (*Class) AfterFind

func (c *Class) AfterFind() error

func (*Class) AfterSave

func (c *Class) AfterSave() error

func (*Class) BeforeSave

func (c *Class) BeforeSave() error

type Collection

type Collection struct {
	TenantId  string `sql:"type:varchar(20);primary_key" description:"租户ID" json:"-"`
	MemberId  string `sql:"type:varchar(20);primary_key" description:"客户ID" json:"member_id"`
	GoodsId   string `sql:"type:varchar(20);primary_key" description:"商品ID" json:"goods_id"`
	Goods     Goods  `gorm:"save_associations:false" json:"goods" validate:"-"`
	CreatedAt time.Time
}

收藏夹

type Condition

type Condition struct {
	Limit int
	Page  int
	Where map[string][]interface{}
}

type Consignee

type Consignee struct {
	gorm.Model
	No          string  `sql:"-" json:"id"`
	TenantId    string  `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	MemberId    string  `sql:"type:char(20);index" description:"客户ID" json:"member_id"`
	Member      *Member `gorm:"save_associations:false;ForeignKey:MemberId" json:"member,omitempty" validate:"-"`
	Name        string  `sql:"type:varchar(100)" description:"姓名" json:"name" validate:"required"`
	Phone       string  `sql:"type:varchar(50)" description:"手机号" json:"phone" validate:"required"`
	Country     string  `sql:"type:varchar(50)" description:"国家" json:"country" validate:"required"`
	Province    string  `sql:"type:varchar(50)" description:"省份" json:"province" validate:"required"`
	City        string  `sql:"type:varchar(50)" description:"市" json:"city" validate:"required"`
	Address     string  `sql:"type:varchar(255)" description:"详细地址" json:"address" validate:"required"`
	Tag         string  `sql:"type:varchar(100)" description:"地址标签" json:"tag"`
	Default     bool    `description:"默认地址" json:"default"`
	IdCard      string  `sql:"type:varchar(50)" description:"身份证号码" json:"id_card"`
	IdCardFront string  `sql:"type:varchar(255)" description:"身份证正面" json:"id_card_front"`
	IdCardBack  string  `sql:"type:varchar(255)" description:"身份证背面" json:"id_card_back"`
}

收件人

func (*Consignee) AfterFind

func (c *Consignee) AfterFind() error

func (*Consignee) AfterSave

func (c *Consignee) AfterSave() error

type Courier

type Courier struct {
	gorm.Model
	No      string            `sql:"-" json:"id"`
	Name    string            `sql:"type:varchar(100)" description:"名称" json:"name" validate:"required"`
	Status  Status            `sql:"default(1)" description:"状态" json:"status"`
	SiteUrl string            `sql:"type:varchar(255)" description:"官网网址" json:"site_url"`
	Region  Region            `sql:"type:varchar(20);index" description:"地区" json:"region" validate:"required"`
	Method  string            `sql:"type:varchar(100)" description:"调用方法名" json:"method" validate:"required"`
	Rules   []CourierPackRule `gorm:"ForeignKey:CourierId" json:"rules"`
}

国际版物流 20191206兼容国内物流

func (*Courier) AfterFind

func (c *Courier) AfterFind() error

func (*Courier) AfterSave

func (c *Courier) AfterSave() error

type CourierInstall

type CourierInstall struct {
	gorm.Model
	No        string  `sql:"-" json:"id"`
	Used      bool    `description:"领用" json:"used"`
	TenantId  string  `sql:"type:varchar(20);index" json:"tenant_id"`
	Courier   Courier `json:"courier" validate:"-"`
	CourierId int     `description:"物流ID" json:"courier_id"`
	AppKey    string  `sql:"type:varchar(50)" description:"key" json:"app_key"`
	AppSecret string  `sql:"type:varchar(50)" description:"密钥" json:"app_secret"`
	Prefix    string  `sql:"type:varchar(50)" description:"物流号前缀" json:"prefix"`
	Region    Region  `sql:"type:varchar(20)" description:"地区" json:"region" validate:"required"`
	MaxAmount float64 `sql:"type:DECIMAL(10, 2)" description:"最大打包金额" json:"max_amount"`
	MaxWeight int     `description:"包裹最大重量" json:"max_weight"`
}

func (*CourierInstall) AfterFind

func (c *CourierInstall) AfterFind() error

func (*CourierInstall) AfterSave

func (c *CourierInstall) AfterSave() error
type CourierLink struct {
	ID            uint            `gorm:"primary_key"`
	No            string          `sql:"-" json:"id"`
	LinkId        int             `gorm:"primary_key" json:"link_id"`
	LeftRuleId    int             `gorm:"primary_key" json:"left_rule_id"`
	LeftRule      CourierPackRule `gorm:"save_associations:false"`
	ObjectIdsData string          `sql:"type:text" description:"可以混装的分类ID"`
	ObjectIds     []string        `sql:"-"`
	CreatedAt     time.Time
}

func (*CourierLink) AfterFind

func (e *CourierLink) AfterFind() error

func (*CourierLink) BeforeSave

func (e *CourierLink) BeforeSave() error

type CourierPackRule

type CourierPackRule struct {
	gorm.Model
	Courier    Courier `validate:"-" json:"courier"`
	CourierId  string  `sql:"type:varchar(20);index" json:"courier_id"`
	No         string  `sql:"-" json:"id"`
	Name       string  `sql:"type:varchar(100)" description:"名称" json:"name" validate:"required"`
	Simple     int     `sql:"default(0)" description:"纯装数量" json:"simple"`
	Mixed      int     `sql:"default(0)" description:"混装基数" json:"mixed"`
	MixedSum   int     `sql:"default(0)" description:"混装总数" json:"mixed_sum"`
	PriceUnit  float64 `sql:"type:DECIMAL(10, 2);default(0.00)" description:"单价" json:"price_unit"`
	PriceTotal float64 `sql:"type:DECIMAL(10, 2);default(0.00)" description:"总价" json:"price_total"`
}

func (*CourierPackRule) AfterFind

func (c *CourierPackRule) AfterFind() error

func (*CourierPackRule) AfterSave

func (c *CourierPackRule) AfterSave() error

type CourierTemplate

type CourierTemplate struct {
	gorm.Model
	TenantId         string         `sql:"type:varchar(20);index" json:"tenant_id"`
	No               string         `sql:"-" json:"id"`
	CourierInstall   CourierInstall `json:"courier_install" validate:"-"`
	CourierInstallId string         `sql:"type:varchar(20);index" description:"安装的物流ID" json:"courier_install_id"`
	Name             string         `sql:"type:varchar(100)" description:"名称" json:"name" validate:"required"`
	FirstWeight      int            `description:"首重" json:"first_weight"`
	FirstPrice       float64        `sql:"type:DECIMAL(10, 2)" description:"首重价格" json:"first_price"`
	ContinuedPrice   float64        `sql:"type:DECIMAL(10, 2)" description:"续重价格" json:"continued_price"`
	CodeData         string         `sql:"type:text" description:"区域" json:"-"`
	Code             []string       `sql:"-" description:"区域集" json:"code"`
}

func (*CourierTemplate) AfterFind

func (e *CourierTemplate) AfterFind() error

func (*CourierTemplate) BeforeSave

func (e *CourierTemplate) BeforeSave() error

type Currency

type Currency string

type ExtendActivity

type ExtendActivity struct {
	ExtendType     ExtendType  `description:"参数类型" json:"extend_type"`
	EnoughPrice    float64     `description:"满足金额" json:"enough_price"`
	EnoughQuantity int         `description:"满足数量" json:"enough_quantity"`
	Reduce         float64     `description:"减免金额" json:"reduce"`
	GiftGoods      []GiftGoods `description:"赠品" json:"gift_goods"`
}

type ExtendType

type ExtendType int
const (
	ExtendTypePrice    ExtendType = 1
	ExtendTypeQuantity ExtendType = 2
)

type Finance

type Finance struct {
	MemberId      string     `gorm:"primary_key;type:char(20);index" description:"会员ID" json:"member_id"`
	TenantId      string     `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	Overage       float64    `sql:"type:DECIMAL(10, 2);default(0.00)" description:"余额" json:"overage"`
	Gold          float64    `sql:"type:DECIMAL(10, 2);default(0.00)" description:"金豆" json:"gold"`
	FreezeOverage float64    `sql:"type:DECIMAL(10, 2);default(0.00)" description:"余额冻结数" json:"freeze_overage"`
	FreezeGold    float64    `sql:"type:DECIMAL(10, 2);default(0.00)" description:"金豆冻结数" json:"freeze_gold"`
	DeletedAt     *time.Time `sql:"index" json:"-"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

type FinanceLog

type FinanceLog struct {
	ID          uint        `gorm:"primary_key"`
	MemberId    string      `gorm:"primary_key;type:char(20);index" description:"会员ID" json:"member_id"`
	Username    string      `sql:"type:varchar(100)" description:"充值时的用户名" json:"username"`
	Nickname    string      `sql:"type:varchar(100)" description:"充值时的昵称" json:"nickname"`
	Phone       string      `sql:"type:varchar(20)" description:"充值时的手机号" json:"phone"`
	TenantId    string      `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	FinanceType FinanceType `sql:"type:integer;index" description:"日志类型 1:余额变动, 2:金豆变动" json:"finance_type"`
	FromType    FromType    `sql:"type:integer;index" description:"来源类型 1:充值, 2:消费 3:提现 4:奖励 5:退款" json:"from_type"`
	Old         float64     `sql:"type:DECIMAL(10, 2);default(0.00)" description:"变动前数" json:"old"`
	Change      float64     `sql:"type:DECIMAL(10, 2);default(0.00)" description:"变动数" json:"change"`
	Freeze      float64     `sql:"type:DECIMAL(10, 2);default(0.00)" description:"冻结数" json:"freeze"`
	Remark      string      `sql:"type:text" description:"备注" json:"remark"`
	CreatedAt   time.Time
}

type FinanceType

type FinanceType int

type FromType

type FromType int

type FunctionCircle

type FunctionCircle struct {
	gorm.Model
	No       string `sql:"-" json:"id"`
	Title    string `sql:"type:char(100);index" description:"类型" json:"title"`
	Type     string `sql:"type:char(100);index" description:"类型" json:"type"`
	Status   Status `sql:"default(1)" description:"状态" json:"status"`
	TenantId string `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	BgColor  string `sql:"type:char(50)" description:"背景颜色" json:"bg_color"`
	BgImage  string `sql:"type:varchar(255)" description:"背景图片" json:"bg_image"`
	Media    string `sql:"type:varchar(255)" description:"媒体地址" json:"media"`
	Video    bool   `description:"视频" json:"video"`
	LinkType string `sql:"type:char(50)" description:"关联类型" json:"link_type"`
	LinkId   string `sql:"type:char(20)" description:"关联ID" json:"link_id"`
	Content  string `sql:"type:text" description:"内容" json:"content"`
	Url      string `sql:"type:varchar(255)" description:"链接" json:"url"`
	Sort     int    `description:"排序" json:"sort"`
}

功能圈

func (*FunctionCircle) AfterFind

func (f *FunctionCircle) AfterFind() error

func (*FunctionCircle) AfterSave

func (f *FunctionCircle) AfterSave(tx *gorm.DB) (err error)

type GeneratePack

type GeneratePack struct {
	GetSelf              bool               `json:"get_self"`
	Alias                string             `json:"alias"`
	Image                string             `json:"image"`
	GoodsId              string             `json:"goods_id"`
	ParentCategoryId     string             `json:"parent_category_id"`
	CategoryId           string             `json:"category_id"`
	ParentShowCategoryId string             `json:"parent_show_category_id"`
	ShowCategoryId       string             `json:"show_category_id"`
	CourierId            string             `json:"courier_id"`
	CourierInstallId     string             `json:"courier_install_id"`
	Weight               int                `json:"weight"`
	Price                float64            `json:"price"`
	PackPrice            float64            `json:"pack_price"`
	Meta                 map[string]int     `json:"meta"`
	MetaPrice            map[string]float64 `json:"meta_price"`
	Quantity             int                `json:"quantity"`
}

type GiftGoods

type GiftGoods struct {
	GoodsId  string `description:"商品ID" json:"goods_id"`
	Name     string `description:"名称" json:"name"`
	Image    string `description:"图片" json:"image"`
	Quantity int    `description:"数量" json:"quantity" `
}

type Goods

type Goods struct {
	gorm.Model
	No                   string                   `sql:"-" json:"id"`
	TenantId             string                   `gorm:"primary_key" sql:"type:char(20);index" description:"租户ID" json:"-" `
	CategoryId           string                   `sql:"type:char(20);index" json:"category_id"`
	ParentCategoryId     string                   `sql:"type:char(20);index" json:"parent_category_id"`
	BrandId              string                   `sql:"type:char(20);index" json:"brand_id"`
	Used                 bool                     `description:"领用" json:"used"`
	GoodsInfoId          string                   `sql:"type:char(20);index" json:"goods_info_id" description:"商品基础信息ID"`
	GoodsInfo            GoodsInfo                `gorm:"save_associations:false" json:"goods_info" validate:"-"`
	ShowCategory         ShowCategory             `gorm:"save_associations:false" json:"show_category" validate:"-"`
	ShowCategoryId       string                   `sql:"type:char(20);index" description:"显示分类ID" json:"show_category_id"`
	ParentShowCategory   ShowCategory             `gorm:"save_associations:false" json:"parent_show_category" validate:"-"`
	ParentShowCategoryId string                   `sql:"type:char(20);index" description:"顶级显示分类ID" json:"parent_show_category_id"`
	Alias                string                   `sql:"type:varchar(255)" description:"别名" json:"alias"`
	CommissionRmb        float64                  `sql:"type:DECIMAL(10, 2)" description:"佣金(人民币)" json:"commission_rmb"`
	BarCode              string                   `sql:"type:varchar(100)" description:"条形码" json:"bar_code"`
	Image                string                   `sql:"type:varchar(255)" description:"图片" json:"image"`
	Album                string                   `sql:"type:text" description:"相册" json:"album"`
	Albums               []string                 `sql:"-" description:"相册(数组)" json:"albums"`
	Video                string                   `sql:"type:varchar(255)" description:"视频" json:"video"`
	Content              string                   `sql:"type:text" description:"详情内容" json:"content"`
	Description          string                   `sql:"type:text" description:"描述" json:"description"`
	QualityPeriod        string                   `sql:"type:varchar(50)" description:"保质期" json:"quality_period"`
	Stage                []byte                   `sql:"type:json" description:"阶段" json:"-"`
	Stages               []int                    `sql:"-" json:"stages"`
	Show                 Status                   `sql:"type:integer;default(1)" description:"状态 1 上架 2 下架" json:"show"`
	Status               Status                   `sql:"type:integer;default(1)" description:"状态 1 启用 2 禁用" json:"status"`
	Specifications       []GoodsSpecification     `gorm:"ForeignKey:GoodsId;save_associations:false" description:"规格关联" json:"specifications"`
	Inventory            int                      `description:"库存" json:"inventory"`
	NeedInventory        bool                     `description:"是否需要库存" json:"need_inventory"`
	ClickNum             int                      `sql:"type:integer;default(0)" description:"点击数" json:"click_num"`
	BuyNum               int                      `sql:"type:integer;default(0)" description:"购买数" json:"buy_num"`
	SpecificationInfo    []byte                   `sql:"type:json" description:"规格选择参数" json:"-"`
	SpecificationInfoS   []SpecificationInfo      `sql:"-" description:"规格选择参数" json:"specification_infos"`
	HasSpecification     bool                     `description:"是否有属性" json:"has_specification"`
	Warehouses           []GoodsShippingWarehouse `gorm:"ForeignKey:GoodsId;save_associations:false" description:"发货仓库关联" json:"warehouses" validate:"-"`
	Metadata             []byte                   `description:"附加信息" json:"-"`
	Meta                 interface{}              `sql:"-" description:"附加信息结构" json:"meta"`
	Sort                 int                      `description:"排序" json:"sort"`
	Unit                 string                   `sql:"type:varchar(20)" description:"包装单位" json:"unit"`
	CustomPay            bool                     `description:"是否自定义支付方式" json:"custom_pay"`
	PaymentIds           string                   `sql:"type:text" description:"可用的支付方式" json:"-"`
	PaymentIdsArray      []string                 `sql:"-" json:"payment_ids"`
	ToppedAt             time.Time                `description:"置顶时间"`
	GoodsType            GoodsType                `description:"商品类型 0:常规商品 1:组合商品" json:"goods_type"`
	Assembles            []GoodsAssemble          `gorm:"ForeignKey:LinkId;save_associations:false" json:"assembles"`
}

func (*Goods) AfterFind

func (g *Goods) AfterFind() error

func (*Goods) AfterSave

func (g *Goods) AfterSave(db *gorm.DB) (err error)

func (*Goods) BeforeSave

func (g *Goods) BeforeSave() (err error)

func (*Goods) BeforeUpdate

func (g *Goods) BeforeUpdate(tx *gorm.DB) (err error)

type GoodsAssemble

type GoodsAssemble struct {
	ID                uint      `gorm:"primary_key" json:"-"`
	LinkId            int       `sql:"type:integer;index" json:"-" description:"关联商品ID"`
	GoodsId           int       `sql:"type:integer;index" json:"-" description:"商品ID"`
	GoodsIdNumber     string    `sql:"-" json:"goods_id" description:"商品ID"`
	GoodsInfoId       int       `sql:"type:integer;index" json:"-" description:"商品基础信息ID"`
	GoodsInfoIdNumber string    `sql:"-" json:"goods_info_id" description:"商品基础信息ID"`
	GoodsInfo         GoodsInfo `gorm:"save_associations:false" json:"goods_info" validate:"-"`
	Name              string    `sql:"type:varchar(255)" description:"名称" json:"name"`
	Image             string    `sql:"type:varchar(255)" description:"图片" json:"image"`
	Quantity          int       `json:"quantity" description:"数量"`
	CreatedAt         time.Time
}

func (*GoodsAssemble) AfterFind

func (e *GoodsAssemble) AfterFind() error

func (*GoodsAssemble) BeforeSave

func (e *GoodsAssemble) BeforeSave() error

type GoodsInfo

type GoodsInfo struct {
	gorm.Model
	Category         Category   `gorm:"save_associations:false" json:"category" validate:"-"`
	Brand            Brand      `gorm:"save_associations:false" json:"brand" validate:"-"`
	No               string     `sql:"-" json:"id"`
	CategoryId       string     `sql:"type:char(20);index" json:"category_id"`
	ParentCategoryId string     `sql:"type:char(20);index" json:"parent_category_id"`
	BrandId          string     `sql:"type:char(20);index" json:"brand_id"`
	Name             string     `sql:"type:varchar(255)" description:"名称" json:"name" validate:"required"`
	Album            string     `sql:"type:text" description:"相册" json:"album"`
	Albums           []string   `sql:"-" description:"相册(数组)" json:"albums"`
	Description      string     `sql:"type:text" description:"描述" json:"description"`
	Image            string     `sql:"type:varchar(255)" description:"图片" json:"image"`
	Video            string     `sql:"type:varchar(255)" description:"视频" json:"video"`
	Keywords         string     `sql:"type:varchar(255)" description:"关键字" json:"keywords"`
	BarCode          string     `sql:"type:varchar(100)" description:"条形码" json:"bar_code"`
	Content          string     `sql:"type:text" description:"详情内容" json:"content"`
	Weight           int        `sql:"type:integer;default(0)" description:"重量" json:"weight" validate:"required"`
	HasPackRule      bool       `description:"有打包规则" json:"has_pack_rule"`
	PackRule         []byte     `sql:"type:json" description:"关联的物流规则ID" json:"-"`
	PackRules        []PackRule `sql:"-" json:"pack_rules"`
	Unit             string     `sql:"type:varchar(20)" description:"包装单位" json:"unit"`
	GoodsType        GoodsType  `description:"商品类型 0:常规商品 1:组合商品" json:"goods_type"`
}

func (*GoodsInfo) AfterFind

func (g *GoodsInfo) AfterFind() error

func (*GoodsInfo) AfterSave

func (g *GoodsInfo) AfterSave() (err error)

func (*GoodsInfo) BeforeSave

func (g *GoodsInfo) BeforeSave() error

type GoodsShippingWarehouse

type GoodsShippingWarehouse struct {
	Id                   string             `gorm:"type:char(40);primary_key" json:"id"`
	GoodsId              string             `sql:"type:char(20);index" json:"goods_id"`
	WarehouseId          string             `sql:"type:char(20);index" json:"warehouse_id"`
	Warehouse            ShippingWarehouse  `json:"warehouse"`
	MemberLevelPrice     []MemberLevelPrice `sql:"-" description:"会员级别价格" json:"member_level_price"`
	MemberLevelPriceData []byte             `sql:"type:json" json:"-"`
	Price                float64            `sql:"type:DECIMAL(10, 2)" description:"基本售价" json:"price"`
	Init                 bool               `sql:"type:bool;index" description:"默认发货仓" json:"default"`
}

func (*GoodsShippingWarehouse) AfterFind

func (g *GoodsShippingWarehouse) AfterFind() error

func (*GoodsShippingWarehouse) AfterSave

func (g *GoodsShippingWarehouse) AfterSave() error

func (*GoodsShippingWarehouse) BeforeSave

func (g *GoodsShippingWarehouse) BeforeSave() error

type GoodsSpecification

type GoodsSpecification struct {
	gorm.Model
	No             string   `sql:"-" json:"id"`
	Name           string   `sql:"type:varchar(255)" description:"规格名称" json:"name"`
	TenantId       string   `sql:"type:char(20);index" description:"租户ID" json:"-" `
	GoodsId        string   `sql:"type:char(20);index" description:"租户商品ID" json:"goods_id_int"`
	BarCode        string   `sql:"type:varchar(100)" description:"条形码" json:"bar_code"`
	Specification  string   `sql:"type:varchar(255)" description:"规格拼接" json:"specification"`
	Specifications []string `sql:"-" description:"规格" json:"specifications"`
	Ratio          float64  `sql:"type:DECIMAL(10, 2)" description:"价格浮动比例" json:"ratio"`
	Album          string   `sql:"type:text" description:"相册" json:"album"`
	Inventory      int      `description:"库存" json:"inventory"`
	DefaultSelect  bool     `sql:"column:default_select" description:"默认规格" json:"default"`
}

func (*GoodsSpecification) AfterFind

func (g *GoodsSpecification) AfterFind() error

func (*GoodsSpecification) AfterSave

func (g *GoodsSpecification) AfterSave() error

func (*GoodsSpecification) BeforeSave

func (g *GoodsSpecification) BeforeSave() error

type GoodsType

type GoodsType int
const (
	GoodsTypeNormal   GoodsType = 0
	GoodsTypeAssemble GoodsType = 1
)

type IntrospectRequest

type IntrospectRequest struct {
	TenantId    uint   `json:"tenant_id"`
	AccessToken string `json:"access_token"`
}

type IntrospectResponse

type IntrospectResponse struct {
	Related *Related `json:"related"`
	Active  bool     `json:"active"`
}

type LinkType

type LinkType string

type Member

type Member struct {
	gorm.Model
	TenantId         string      `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	Region           string      `sql:"type:varchar(100)" description:"地区" json:"region"`
	ReferrerId       string      `json:"referrer_id"`
	No               string      `sql:"-" json:"id"`
	LevelId          string      `sql:"type:char(20);index" description:"客户等级ID" json:"level_id" validate:"-"`
	Level            MemberLevel `gorm:"save_associations:false;ForeignKey:LevelId" json:"level" validate:"-"`
	Referrer         *Member     `gorm:"save_associations:false;ForeignKey:ReferrerId" json:"referrer,omitempty" validate:"-"`
	Username         string      `sql:"type:varchar(100);index" description:"用户名" json:"username"`
	Nickname         string      `sql:"type:varchar(100);index" description:"昵称" json:"nickname"`
	Phone            string      `sql:"type:char(20)" description:"手机号" json:"phone"`
	Description      string      `sql:"type:text" description:"描述" json:"description"`
	OpenId           string      `sql:"type:varchar(100)" description:"三方登录openid" json:"open_id"`
	UnionId          string      `sql:"type:varchar(100)" description:"三方登录unionid" json:"union_id"`
	PasswordHash     string      `sql:"type:varchar(100)" description:"密码hash值" json:"-"`
	Salt             string      `sql:"type:varchar(20)" description:"加盐值" json:"-"`
	RestPasswordHash string      `sql:"type:varchar(100)" description:"重置密码hash值" json:"-"`
	Status           Status      `sql:"default(1)" description:"状态: 1 启用, 0 禁用" json:"status"`
	Password         string      `sql:"-" json:"password,omitempty"` //用于暂存密码
	HeadImage        string      `sql:"type:text" description:"头像" json:"head_image"`
	Metadata         []byte      `sql:"json" description:"附加信息" json:"-"`
	Meta             interface{} `sql:"-" json:"meta"`
	Address          string      `sql:"type:varchar(100)" description:"用户地址" json:"address"`
	Sex              int         `json:"sex"` // 用户的性别, 值为1时是男性, 值为2时是女性, 值为0时是未知
	ParentReferrerId string      `sql:"type:varchar(50);index" description:"推荐人父级ID" json:"parent_referrer_id"`
	ParentReferrer   *Member     `gorm:"save_associations:false;ForeignKey:ParentReferrerId" json:"parent_referrer,omitempty" validate:"-"`
}

func (*Member) AfterFind

func (u *Member) AfterFind() error

func (*Member) AfterSave

func (u *Member) AfterSave() error

func (*Member) BeforeSave

func (u *Member) BeforeSave() (err error)

func (*Member) ExistUsername

func (u *Member) ExistUsername() (exist bool, err error)

验证是否存在重复username

func (*Member) GetPasswordHash

func (u *Member) GetPasswordHash() string

获取密码hash

func (*Member) SetPassword

func (u *Member) SetPassword(value string)

设置密码

func (*Member) Verify

func (u *Member) Verify() bool

验证密码

type MemberLevel

type MemberLevel struct {
	gorm.Model
	No              string   `sql:"-" json:"id"`
	TenantId        string   `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	Name            string   `sql:"type:varchar(100);index" description:"用户名" json:"name" validate:"required"`
	HasMarket       bool     `description:"可以开店" json:"has_market"`
	ChangeCourier   bool     `description:"可以选择物流" json:"change_courier"`
	PaymentIds      string   `sql:"type:text" description:"可用的支付方式" json:"-"`
	PaymentIdsArray []string `sql:"-" json:"payment_ids"`
	Ratio           float64  `sql:"type:DECIMAL(10, 2)" description:"价格浮动比例" json:"ratio"`
	Init            bool     `description:"用户注册默认等级" json:"default"`
	Status          Status   `sql:"type:integer;default(1)" description:"状态 1 启用 2 禁用" json:"status"`
}

func (*MemberLevel) AfterFind

func (m *MemberLevel) AfterFind() error

func (*MemberLevel) AfterSave

func (m *MemberLevel) AfterSave() error

func (*MemberLevel) BeforeSave

func (m *MemberLevel) BeforeSave() error

type MemberLevelPrice

type MemberLevelPrice struct {
	Id    string  `json:"id"`
	Price float64 `json:"price"`
}

type ObjectLinkCourier

type ObjectLinkCourier struct {
	Id      int     `json:"id"`
	RuleIds [][]int `json:"rule_ids"`
}

type Order

type Order struct {
	gorm.Model
	No               string               `sql:"-" json:"id"`
	TenantId         string               `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	MemberId         string               `sql:"type:char(20)" description:"客户ID" json:"member_id"`
	Member           *Member              `sql:"-" description:"客户" json:"member,omitempty"`
	CourierId        string               `sql:"type:char(20)" description:"物流ID" json:"courier_id"`
	CourierInstallId string               `sql:"type:char(20)" description:"安装的物流ID" json:"courier_install_id"`
	OrderPayId       string               `sql:"type:char(20)" description:"支付订单ID" json:"order_pay_id"`
	OrderStatus      OrderStatus          `sql:"type:char(20);index" description:"订单状态" json:"order_status"`
	ConsigneeId      string               `sql:"type:char(20);index" description:"收件人ID" json:"consignee_id"`
	ConsigneeData    string               `sql:"type:text" description:"收件人快照" json:"-"`
	Consignee        Consignee            `sql:"-" description:"收件人快照结构体" json:"consignee" validate:"-"`
	SenderId         string               `sql:"type:char(20);index" description:"寄件人ID" json:"sender_id"`
	SenderData       string               `sql:"type:text" description:"寄件人快照" json:"-"`
	Sender           Sender               `sql:"-" description:"寄件人快照结构体" json:"sender" validate:"-"`
	Money            float64              `sql:"type:DECIMAL(10, 2);default(0.00)" description:"付款总金额" json:"money"`
	Currency         Currency             `sql:"type:varchar(20)" description:"币种" json:"currency"`
	Overage          float64              `sql:"type:DECIMAL(10, 2);default(0.00)" description:"使用余额" json:"overage"`
	Gold             float64              `sql:"type:DECIMAL(10, 2);default(0.00)" description:"金币" json:"gold"`
	CourierPrice     float64              `sql:"type:DECIMAL(10, 2);default(0.00)" description:"快递费" json:"courier_price"`
	GoodsPrice       float64              `sql:"type:DECIMAL(10, 2);default(0.00)" description:"商品总价" json:"goods_price"`
	Price            float64              `sql:"type:DECIMAL(10, 2);default(0.00)" description:"订单总价" json:"price_old"`
	PriceMap         map[Currency]float64 `sql:"-" json:"price"`
	ReduceFee        float64              `sql:"type:DECIMAL(10, 2);default(0.00)" description:"减免金额" json:"reduce_fee"`
	WarehouseId      string               `sql:"type:char(40);index" description:"发货仓ID" json:"warehouse_id"`
	OrderGoods       []OrderGoods         `gorm:"ForeignKey:OrderId;save_associations:false" description:"商品关联" json:"goods" validate:"-"`
	OrderUnitPacks   []OrderUnitPack      `gorm:"ForeignKey:OrderId;save_associations:false" description:"包裹关联" json:"packs" validate:"-"`
	GetSelf          bool                 `description:"自提" json:"get_self"`
	PaymentIds       string               `sql:"type:text" description:"可用的支付方式" json:"-"`
	PaymentIdsArray  []string             `sql:"-" json:"payment_ids"`
	PaymentName      string               `sql:"type:varchar(100)" description:"付款方式" json:"payment_name"`
	Remark           string               `sql:"type:text" description:"前台备注" json:"remark"`
	Description      string               `sql:"type:text" description:"后台备注" json:"description"`
	GoodsName        string               `sql:"type:text" description:"所有商品名称(搜索用)" json:"goods_name"`
	Channel          int                  `sql:"type:integer;index" description:"订单来源渠道 0:商城在线下单 1:后台下单" json:"channel"`
	Activities       []OrderActivity      `sql:"-" description:"活动数据" json:"activities"`
	ActivitiesData   []byte               `sql:"type:json" description:"活动数据" json:"-"`
	ReferralCode     string               `sql:"type:varchar(50);index" description:"推荐码" json:"referral_code"`
	CommissionRmb    float64              `sql:"type:DECIMAL(10, 2)" description:"佣金总和(人民币)" json:"commission_rmb"`
}

func (*Order) AfterCreate

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

func (*Order) AfterFind

func (e *Order) AfterFind() error

func (*Order) BeforeSave

func (e *Order) BeforeSave() error

func (*Order) UnTransform

func (e *Order) UnTransform()

type OrderActivity

type OrderActivity struct {
	ActivityId string               `json:"activity_id"`
	Name       string               `json:"name"`
	Amount     int                  `json:"amount"`
	Goods      []OrderActivityGoods `json:"goods"`
}

type OrderActivityGoods

type OrderActivityGoods struct {
	GoodsId  string `json:"goods_id"`
	Name     string `json:"name"`
	Image    string `json:"image"`
	Quantity int    `json:"quantity"`
}

type OrderGoods

type OrderGoods struct {
	gorm.Model
	No                     string              `sql:"-" json:"id"`
	OrderId                string              `sql:"type:char(20);index" description:"订单ID" json:"order_id"`
	GoodsId                string              `sql:"type:char(20);index" description:"商品ID" json:"goods_id"`
	GoodsSpecId            string              `sql:"type:char(20);index" description:"商品规格ID" json:"goods_specification_id"`
	Quantity               int                 `sql:"type:integer" description:"数量" json:"quantity"`
	Price                  float64             `sql:"type:DECIMAL(10, 2);default(0.00)" description:"价格" json:"price"`
	GoodsData              []byte              `sql:"type:json" description:"商品快照" json:"-"`
	Goods                  *Goods              `sql:"-" description:"商品快照结构体" json:"goods"`
	GoodsSpecificationData []byte              `sql:"type:json" description:"商品规格快照" json:"-"`
	GoodsSpecification     *GoodsSpecification `sql:"-" description:"商品规格快照结构体" json:"goods_specification"`
	PackSpecification      int                 `description:"包装规格" json:"pack_specification"`
}

func (*OrderGoods) AfterFind

func (e *OrderGoods) AfterFind() error

func (*OrderGoods) BeforeSave

func (e *OrderGoods) BeforeSave() error

type OrderGroup

type OrderGroup struct {
	WarehouseId string `json:"warehouse_id"`
	Amount      int    `json:"amount"`
}

type OrderOperateLog

type OrderOperateLog struct {
	ID         uint        `gorm:"primary_key"`
	No         string      `sql:"-" json:"id"`
	TenantId   string      `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	OrderId    string      `sql:"type:char(20);index" description:"订单ID" json:"order_id"`
	Operation  string      `sql:"type:varchar(50)" description:"操作行为" json:"operation"`
	Remark     string      `sql:"type:text" description:"备注" json:"remark"`
	ObjectData []byte      `sql:"type:json" description:"数据状态"`
	Object     interface{} `sql:"-" json:"object"`
	CreatedAt  time.Time
}

订单操作记录

type OrderPack

type OrderPack struct {
	CreatedAt  time.Time
	ID         uint       `gorm:"primary_key"`
	No         string     `sql:"-" json:"id"`
	DeletedAt  *time.Time `sql:"index"`
	TenantId   string     `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	OrderId    string     `sql:"type:char(20);index" description:"订单ID" json:"order_id"`
	CourierId  string     `sql:"type:char(20);index" description:"物流ID" json:"courier_id"`
	Name       string     `sql:"type:varchar(100)" description:"物流名称" json:"name"`
	CourierNo  string     `sql:"type:char(50);index" description:"物流单号" json:"courier_no"`
	CourierFee float64    `sql:"type:DECIMAL(10, 2);default(0.00)" description:"快递费" json:"courier_fee"`
	SendStatus SendStatus `sql:"type:char(20);index" description:"发货状态" json:"send_status"`
}

订单包裹

func (*OrderPack) AfterFind

func (e *OrderPack) AfterFind() error

func (*OrderPack) BeforeCreate

func (e *OrderPack) BeforeCreate() error

type OrderPackGoods

type OrderPackGoods struct {
	CreatedAt time.Time
	ID        uint           `gorm:"primary_key"`
	No        string         `sql:"-" json:"id"`
	DeletedAt *time.Time     `sql:"index"`
	GoodsId   string         `sql:"type:char(20);index" description:"商品ID" json:"goods_id"`
	Meta      map[string]int `sql:"-" description:"规格对应数量" json:"meta"`
	Metadata  []byte         `sql:"type:json" description:"规格对应数量" json:"-"`
	Quantity  int            `sql:"type:integer" description:"数量" json:"quantity"`
}

订单包裹关联商品,不支持更新

type OrderStatus

type OrderStatus string
const (
	OrderCreate     OrderStatus = "created"     //创建订单,提交订单
	OrderNeedVerify OrderStatus = "need-verify" //待验证,自提订单
	OrderPending    OrderStatus = "pending"     //待支付
	OrderAlready    OrderStatus = "already"     //已支付
	OrderShipping   OrderStatus = "shipping"    //已经发货
	OrderRefund     OrderStatus = "refund"      //退款
	OrderCanceled   OrderStatus = "canceled"    //取消
	OrderCompleted  OrderStatus = "completed"   //已完成
	OrderAbolished  OrderStatus = "abolished"   //已作废
)

type OrderUnitPack

type OrderUnitPack struct {
	gorm.Model
	No               string         `sql:"-" json:"id"`
	TenantId         string         `sql:"type:char(20);index" description:"租户ID" json:"tenant_id,omitempty"`
	MemberId         string         `sql:"type:char(20)" description:"客户ID" json:"member_id,omitempty"`
	OrderId          string         `sql:"type:char(20);index" description:"订单ID" json:"order_id"`
	Pack             []GeneratePack `sql:"-" json:"pack"`
	PackData         []byte         `sql:"type:json" json:"-"`
	Weight           int            `json:"weight"`
	NetWeight        int            `description:"净重" json:"net_weight"`
	GoodsPrice       float64        `sql:"type:DECIMAL(10, 2);default(0.00)" description:"商品价格" json:"goods_price"`
	NetPrice         float64        `sql:"-" json:"net_price"`
	CourierPrice     float64        `sql:"type:DECIMAL(10, 2);default(0.00)" description:"运费" json:"courier_price"`
	Currency         Currency       `json:"currency"`
	CourierId        string         `sql:"type:char(20);index" description:"物流ID" json:"courier_id"`
	CourierInstallId string         `sql:"type:char(20)" description:"安装的物流ID" json:"courier_install_id"`
	CourierName      string         `sql:"type:varchar(100)" description:"物流名称" json:"courier_name"`
	CourierNo        string         `sql:"type:varchar(100)" description:"物流单号" json:"courier_no"`
	Method           string         `sql:"type:char(20)" description:"物流方法" json:"method"`
	Remark           string         `sql:"type:text" description:"备注" json:"remark"`
	Mixed            int            `sql:"-" json:"-"`
	SubMixed         int            `sql:"-" json:"-"`
	SendStatus       SendStatus     `sql:"type:char(20);index" description:"发货状态" json:"send_status"`
}

func (*OrderUnitPack) AfterFind

func (e *OrderUnitPack) AfterFind() error

func (*OrderUnitPack) BeforeSave

func (e *OrderUnitPack) BeforeSave() error

type PackRule

type PackRule struct {
	CourierId   string   `json:"courier_id"`
	LeftRuleId  string   `json:"left_rule_id"`
	RightRuleId string   `json:"right_rule_id"`
	ObjectIds   []string `json:"object_ids"`
}

type PayType

type PayType string
const (
	Balance PayType = "balance"
	Online  PayType = "online"
	Voucher PayType = "voucher"
)

type Payment

type Payment struct {
	gorm.Model
	No          string            `sql:"-" json:"id"`
	Name        string            `sql:"type:varchar(100)" description:"支付模版" json:"name" validate:"required"`
	Method      PaymentMethodType `sql:"type:varchar(100)" description:"调用方法名" json:"method" validate:"required"`
	Status      Status            `sql:"type:integer;default(1)" description:"状态" json:"status" validate:"required"`
	SiteUrl     string            `sql:"type:varchar(255)" description:"官网网址" json:"site_url"`
	Type        PayType           `sql:"type:char(20);index" description:"类型" json:"type"`
	Description string            `sql:"text" description:"描述" json:"description"`
}

func (*Payment) AfterFind

func (p *Payment) AfterFind() error

func (*Payment) AfterSave

func (p *Payment) AfterSave() error

type PaymentInstall

type PaymentInstall struct {
	gorm.Model
	No          string  `sql:"-" json:"id"`
	Used        bool    `description:"安装" json:"used"`
	TenantId    string  `sql:"type:char(20)" description:"租户ID" json:"tenant_id"`
	PaymentId   int     `sql:"type:integer;index" json:"payment_id"`
	Payment     Payment `gorm:"ForeignKey:PaymentId;save_associations:false" json:"payment" validate:"-"`
	AppKey      string  `sql:"type:varchar(50)" description:"app key 三方" json:"app_key"`
	AppSecret   string  `sql:"type:varchar(100)" description:"app secret 三方" json:"app_secret"`
	Image       string  `sql:"type:text" description:"凭证支付所需图片" json:"image"`
	Sort        int     `description:"排序" json:"sort"`
	Description string  `sql:"text" description:"描述" json:"description"`
}

func (*PaymentInstall) AfterFind

func (p *PaymentInstall) AfterFind() error

func (*PaymentInstall) AfterSave

func (p *PaymentInstall) AfterSave() error

type PaymentMethodType

type PaymentMethodType string

type PaymentOrder

type PaymentOrder struct {
	gorm.Model
	No               string            `sql:"-" json:"id"`
	TenantId         string            `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	MemberId         string            `sql:"type:char(20);index" description:"客户ID" json:"member_id"`
	OrderId          string            `sql:"type:char(20);index" description:"订单ID" json:"order_id" validate:"required"`
	PaymentInstallId string            `sql:"type:char(20);index" description:"支付ID" json:"payment_install_id" validate:"required"`
	PaymentInstall   PaymentInstall    `gorm:"ForeignKey:PaymentInstallId;save_associations:false" json:"payment_install" validate:"-"`
	Method           PaymentMethodType `sql:"type:varchar(20)" description:"支付方法" json:"method"`
	Overage          float64           `sql:"type:DECIMAL(10, 2);default(0.00)" description:"使用余额" json:"overage"`
	Currency         Currency          `sql:"type:char(10)" description:"币种" json:"currency"`
	Gold             float64           `sql:"type:DECIMAL(10, 2);default(0.00)" description:"金币" json:"gold"`
	OrderFee         float64           `sql:"type:DECIMAL(10, 2);default(0.00)" description:"订单金额" json:"order_fee"`
	RealFee          float64           `sql:"type:DECIMAL(10, 2);default(0.00)" description:"付款金额" json:"real_fee"`
	AudToCny         float64           `sql:"type:DECIMAL(10, 2);default(0.00)" description:"汇率" json:"aud_to_cny"`
	PayUrl           string            `sql:"type:text" description:"付款链接" json:"pay_url"`
	Redirect         string            `sql:"type:text" description:"付款后跳转" json:"redirect"`
	Token            string            `sql:"type:varchar(100)" description:"回调验证" json:"-"`
	ExternalOrderId  string            `sql:"type:varchar(100)" description:"三方支付订单ID" json:"external_order_id"`
	PaymentStatus    PaymentStatus     `sql:"type:char(10);index" description:"付款状态" json:"payment_status"`
	NotifyUrl        string            `sql:"-" json:"notify_url,omitempty"`
	VoucherData      []byte            `sql:"type:json" description:"付款凭证" json:"-"`
	VoucherImages    []string          `sql:"-" description:"付款凭证" json:"voucher_images"`
	Remark           string            `sql:"type:text" description:"付款备注" json:"remark"`
	Params           interface{}       `sql:"-" json:"params"`
	AppId            string            `sql:"-" json:"app_id,omitempty"`
}

func (*PaymentOrder) AfterCreate

func (e *PaymentOrder) AfterCreate() error

func (*PaymentOrder) AfterFind

func (e *PaymentOrder) AfterFind() error

func (*PaymentOrder) BeforeCreate

func (e *PaymentOrder) BeforeCreate() error

func (*PaymentOrder) BeforeUpdate

func (e *PaymentOrder) BeforeUpdate() error

type PaymentStatus

type PaymentStatus string
const (
	PaymentPending PaymentStatus = "pending"
	PaymentSuccess PaymentStatus = "success"
	PaymentAlready PaymentStatus = "already" //客户已付款
	PaymentFailed  PaymentStatus = "failed"
)

type Region

type Region string
type Related struct {
	TenantId string   `json:"tenant_id"`
	RoleId   string   `json:"role_id"`
	UserId   string   `json:"user_id"`
	Scopes   []string `json:"scopes"`
}

type ResultKeyword

type ResultKeyword struct {
	Id    string `json:"id"`
	Alias string `json:"name"`
}

type RevokeRequest

type RevokeRequest struct {
	// revoke access token
	AccessToken string `json:"access_token"`
	// revoke via refresh token
	RefreshToken string `json:"refresh_token"`
}

type Role

type Role struct {
	gorm.Model
	TenantId    string `json:"tenant_id"`
	Tenant      Tenant `gorm:"save_associations:false" json:"tenant" validate:"-"`
	No          string `sql:"-" json:"id"`
	Name        string `gorm:"type:varchar(100)" description:"用户名"`
	Description string `gorm:"type:text" description:"描述"`
	Privilege   []byte `gorm:"type:json" description:"权限范围"`
	Status      Status `gorm:"default(1)" description:"状态: 1 启用, 0 禁用"`
}

func (*Role) AfterFind

func (r *Role) AfterFind() (err error)

func (*Role) AfterSave

func (r *Role) AfterSave() (err error)

func (*Role) BeforeSave

func (r *Role) BeforeSave() error

func (*Role) Disable

func (r *Role) Disable() error

置为不可用状态

func (*Role) Enable

func (r *Role) Enable() error

置为可用状态

func (*Role) ExistName

func (r *Role) ExistName() (exist bool, err error)

验证是否存在重复name

type SearchActivity

type SearchActivity struct {
	List      []Activity `json:"list"`
	Total     int        `json:"total"`
	Page      int        `json:"page"`
	TotalPage int        `json:"total_page"`
	Limit     int        `json:"limit"`
}

type SearchBrand

type SearchBrand struct {
	List      []Brand `json:"list"`
	Total     int     `json:"total"`
	Page      int     `json:"page"`
	TotalPage int     `json:"total_page"`
	Limit     int     `json:"limit"`
}

type SearchCategory

type SearchCategory struct {
	List      []Category `json:"list"`
	Total     int        `json:"total"`
	Page      int        `json:"page"`
	TotalPage int        `json:"total_page"`
	Limit     int        `json:"limit"`
}

type SearchClass

type SearchClass struct {
	List      []Class `json:"list"`
	Total     int     `json:"total"`
	Page      int     `json:"page"`
	TotalPage int     `json:"total_page"`
	Limit     int     `json:"limit"`
}

type SearchCollection

type SearchCollection struct {
	List      []Collection `json:"list"`
	Total     int          `json:"total"`
	Page      int          `json:"page"`
	TotalPage int          `json:"total_page"`
	Limit     int          `json:"limit"`
}

type SearchConsignee

type SearchConsignee struct {
	List      []Consignee `json:"list"`
	Total     int         `json:"total"`
	Page      int         `json:"page"`
	TotalPage int         `json:"total_page"`
	Limit     int         `json:"limit"`
}

type SearchCourier

type SearchCourier struct {
	List      []Courier `json:"list"`
	Total     int       `json:"total"`
	Page      int       `json:"page"`
	TotalPage int       `json:"total_page"`
	Limit     int       `json:"limit"`
}

type SearchCourierPackRule

type SearchCourierPackRule struct {
	List      []CourierPackRule `json:"list"`
	Total     int               `json:"total"`
	Page      int               `json:"page"`
	TotalPage int               `json:"total_page"`
	Limit     int               `json:"limit"`
}

type SearchCourierTemplate

type SearchCourierTemplate struct {
	List      []CourierTemplate `json:"list"`
	Total     int               `json:"total"`
	Page      int               `json:"page"`
	TotalPage int               `json:"total_page"`
	Limit     int               `json:"limit"`
}

type SearchFinanceLog

type SearchFinanceLog struct {
	List      []FinanceLog `json:"list"`
	Total     int          `json:"total"`
	Page      int          `json:"page"`
	TotalPage int          `json:"total_page"`
	Limit     int          `json:"limit"`
}

type SearchFunctionCircle

type SearchFunctionCircle struct {
	List      []FunctionCircle `json:"list"`
	Total     int              `json:"total"`
	Page      int              `json:"page"`
	TotalPage int              `json:"total_page"`
	Limit     int              `json:"limit"`
}

type SearchGoods

type SearchGoods struct {
	List      []Goods `json:"list"`
	Total     int     `json:"total"`
	Page      int     `json:"page"`
	TotalPage int     `json:"total_page"`
	Limit     int     `json:"limit"`
}

type SearchGoodsInfo

type SearchGoodsInfo struct {
	List      []GoodsInfo `json:"list"`
	Total     int         `json:"total"`
	Page      int         `json:"page"`
	TotalPage int         `json:"total_page"`
	Limit     int         `json:"limit"`
}

type SearchKeyword

type SearchKeyword struct {
	Name string `json:"name"`
}

type SearchMember

type SearchMember struct {
	List      []Member `json:"list"`
	Total     int      `json:"total"`
	Page      int      `json:"page"`
	TotalPage int      `json:"total_page"`
	Limit     int      `json:"limit"`
}

type SearchMemberLevel

type SearchMemberLevel struct {
	List      []MemberLevel `json:"list"`
	Total     int           `json:"total"`
	Page      int           `json:"page"`
	TotalPage int           `json:"total_page"`
	Limit     int           `json:"limit"`
}

type SearchOrder

type SearchOrder struct {
	List      []Order `json:"list"`
	Total     int     `json:"total"`
	Page      int     `json:"page"`
	TotalPage int     `json:"total_page"`
	Limit     int     `json:"limit"`
}

type SearchOrderOperateLog

type SearchOrderOperateLog struct {
	List      []OrderOperateLog `json:"list"`
	Total     int               `json:"total"`
	Page      int               `json:"page"`
	TotalPage int               `json:"total_page"`
	Limit     int               `json:"limit"`
}

type SearchPayment

type SearchPayment struct {
	List      []Payment `json:"list"`
	Total     int       `json:"total"`
	Page      int       `json:"page"`
	TotalPage int       `json:"total_page"`
	Limit     int       `json:"limit"`
}

type SearchRole

type SearchRole struct {
	List      []Role
	Total     int
	Page      int
	TotalPage int
	Limit     int
}

type SearchSender

type SearchSender struct {
	List      []Sender `json:"list"`
	Total     int      `json:"total"`
	Page      int      `json:"page"`
	TotalPage int      `json:"total_page"`
	Limit     int      `json:"limit"`
}

type SearchShippingWarehouse

type SearchShippingWarehouse struct {
	List      []ShippingWarehouse `json:"list"`
	Total     int                 `json:"total"`
	Page      int                 `json:"page"`
	TotalPage int                 `json:"total_page"`
	Limit     int                 `json:"limit"`
}

type SearchShowCategory

type SearchShowCategory struct {
	List      []ShowCategory `json:"list"`
	Total     int            `json:"total"`
	Page      int            `json:"page"`
	TotalPage int            `json:"total_page"`
	Limit     int            `json:"limit"`
}

type SearchSystemConfig

type SearchSystemConfig struct {
	List      []SystemConfig `json:"list"`
	Total     int            `json:"total"`
	Page      int            `json:"page"`
	TotalPage int            `json:"total_page"`
	Limit     int            `json:"limit"`
}

type SearchTenant

type SearchTenant struct {
	List      []Tenant
	Total     int
	Page      int
	TotalPage int
	Limit     int
}

type SearchUser

type SearchUser struct {
	List      []*User
	Total     int
	Page      int
	TotalPage int
	Limit     int
}

type SelectType

type SelectType string
const (
	Radio    SelectType = "radio"
	Multiple SelectType = "multiple"
)

type SendStatus

type SendStatus string
const (
	SendWill        SendStatus = "will"        //待发货
	SendAlready     SendStatus = "already"     //已发货
	SendSynchronize SendStatus = "synchronize" //同步物流
)

type Sender

type Sender struct {
	gorm.Model
	No       string `sql:"-" json:"id"`
	TenantId string `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	MemberId string `sql:"type:char(20);index" description:"客户ID" json:"member_id"`
	Name     string `sql:"type:varchar(100)" description:"姓名" json:"name" validate:"required"`
	Phone    string `sql:"type:varchar(50)" description:"手机号" json:"phone" validate:"required"`
	Country  string `sql:"type:varchar(50)" description:"国家" json:"country"`
	Province string `sql:"type:varchar(50)" description:"省份" json:"province"`
	City     string `sql:"type:varchar(50)" description:"市" json:"city"`
	Address  string `sql:"type:varchar(255)" description:"详细地址" json:"address"`
	Tag      string `sql:"type:varchar(100)" description:"地址标签" json:"tag"`
	Default  bool   `description:"默认地址" json:"default"`
}

寄件人

func (*Sender) AfterFind

func (s *Sender) AfterFind() error

func (*Sender) AfterSave

func (s *Sender) AfterSave() error

type ShippingWarehouse

type ShippingWarehouse struct {
	gorm.Model
	TenantId     string             `sql:"type:char(20);index" json:"-"`
	No           string             `sql:"-" json:"id"`
	Name         string             `sql:"type:varchar(100)" description:"发货仓名称" json:"name" validate:"required"`
	Currency     Currency           `sql:"type:varchar(20)" description:"币种" json:"currency" validate:"required"`
	Region       Region             `sql:"type:varchar(20)" description:"地区" json:"region" validate:"required"`
	Address      string             `sql:"type:text" description:"真实地址" json:"address" validate:"required"`
	Status       Status             `sql:"type:integer;default(1)" description:"状态 1启用 2禁用" json:"status"`
	GetSelf      bool               `description:"自提" json:"get_self"`
	NeedIdCard   bool               `description:"需要身份证照片必传" json:"need_id_card"`
	Couriers     []WarehouseCourier `sql:"-" description:"关联物流" json:"couriers"`
	CouriersData []byte             `sql:"type:json" json:"-"`
}

发货仓

func (*ShippingWarehouse) AfterFind

func (s *ShippingWarehouse) AfterFind() error

func (*ShippingWarehouse) AfterSave

func (s *ShippingWarehouse) AfterSave() error

func (*ShippingWarehouse) BeforeSave

func (s *ShippingWarehouse) BeforeSave() error

type ShoppingCart

type ShoppingCart struct {
	ID                   uint                   `gorm:"primary_key"`
	No                   string                 `sql:"-" json:"id"`
	TenantId             string                 `sql:"type:char(20)" description:"租户ID" json:"tenant_id"`
	MemberId             string                 `sql:"type:char(20)" description:"客户ID" json:"member_id"`
	GoodsId              string                 `sql:"type:char(20)" description:"商品ID" json:"goods_id" validate:"required"`
	Goods                Goods                  `gorm:"save_associations:false" json:"goods" validate:"-"`
	GoodsSpecificationId string                 `sql:"type:char(20)" description:"商品规格ID" json:"goods_specification_id"`
	GoodsSpecification   GoodsSpecification     `gorm:"save_associations:false" json:"goods_specification" validate:"-"`
	WarehouseId          string                 `sql:"type:char(40)" description:"发货仓关联ID" json:"warehouse_id" validate:"required"`
	Warehouse            GoodsShippingWarehouse `gorm:"save_associations:false" json:"warehouse" validate:"-"`
	PackSpecification    int                    `sql:"type:integer;default(1)" description:"包装规格(默认1)" json:"pack_specification"`
	Quantity             int                    `sql:"type:integer;default(1)" description:"数量" json:"quantity" validate:"required"`
	Selected             bool                   `description:"选中" json:"selected"`
	CreatedAt            time.Time
	UpdatedAt            time.Time
}

func (*ShoppingCart) AfterFind

func (e *ShoppingCart) AfterFind() error

type ShowCategory

type ShowCategory struct {
	gorm.Model
	No          string         `sql:"-" json:"id"`
	TenantId    string         `sql:"type:char(20);index" description:"租户ID" json:"-"`
	Name        string         `sql:"type:varchar(100)" description:"名称" json:"name" validate:"required"`
	Image       string         `json:"image"`
	Parent      *ShowCategory  `gorm:"save_associations:false" json:"parent"`
	ParentId    string         `sql:"type:char(20);index" json:"parent_id" description:"父级ID"`
	Status      Status         `sql:"type:integer;default(1);index" description:"展示状态" json:"status" validate:"required"`
	Description string         `sql:"type:text" description:"描述" json:"description"`
	Children    []ShowCategory `gorm:"ForeignKey:ParentId" json:"children"`
	Sort        int            `description:"排序" json:"sort"`
}

func (*ShowCategory) AfterFind

func (s *ShowCategory) AfterFind() error

func (*ShowCategory) AfterSave

func (s *ShowCategory) AfterSave() error

type ShowCategoryGoods

type ShowCategoryGoods struct {
	gorm.Model
	No          string  `sql:"-" json:"id"`
	TenantId    string  `sql:"type:char(20);index" description:"租户ID" json:"-"`
	Name        string  `sql:"type:varchar(100)" description:"名称" json:"name" validate:"required"`
	Image       string  `json:"image"`
	ParentId    string  `sql:"type:char(20);index" json:"parent_id" description:"父级ID"`
	Status      Status  `sql:"type:integer;default(1);index" description:"展示状态" json:"status" validate:"required"`
	Description string  `sql:"type:text" description:"描述" json:"description"`
	Sort        int     `description:"排序" json:"sort"`
	Goods       []Goods `gorm:"ForeignKey:ShowCategoryId" json:"goods"`
}

func (ShowCategoryGoods) TableName

func (ShowCategoryGoods) TableName() string

type ShowCategoryParentGoods

type ShowCategoryParentGoods struct {
	gorm.Model
	No          string  `sql:"-" json:"id"`
	TenantId    string  `sql:"type:char(20);index" description:"租户ID" json:"-"`
	Name        string  `sql:"type:varchar(100)" description:"名称" json:"name" validate:"required"`
	Image       string  `json:"image"`
	Status      Status  `sql:"type:integer;default(1);index" description:"展示状态" json:"status" validate:"required"`
	Description string  `sql:"type:text" description:"描述" json:"description"`
	Goods       []Goods `gorm:"ForeignKey:ParentShowCategoryId" json:"goods"`
	Sort        int     `description:"排序" json:"sort"`
}

只用于查找

func (*ShowCategoryParentGoods) AfterFind

func (s *ShowCategoryParentGoods) AfterFind() error

func (*ShowCategoryParentGoods) AfterSave

func (s *ShowCategoryParentGoods) AfterSave() error

func (ShowCategoryParentGoods) TableName

func (ShowCategoryParentGoods) TableName() string

type SpecificationInfo

type SpecificationInfo struct {
	Level         int                 `json:"level"`
	Item          string              `json:"item"`
	Specification GoodsSpecification  `json:"specification,omitempty"`
	Children      []SpecificationInfo `json:"children,omitempty"`
}

func (*SpecificationInfo) G生成规格记录

func (s *SpecificationInfo) G生成规格记录(tx *gorm.DB, tenantId, goodsId string, specifications ...string) ([]GoodsSpecification, error)

type Status

type Status int
const (
	Enable Status
	Disable
)

type SystemConfig

type SystemConfig struct {
	gorm.Model
	TenantId string                 `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	Name     string                 `sql:"type:varchar(100);index" description:"名称" json:"name" validate:"required"`
	Meta     map[string]interface{} `sql:"-" description:"数据集合" json:"meta"`
	Metadata []byte                 `sql:"type:json" description:"数据集合" json:"-"`
}

func (*SystemConfig) AfterFind

func (e *SystemConfig) AfterFind() (err error)

func (*SystemConfig) BeforeSave

func (e *SystemConfig) BeforeSave() (err error)

type Tenant

type Tenant struct {
	gorm.Model
	No             string    `sql:"-" json:"id"`
	Name           string    `gorm:"type:varchar(100)" description:"名称" json:"name"`
	Contact        string    `gorm:"type:varchar(20)" description:"联系方式" json:"contact"`
	Description    string    `gorm:"type:text" description:"描述" json:"description"`
	Secret         string    `gorm:"type:varchar(100)" description:"密钥" json:"secret"`
	System         bool      `gorm:"type:boolean" description:"是否为租户系统用户" json:"system"`
	Expired        time.Time `gorm:"index:idx_expired" description:"到期时间" json:"expired"`
	Status         Status    `gorm:"default(1);index:idx_status" description:"状态: 1 启用, 2 禁用" json:"status"`
	Domain         string    `gorm:"type:varchar(255);unique;index" description:"租户独立域名0" json:"domain"`
	Domain1        string    `gorm:"type:varchar(255);index" description:"租户独立域名1" json:"domain1"`
	Domain2        string    `gorm:"type:varchar(255);index" description:"租户独立域名2" json:"domain2"`
	GenerateSecret bool      `gorm:"-"`
}

func (*Tenant) AfterFind

func (t *Tenant) AfterFind() (err error)

func (*Tenant) AfterSave

func (t *Tenant) AfterSave() (err error)

func (*Tenant) BeforeCreate

func (t *Tenant) BeforeCreate() (err error)

func (*Tenant) BeforeUpdate

func (t *Tenant) BeforeUpdate() (err error)

func (*Tenant) ExistDomain

func (t *Tenant) ExistDomain() (exist bool, err error)

验证是否存在重复domain

func (*Tenant) ExistName

func (t *Tenant) ExistName() (exist bool, err error)

验证是否存在重复client_id

type Token

type Token struct {
	AccessToken  string    `json:"access_token"`
	TokenType    string    `json:"token_type"`
	RefreshToken string    `json:"refresh_token"`
	ExpiresAt    time.Time `json:"expires_at"`
	Scopes       []string  `json:"scopes"`
}

type TokenRequest

type TokenRequest struct {
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	Code         string `json:"code"`
	Username     string `json:"username"`
	Password     string `json:"password"`
	// password, client_credentials, authorization_code, refresh_token
	GrantType    string `json:"grant_type"`
	RedirectUri  string `json:"redirect_uri"`
	RefreshToken string `json:"refresh_token,omitempty"`
	// scopes can be added for client_credentials request
	Scopes []string `json:"scopes"`
	// metadata to be stored with a token that's generated
	Metadata interface{} `json:"metadata"`
}

type TokenResponse

type TokenResponse struct {
	Token *Token `json:"token"`
}

type User

type User struct {
	gorm.Model
	No               string `sql:"-" json:"id"`
	TenantId         string `sql:"type:char(20);index" description:"租户ID" json:"tenant_id"`
	Tenant           Tenant `gorm:"save_associations:false" json:"tenant" validate:"-"`
	RoleId           string `sql:"type:char(20);index" description:"角色ID" json:"role_id"`
	Role             Role   `gorm:"save_associations:false" json:"role" validate:"-"`
	Username         string `gorm:"type:varchar(100)" description:"用户名"`
	Nickname         string `gorm:"type:varchar(100)" description:"昵称"`
	Description      string `gorm:"type:text" description:"描述"`
	OpenId           string `gorm:"type:varchar(100)" description:"三方登录openid"`
	PasswordHash     string `gorm:"type:varchar(100)" description:"密码hash值" json:"-"`
	Salt             string `gorm:"type:varchar(20)" description:"加盐值" json:"-"`
	RestPasswordHash string `gorm:"type:varchar(100)" description:"重置密码hash值"`
	Status           Status `gorm:"default(1)" description:"状态: 1 启用, 0 禁用"`
	Password         string `gorm:"-"` //用于暂存密码
	HeadImage        string `gorm:"type:text" description:"头像"`
}

func (*User) AfterFind

func (u *User) AfterFind() (err error)

func (*User) AfterSave

func (u *User) AfterSave() error

func (*User) BeforeCreate

func (u *User) BeforeCreate() (err error)

func (*User) BeforeUpdate

func (u *User) BeforeUpdate() (err error)

func (*User) ExistUsername

func (u *User) ExistUsername() (exist bool, err error)

验证是否存在重复username

func (*User) GetPasswordHash

func (u *User) GetPasswordHash() string

获取密码hash

func (*User) SetPassword

func (u *User) SetPassword(value string)

设置密码

func (*User) Verify

func (u *User) Verify() bool

验证密码

type WarehouseCourier

type WarehouseCourier struct {
	Id        string `json:"id"`
	CourierId string `json:"courier_id"`
	Name      string `json:"name"`
	Default   bool   `json:"default"`
}

Jump to

Keyboard shortcuts

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