model

package
v0.0.0-...-8587cce Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Model

	/** 添加者的userId*/
	UserID uint64 `gorm:"type:bigint;" form:"userId" json:"-"`

	Phone string `gorm:"type:varchar(20);" form:"phone" json:"phone"`

	Contact string `gorm:"type:varchar(20);" form:"contact" json:"contact"`

	/** 排序 */
	Order uint `gorm:"type:int;" form:"order"`

	/** 名称 */
	Province string `gorm:"type:varchar(36);" form:"province" json:"province"`

	ProvinceCode string `gorm:"type:varchar(36);" form:"provinceCode" json:"provinceCode"`

	City     string `gorm:"type:varchar(36);" form:"city" json:"city"`
	CityCode string `gorm:"type:varchar(36);" form:"cityCode" json:"cityCode"`

	Area     string `gorm:"type:varchar(36);" form:"area" json:"area"`
	AreaCode string `gorm:"type:varchar(36);" form:"areaCode" json:"areaCode"`

	AddressDetail string `gorm:"type:varchar(40);" form:"address" json:"address"`

	/** 描述 */
	Desc string `gorm:"type:varchar(36);" form:"desc"`

	IsDefault bool `gorm:"type:tinyint" form:"isDefault" json:"isDefault"`

	CrudTime
}

产品分类结构体

func (*Address) BeforeCreate

func (address *Address) BeforeCreate(db *gorm.DB) error

插入前生成主键

type AppWechatPay

type AppWechatPay struct {
	Appid     string `json:"appid"`
	Noncestr  string `json:"noncestr"`
	Package   string `json:"package"`
	Partnerid uint64 `json:"partnerid"`
	PaySign   string `json:"paySign"`
	Prepayid  string `json:"prepayid"`
	Timestamp string `json:"timestamp"`
}

type Area

type Area struct {
	Model

	/**  */
	Code uint64 `gorm:"type:bigint;" form:"code" json:"code"`

	/** 名称 */
	Name string `gorm:"type:varchar(36);" form:"name" json:"name"`

	ProvinceCode string `gorm:"type:varchar(36);" form:"provinceCode" json:"provinceCode"`

	CityCode string `gorm:"type:varchar(36);" form:"cityCode" json:"cityCode"`
}

省份结构体

func (*Area) BeforeCreate

func (area *Area) BeforeCreate(db *gorm.DB) error

插入前生成主键

type Banner struct {
	Model

	/** 1是平台自己,2是商户 */
	Type int8 `gorm:"type:tinyint(3);" form:"type" json:"type"`

	/** 店铺id */
	ShopId string `gorm:"type:varchar(36)" json:"shopId" form:"shop_id" binding:"required"`

	/** banner url */
	ImageUrl string `gorm:"type:varchar(5000);" form:"image_url" binding:"required" json:"imageUrl"`

	/** banner 要跳转的地址 */
	ToUrl string `gorm:"type:varchar(255)" form:"to_url" json:"toUrl"`

	/** 跳转类型,1:web 2:app */
	ToType int8 `gorm:"type:tinyint(3);default:1" form:"to_type" json:"toType"`

	/** banner title */
	Title string `gorm:"type:varchar(255);" form:"title" json:"title"`

	/** banner 的描述 */
	Content string `gorm:"type:varchar(255)" json:"content"`

	Duration

	CrudTime
}

func (*Banner) BeforeCreate

func (banner *Banner) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*Banner) Validator

func (banner *Banner) Validator() error

校验表单中提交的参数是否合法

type BaseShoppingCart

type BaseShoppingCart struct {
	Model

	ProductId uint64 `gorm:"type:bigint;column:product_id;not null;" json:"productId" form:"productId"`

	Number uint64 `gorm:"type:int(10)" json:"number" form:"number"`

	Price uint64 `gorm:"type:varchar(30);" form:"price" json:"price"`

	SkuId uint64 `gorm:"type:bigint" form:"skuId" json:"skuId"` //反正要去sku里面拿库存,CombineId就没有必要存在了

	UserID uint64 `gorm:"type:bigint" form:"userId" json:"userId"`

	//Product *Product `gorm:"hasOne;ForeignKey:ProductId;AssociationForeignKey:ProductId" json:"product"`
	Product *Product `gorm:"foreignKey:ProductId" json:"product"`

	Sku *Sku `gorm:"foreignKey:SkuId" json:"sku"`
}

type CallbackInfo

type CallbackInfo struct {
	AccessToken  string `json:"access_token" weChat:"access_token"`
	RefreshToken string `json:"refresh_token" weChat:"refresh_token"`
	ExpiresIn    int64  `json:"expires_in" weChat:"expires_in"`
	OpenId       string `json:"openid" weChat:"openid"`
	UnionId      string `json:"unionid" weChat:"unionid"`
	Nickname     string `json:"nickname" weChat:"nickname"`
	HeadImageURL string `json:"head_image_url,omitempty" weChat:"HeadImageURL"`
}

type Category

type Category struct {
	Model

	/** 商店id */
	ShopId uint64 `gorm:"type:bigint(20);" form:"shopId" json:"shopId"`

	/** 分类排序 */
	Order uint `gorm:"type:int;" form:"order" json:"order"`

	/** 分类名称 */
	Name string `gorm:"type:varchar(36);" form:"name" json:"name"`

	ImageUrl string `gorm:"type:varchar(500);" form:"imageUrl" json:"imageUrl"`

	/** 分类层级*/
	Level uint8 `gorm:"type:smallint" form:"level" json:"level"`

	/** 分类描述 */
	Desc string `gorm:"type:varchar(36);" form:"desc" json:"desc"`

	/** 添加者的userId,为了好追踪 */
	UserID uint64 `gorm:"type:bigint;" form:"userId" json:"-"`

	ExpiredTime
	CrudTime
}

产品分类结构体

func (*Category) BeforeCreate

func (category *Category) BeforeCreate(db *gorm.DB) error

插入前生成主键

type City

type City struct {
	Model

	/**  */
	Code uint64 `gorm:"type:bigint;" form:"code" json:"code"`

	/** 名称 */
	Name string `gorm:"type:varchar(36);" form:"name" json:"name"`

	ProvinceCode string `gorm:"type:varchar(36);" form:"provinceCode" json:"provinceCode"`
}

省份结构体

func (*City) BeforeCreate

func (city *City) BeforeCreate(db *gorm.DB) error

插入前生成主键

type Cost

type Cost struct {
	OrderId uint64 `form:"orderId"`
	/** 用户消费的代金券张数*/
	Number uint64 `form:"number"`

	/** 用户剩下的代金券金额或者剩下商品的总金额*/
	Money uint64 `form:"money"`

	ShopId   uint64 `form:"shopId"`
	Platform string `form:"platform"`
	/** 购买者userId*/
	UserID uint64 `form:"userId"`
	/**核销店员user_id*/
	CheckUserID uint64 `form:"checkUserID"`
	ProductId   string `form:"productId"`
}

type CrudTime

type CrudTime struct {
	/** 创建时间 */
	CreatedAt datetime.DateTime `json:"createdAt"`

	/** 更新时间 */
	UpdatedAt datetime.DateTime `json:"updatedAt"`

	/** 删除时间 */
	//DeletedAt pq.NullTime `json:"-"`
	DeletedAt *datetime.DateTime `json:"-"`
}

定义 增删改时间 结构体

type Demo

type Demo struct {
	/** 主键id*/
	Model

	/** 商店id */
	ShopId uint64 `gorm:"type:bigint(20);" form:"shopId"`

	/** 排序 */
	Order uint `gorm:"type:int;" form:"order"`

	/** 分类名称 */
	Name string `gorm:"type:varchar(36);" form:"name"`

	/** 分类描述 */
	Desc string `gorm:"type:varchar(36);" form:"desc"`

	/** 添加者的userId,为了好追踪 */
	UserID uint64 `gorm:"type:bigint;" form:"userId"`

	ExpiredTime
	CrudTime
}

产品分类结构体

func (*Demo) BeforeCreate

func (demo *Demo) BeforeCreate(db *gorm.DB) error

插入前生成主键

type Duration

type Duration struct {
	/** 开始时间 */
	BeginAt datetime.DateTime `gorm:"type:timestamp;" json:"beginAt"`

	/** 结束时间 */
	EndAt datetime.DateTime `gorm:"type:timestamp;" json:"endAt"`
}

type ExpiredTime

type ExpiredTime struct {
	ExpiredAt datetime.DateTime `json:"expiredAt"`
}

type Feedback

type Feedback struct {
	/** 主键 */
	Model

	/** 提交反馈的userId*/
	UserID uint64 `gorm:"type:bigint;column:user_id;not null" json:"user_id" form:"user_id"`

	Username string `gorm:"type:varchar(36);column:username;" json:"username" form:"username"`

	Phone string `gorm:"type:varchar(20);column:phone;" json:"phone" form:"phone"`

	Mail string `gorm:"type:varchar(36);column:mail;" json:"mail" form:"mail"`

	/**反馈的title*/
	Title string `gorm:"type:varchar(36);column:Title;" json:"title" form:"title"`

	/**反馈描述*/
	Description string `gorm:"type:varchar(32)" json:"description" form:"description" binding:"required"`

	/** 状态  0,未处理,1:正在处理中,3:已完成,4:重新打开  */
	Status uint `gorm:"type:tinyint(1);default:0" json:"status"  form:"status"`

	/**类别:0:建议, 1:投诉,2:其他*/
	Type uint `gorm:"type:tinyint(1)" json:"type"  form:"type"`

	/** 增删改的时间 */
	CrudTime
}

func (*Feedback) BeforeCreate

func (feedback *Feedback) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*Feedback) Validator

func (feedback *Feedback) Validator() error

校验表单中提交的参数是否合法

type Function

type Function struct {
	/** 主键 id */
	Model

	/** 功能名称 */
	FunName string

	/** 访问路径 */
	FunUrl string

	/** 是否生成菜单  */
	IsMenu bool

	/** 图标 */
	FunIcon string

	/** 序号 */
	Seq int

	/** 父功能 id */
	PId *string

	/** 父功能 */
	ParentFunction *Function `gorm:"foreignkey:PId;save_associations:false" `

	/** 子功能 */
	ChildFunctions []*Function `gorm:"foreignkey:ID"`

	/** 对应的角色 */
	Roles []*Role `gorm:"many2many:role_functions;" json:"-"`

	/** 增删改的时间 */
	CrudTime
	// contains filtered or unexported fields
}

功能菜单结构体

func (*Function) BeforeCreate

func (function *Function) BeforeCreate(db *gorm.DB) error

插入前生成主键

type GeoPoint

type GeoPoint struct {
	Longitude float64 `form:"longitude" json:"longitude"`
	Latitude  float64 `form:"latitude" json:"latitude"`
}

func (*GeoPoint) Scan

func (p *GeoPoint) Scan(val interface{}) error

Scan implements the Scanner interface which will scan the postgis POINT(x, y) into the GeoPoint struct

func (*GeoPoint) String

func (p *GeoPoint) String() string

func (*GeoPoint) String2

func (p *GeoPoint) String2() string

func (GeoPoint) Value

func (p GeoPoint) Value() (driver.Value, error)

type ListsResponse

type ListsResponse struct {
	helper.JsonObject
	Data []Product
}

type Merchant

type Merchant struct {
	Model

	UserID uint64 `gorm:"type:bigint(20);column:user_id;" json:"userId" form:"userId"`

	/** merchant title */
	Title string `gorm:"type:varchar(255);" form:"title" json:"title"`

	/** 商户电话 */
	Phone string `gorm:"type:varchar(20);" form:"phone" binding:"required" json:"phone"`

	/** 商户描述 */
	Description string `gorm:"type:varchar(1000);" form:"description" json:"description"`

	Creator string `gorm:"type:varchar(20);" form:"creator" json:"-"`

	/** 商户状态,0:不可用,1:可用*/
	Status int8 `gorm:"type:tinyint(3);default:0" form:"status" json:"status"`

	ShopList []Shop `gorm:"ForeignKey:MerchantId;" json:"shopList"`

	CrudTime
}

func (*Merchant) BeforeCreate

func (merchant *Merchant) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*Merchant) Validator

func (merchant *Merchant) Validator() error

校验表单中提交的参数是否合法

type MerchantOrderDetail

type MerchantOrderDetail struct {
	Model

	OrderId uint64 `gorm:"type:bigint;column:order_id;not null;" json:"orderId"`

	MerchantId uint64 `gorm:"type:bigint;column:merchant_id;not null;" json:"merchantId"`

	Number uint64 `gorm:"type:int(10)" json:"number"`

	/**商户的收入*/
	Money uint64 `gorm:"type:bigint(20)" json:"money"`

	ShopId uint64 `gorm:"type:bigint;column:shop_id" json:"shopId"`

	/**status  1:待核销,2:已核销*/
	Status uint8 `gorm:"type:tinyint(3);" json:"status"`

	Platform string `gorm:"type:varchar(10)" json:"platform"`

	/** 购买者userId*/
	UserID uint64 `gorm:"type:bigint;column:user_id;" form:"user_id" json:"userId" weChat:"userId"`

	/** 核销的店员用户id*/
	CheckUserID uint64 `gorm:"type:bigint;column:check_user_id;" form:"checkUserID" json:"checkUserID"`

	ProductId uint64 `gorm:"type:bigint;column:product_id;" json:"productId"`
	Describe  string `gorm:"type:varchar(255)" json:"describe"`

	/** 1:用户核销(贷入)2:和平台结算(贷出) */
	Type uint8 `gorm:"type:tinyint(1)" json:"type"`

	/** 1:实物,2:代金券 对应order的type*/
	GoodsType uint8 `gorm:"type:tinyint(1)" json:"goodsType"`

	//ShopDetail    *ShopDetail    `gorm:"ForeignKey:ShopId;AssociationForeignKey:ShopId" json:"shop"`
	ShopDetail Shop `gorm:"foreignKey:ShopId" json:"shop"`
	//ProductDetail *ProductDetail `gorm:"ForeignKey:ProductId;AssociationForeignKey:ProductId" json:"product"`
	ProductDetail Product `gorm:"foreignKey:ProductId" json:"product"`

	CrudTime
}

func (*MerchantOrderDetail) BeforeCreate

func (order *MerchantOrderDetail) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*MerchantOrderDetail) Validator

func (order *MerchantOrderDetail) Validator() error

校验表单中提交的参数是否合法

type MerchantOrderDetailPage

type MerchantOrderDetailPage struct {
	Status uint8  `from:"status" json:"status"`
	Month  string `from:"status" json:"status"`
	PageObject
}

type MerchantOrderListsResponse

type MerchantOrderListsResponse struct {
	helper.JsonObject
	Data []MerchantOrderDetail
}

type MerchantSummary

type MerchantSummary struct {
	MerchantId string `gorm:"type:varchar(36);column:merchant_id;" json:"merchantId"`
	Title      string `gorm:"type:varchar(255); column:title;" json:"title"`
	Phone      string `gorm:"type:varchar(20); column:phone" json:"phone"`
}

func (MerchantSummary) TableName

func (MerchantSummary) TableName() string

type Model

type Model struct {
	ID uint64 `gorm:"column:id;type:bigint;primaryKey;" json:"id"`
}

type MoneyLog

type MoneyLog struct {
	Model

	/**微信支付订单号*/
	TransactionID string `gorm:"type:varchar(32);column:transaction_id" json:"transaction_id"`

	/** 用户消费的金额*/
	Cost uint64 `gorm:"type:bigint(20)" json:"cost" form:"cost"`

	/** 本次上线返现,商户的收益金额,或者自己的返现*/
	Income uint64 `gorm:"type:bigint(20)" json:"income" form:"income"`

	/** 用户花费的积分*/
	CostScore uint64 `gorm:"type:bigint(20)" json:"costScore" form:"costScore"`

	/** 用户赚到的积分*/
	Score uint64 `gorm:"type:bigint(20)" json:"score" form:"score"`

	/** 这条记录的userId*/
	UserID uint64 `gorm:"type:bigint;column:user_id;" form:"user_id" json:"user_id"`

	/**相关用户id,merchant的userId或者上线的userId,或者merchantId*/
	RelationUserID uint64 `gorm:"type:bigint;column:relation_user_id;" form:"relation_user_id" json:"relation_user_id"`

	OrderId  uint64 `gorm:"type:bigint;column:order_id;" json:"orderId"`
	Describe string `gorm:"type:varchar(255)" json:"describe"`
	/** 1:商户代核销入账,2:下线消费入账, 3:自己消费返现, 4:用积分购买商品,5:商户自卖产品入账,6:商户提现,7:自己购买产品 */
	Type uint8 `gorm:"type:tinyint(1)" json:"type"`

	Merchant Merchant `gorm:"ForeignKey:RelationUserID" json:"merchant"`
	CrudTime
}

资金、积分明细表

func (*MoneyLog) BeforeCreate

func (moneyLog *MoneyLog) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*MoneyLog) Validator

func (moneyLog *MoneyLog) Validator() error

校验表单中提交的参数是否合法

type Option

type Option struct {
	/** 主键id*/
	Model

	/** option描述 */
	Desc string `gorm:"type:varchar(36);" form:"desc" json:"desc"`

	/** option的图片地址*/
	ImageUrl string `gorm:"type:varchar(255);" form:"imageUrl" json:"imageUrl"`

	/** option的类别 1:颜色,2:尺寸 3:其他*/
	Type uint8 `gorm:"type:tinyint" form:"type" json:"type"`

	/** 排序 */
	Order uint `gorm:"type:int;" form:"order" json:"order"`

	/** 添加者的userId,为了好追踪 */
	UserID uint64 `gorm:"type:bigint;" form:"userId" json:"userId"`

	CrudTime
}

结构体

func (*Option) BeforeCreate

func (option *Option) BeforeCreate(db *gorm.DB) error

插入前生成主键

type Order

type Order struct {
	Model

	//OrderId    string `gorm:"type:varchar(36);column:order_id;" json:"orderId" form:"orderId"`
	OutTradeNo string `gorm:"type:varchar(32);unique" form:"out_trade_no" json:"-"`

	/**微信支付订单号*/
	TransactionID string `gorm:"type:varchar(32);column:transaction_id" json:"transactionID"`

	/** 用户购买的代金券的张数,要是大于0就要用orderId去代金券表里查*/
	VoucherNumber uint `gorm:"type:int(10)" json:"voucherNumber" form:"voucherNumber"`

	/** 总金额*/
	TotalAmount uint64 `gorm:"type:bigint(20)" json:"totalAmount" form:"totalAmount"`

	/** 运费*/
	LogisticsAmount uint64 `gorm:"type:bigint(20)" json:"logisticsAmount" form:"logisticsAmount"`

	/**使用的积分*/
	Score uint64 `gorm:"type:bigint(20)" json:"totalScoreToPay"`

	/** 用户使用代金券后商品的应该支付的金额*/
	Pay uint64 `gorm:"type:bigint(20)" json:"pay"`

	PrepayID string `gorm:"type:varchar(36);column:prepay_id" json:"prepayId"`

	//0:待支付,1:已支付,待回调确认,2:支付成功,已回调确认,3:线下商品商户已经核销,4:已经发货,5:已收货,6:申请退款,7:已退款,8:纠纷中,9:已关闭,100:已完成
	Status int8 `gorm:"type:tinyint(3);" json:"status"`

	Platform string `gorm:"type:varchar(10)" json:"platform"`

	/** 购买者userId,或者推荐者的userId*/
	UserID uint64 `gorm:"type:bigint;column:user_id;" form:"userId" json:"userId" weChat:"user_id"`

	Describe string `gorm:"type:varchar(255)" json:"describe"`

	/** 定单类型,与商品的价格类型要保持一致 1-普通价格商品,2-秒杀商品,3-砍价商品,4-拼团商品*/
	Type uint8 `gorm:"type:tinyint(1)" json:"type"`

	OrderProduct []*OrderProduct `gorm:"foreignKey:OrderId" json:"orderProduct"`

	Total int `json:"total"`

	CrudTime
}

func (*Order) BeforeCreate

func (order *Order) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*Order) Validator

func (order *Order) Validator() error

校验表单中提交的参数是否合法

type OrderDetail

type OrderDetail struct {
	OrderId uint64 `gorm:"type:bigint(20);" form:"orderId"`
	Number  uint64 `gorm:"type:bigint(20)" json:"number"`
}

func (OrderDetail) TableName

func (OrderDetail) TableName() string

type OrderListObject

type OrderListObject struct {
	OrderId uint64 `form:"orderId" json:"orderId"`
	ShopId  uint64 `form:"shopId" json:"shopId"`
	PageObject
}

type OrderProduct

type OrderProduct struct {
	Model

	/** 定单id */
	OrderId uint64 `gorm:"type:bigint;" form:"orderId"`

	/** 商店id */
	ShopId uint64 `gorm:"type:bigint;" form:"shopId" json:"shopId"`

	/** 产品id */
	ProductId uint64 `gorm:"type:bigint;" form:"productId" json:"productId"`

	/** 下单时的产品价格*/
	Price uint64 `gorm:"type:bigint(20)" json:"price"`

	/**积分*/
	Score uint64 `gorm:"type:bigint(20)" json:"score"`

	/** 购买个数*/
	Number uint64 `gorm:"type:bigint(20)" json:"number"`

	/** 商品的价格*/
	Money uint64 `gorm:"type:bigint(20)" json:"money" form:"money"`

	/**0:待支付,1:已支付,待回调确认,2:支付成功,已回调确认,3:线下商品商户已经核销, 4:已经发货,5:已收货,6:纠纷中,7:已完成*/
	Status int8 `gorm:"type:tinyint(3);" json:"status"`

	SkuId uint64 `gorm:"type:bigint;" json:"skuId"`

	Type uint8 `gorm:"type:tinyint(3);" json:"type"`

	Shop *Shop `gorm:"ForeignKey:ShopId;" json:"shop"`

	Product *Product `gorm:"ForeignKey:ProductId;" json:"product"`

	CrudTime
}

产品分类结构体

func (*OrderProduct) BeforeCreate

func (orderProduct *OrderProduct) BeforeCreate(db *gorm.DB) error

插入前生成主键

type OrderReturn

type OrderReturn struct {
	Order
	IsNeedLogistics bool        `json:"isNeedLogistics"`
	CouponList      interface{} `json:"couponList"`
}

type PageObject

type PageObject struct {
	Page     int    `json:"page" form:"page"`
	PageSize int    `json:"pageSize" form:"pageSize"`
	Month    string `json:"month" form:"month"`
	Status   int8   `json:"status" form:"status"`
}

type Pay

type Pay struct {
	Score      uint64   `form:"score" json:"score"`
	ProductIds []string `form:"productIds" json:"productIds"`
	OrderId    uint64   `form:"orderId" json:"orderId"`
	CouponList []string `form:"couponList" json:"couponList"`
}

type Product

type Product struct {
	Model

	/** 店铺id */
	ShopId uint64 `gorm:"type:bigint;" binding:"required" json:"shopId" form:"shopId"`

	/** product title */
	Title string `gorm:"type:varchar(255);" form:"title" json:"title"`

	/** 因为可以设置不同的sku不同的价格,所以有产品最高价格,这个价格只做展示用,以sku表里的价格为准,数据库存的是分*/
	Price uint64 `gorm:"type:bigint;" form:"price" json:"price"`

	/** 因为可以设置不同的sku不同的价格,所以有产品的最低价格,这个价格只做展示用,以sku表里的价格为准,数据库存的是分*/
	MinPrice uint64 `gorm:"type:int;" form:"minPrice" json:"minPrice"`

	/** 产品团购价格,数据库存的是分*/
	GroupPrice uint64 `gorm:"type:int;" form:"groupPrice" json:"groupPrice"` //TODO 以后要改,放到sku表里去

	/** 产品原始价格,这个价格只做展示用,以sku表里的价格为准,数据库存的是分 */
	OriginalPrice uint64 `gorm:"type:int;" form:"originalPrice" json:"originalPrice"`

	/**商品类型 1-实物商品要核销, 2-虚拟商品要核销,3-虚拟商品不用核销,4-实物商品要邮寄 5-实物商品不要邮寄 */
	Type uint8 `gorm:"type:tinyint(3);" form:"type" json:"type"`

	/** 商品的价格类型 1-普通价格商品,2-秒杀商品,3-砍价商品,4-拼团商品*/
	PriceType uint8 `gorm:"type:tinyint(3);" form:"priceType" json:"priceType"`

	/** 商品折扣(平台和商家洽谈的折扣)*/
	Discount float64 `gorm:"type:varchar(6);" form:"discount" json:"discount"`

	/** 推广者的上级提成,从推广者身上扣钱(配置一级分成比例在const里面)*/
	DiscountLevel float64 `gorm:"type:int;" form:"discountLevel" json:"discountLevel"`

	/** 平台自己的收益,比如产品100元,DiscountPlatform为10,则平台可以得10元*/
	DiscountPlatform float64 `gorm:"type:bigint;" form:"discountPlatform" json:"discountPlatform"`

	/** 购买者返现*/
	DiscountUser float64 `gorm:"type:int;" form:"discountUser" json:"discountUser"`

	/** 商户代平台核销的分成 */
	DiscountMerchant float64 `gorm:"type:int;default:0" form:"discountMerchant" json:"discountMerchant"`

	/** 产品主图 */
	ImageUrl string `gorm:"type:varchar(255);" form:"imageUrl" binding:"required" json:"imageUrl"`

	/** 商品描述 */
	Description string `gorm:"type:varchar(255);" form:"description" json:"description"`

	/** 购买须知 */
	Describe string `gorm:"type:varchar(5000);" form:"describe" json:"describe"`

	/** 商品图文详情 */
	DetailDescribe string `gorm:"type:varchar(5000);" form:"detailDescribe" json:"detailDescribe"`

	SoldNumber uint32 `gorm:"type:bigint" form:"soldNumber" json:"soldNumber"`

	/** 运费模板 */
	LogisticsTemplateId string `gorm:"type:varchar(36)" json:"logisticsTemplateId"`

	CrudTime
}

func (*Product) BeforeCreate

func (product *Product) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*Product) Validator

func (product *Product) Validator() error

校验表单中提交的参数是否合法

type ProductAllDetail

type ProductAllDetail struct {
	Product *Product                   `json:"product"`
	Option  map[uint8][]*ProductOption `json:"optionList"`
	Sku     []*Sku                     `json:"skuList"`
	Image   []string                   `json:"imageList"`
}

这个是包括option和sku的

type ProductDetail

type ProductDetail struct {
	ProductId        uint64            `gorm:"type:bigint(20);column:product_id;not null;" json:"productId"`
	Title            string            `gorm:"type:varchar(255);" json:"title"`
	OriginalPrice    string            `gorm:"type:varchar(255);" json:"price"`
	ImageUrl         string            `gorm:"type:varchar(500);" json:"imageUrl"`
	ProductOptionIds map[string]string `json:"productOptionIds"`
	ShopId           uint64            `gorm:"type:bigint(20)" json:"shopId"`
}

func (ProductDetail) TableName

func (ProductDetail) TableName() string

type ProductOption

type ProductOption struct {
	/** 主键id*/
	Model

	/** 产品id */
	ProductId uint64 `gorm:"type:bigint;not null;" form:"productId" json:"productId"`

	/** optionId 与option表关联,一个产品对应多个option,比如:红色,黄色,大码,小码*/
	OptionId uint64 `gorm:"type:bigint;" form:"optionId" json:"optionId"`

	/** option中的类别 1:颜色,2:尺寸 3:其他,这个是冗余存的,不想连表查了*/
	Type uint8 `gorm:"type:tinyint" form:"type" json:"type"`

	/** option 自定义描述 */
	Desc string `gorm:"type:varchar(36);" form:"desc" json:"desc"`

	/** 自定义option的图片地址*/
	ImageUrl string `gorm:"type:varchar(255);" form:"imageUrl" json:"imageUrl"`

	/** 排序 */
	Order uint `gorm:"type:int;" form:"order" json:"order"`

	/** 添加者的userId,为了好追踪 */
	UserID uint64 `gorm:"type:bigint;" form:"userId" json:"userId"`

	Option *Option `gorm:"foreignKey:OptionId;" json:"option"`

	CrudTime
}

产品分类结构体

func (*ProductOption) BeforeCreate

func (productOption *ProductOption) BeforeCreate(db *gorm.DB) error

插入前生成主键

type ProductOrder

type ProductOrder struct {
	ProductId      uint64 `json:"productId" form:"productId"`
	Number         uint64 `json:"number" form:"number"` //为了更方便计算用了个大的,本来应该用不到uint64
	LogisticsType  string `json:"logisticsType" form:"logisticsType"`
	InviterId      uint64 `json:"inviterId" form:"inviterId"`
	ShoppingCartId uint64 `json:"shoppingCartId"`
}

type ProductPriceObj

type ProductPriceObj struct {
	Product *Product `json:"product"`
	Sku     *Sku     `json:"sku"`
}

type Province

type Province struct {
	Model

	/**  */
	Code uint64 `gorm:"type:bigint;" form:"code" json:"code"`

	/** 名称 */
	Name string `gorm:"type:varchar(36);" form:"name" json:"name"`
}

省份结构体

func (*Province) BeforeCreate

func (province *Province) BeforeCreate(db *gorm.DB) error

插入前生成主键

type Role

type Role struct {
	/** 主键id */
	Model

	/** 角色名称 */
	RoleName string `gorm:"type:varchar(32);unique;not null" form:"role_name" binding:"required"`

	/** 角色类别标识 */
	RoleKey string `gorm:"type:varchar(16);not null" form:"role_key" binding:"required"`

	/** 角色描述 */
	Description string `gorm:"type:varchar(128)" form:"description"`

	/** 角色关联的功能 */
	Functions []*Function `gorm:"many2many:role_functions;" json:"-"`

	/** 增删改的时间 */
	CrudTime
}

角色结构体

func (*Role) BeforeCreate

func (role *Role) BeforeCreate(db *gorm.DB) error

插入前生成主键

type Shop

type Shop struct {
	Model

	/** shop title */
	Title string `gorm:"type:varchar(255);" form:"title" binding:"required" json:"title"`

	/** 商户id merchant表的merchant_id */
	MerchantId uint64 `gorm:"type:bigint(20);column:merchant_id;" form:"merchantId" binding:"required" json:"merchantId"`

	/** 店铺唯一标识 */
	Code string `gorm:"type:varchar(20);" form:"code" json:"-"`

	/** 评分*/
	Star int8 `gorm:"type:int(10);" form:"star" json:"star"`

	/** 营业时间*/
	BusinessTime string `gorm:"type:varchar(100);" form:"businessTime" json:"businessTime"`

	/** 关注人数*/
	AttentionNum uint64 `gorm:"type:bigint(20);column:attention_num;" form:"attentionNum" json:"attentionNum"`

	/** 店铺电话 */
	Phone string `gorm:"type:varchar(20);" form:"phone" binding:"required" json:"phone"`

	/** shop address */
	Address string `gorm:"type:varchar(255);" form:"address" json:"address"`

	/** 店铺地址描述 */
	AddressDescription string `gorm:"type:varchar(255);" form:"addressDescription" json:"addressDescription"`

	/** 店铺描述 */
	Description string `gorm:"type:varchar(1000);" form:"description" json:"description"`

	/** 店铺图文详情 */
	DetailDescribe string `gorm:"type:varchar(5000);" form:"detailDescribe" json:"detail_describe"`

	Logo string `gorm:"type:varchar(500);" form:"logo" json:"logo"`

	/** shop url */
	ImageUrl string `gorm:"type:varchar(2000);" form:"image_url" json:"image_url"`

	/** shop 的描述 */
	Content string `gorm:"type:varchar(255)" form:"content" json:"content"`

	StringDuration

	Longitude float64 `gorm:"type:decimal" form:"longitude" json:"longitude"`
	Latitude  float64 `gorm:"type:decimal" form:"latitude" json:"latitude"`

	ProductList []*Product `gorm:"ForeignKey:ShopId;association_foreignkey:ShopId" json:"product_list"`

	Coordinates GeoPoint

	/** 0:店铺未开通,1:店铺可用,2:冻结,3:永久封店,4:其他*/
	Status uint8 `gorm:"type:tinyint(1);default:1" form:"status" json:"status"`

	/**店铺类型 1:平台官方店,2:商户代平台核销的店, 3:商户官方店,4:商户直营店,5:其他品牌店*/
	Type uint8 `gorm:"type:tinyint(1);default:3" form:"type" json:"type"`

	/** 越大越往前排*/
	OrderWeight uint64 `gorm:"type:bigint;default:1" form:"order_weight" json:"order_weight"`

	CrudTime
}

func (*Shop) BeforeCreate

func (shop *Shop) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*Shop) Validator

func (shop *Shop) Validator() error

校验表单中提交的参数是否合法

type ShopDetail

type ShopDetail struct {
	/** shop id */
	ShopId uint64 `gorm:"type:bigint(20);" json:"shopId"`
	Title  string `gorm:"type:varchar(255);" json:"title"`
}

func (ShopDetail) TableName

func (ShopDetail) TableName() string

type ShopDetailDistance

type ShopDetailDistance struct {
	ShopDetail
	Longitude float64 `gorm:"column:longitude;" form:"longitude" json:"longitude"`
	Latitude  float64 `gorm:"column:latitude;" form:"latitude" json:"latitude"`
	Distance  float64 `gorm:"column:distance;" json:"distance"`
}

type ShoppingCart

type ShoppingCart struct {
	BaseShoppingCart

	OptionList []*ProductOption `gorm:"foreignKey:ProductId;references:ProductId" json:"optionList"`

	CrudTime
}

func (*ShoppingCart) BeforeCreate

func (sCart *ShoppingCart) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*ShoppingCart) Validator

func (sCart *ShoppingCart) Validator() error

校验表单中提交的参数是否合法

type ShoppingCartInfo

type ShoppingCartInfo struct {
	BaseShoppingCart
	OptionList map[uint8][]*ProductOption `json:"optionList"`
}

type ShoppingCartPost

type ShoppingCartPost struct {
	ProductId        string   `json:"productId"`
	Number           uint64   `json:"number"`
	ProductOptionIds []string `json:"productOptionIds"`
}

type Sku

type Sku struct {
	Model

	/** 产品id */
	ProductId uint64 `gorm:"type:bigint;not null;" form:"productId" json:"productId"`

	/** option 自定义描述 */
	Desc string `gorm:"type:varchar(36);" form:"desc" json:"desc"`

	Stock uint64 `gorm:"type:bigint" form:"stock" json:"stock"`

	/** 一个sku对应的产品价格*/
	Price uint64 `gorm:"type:bigint" form:"price" json:"price"`

	/** 以option的primary id 按从小到在的方式组合,加上productId一起变成一个唯一值,用来给C端用户查价格和库存*/
	CombineId string `gorm:"type:varchar(255)" form:"combineId" json:"combineId"`

	/** 排序 */
	Order uint `gorm:"type:int;" form:"order" json:"order"`

	/** 添加者的userId,为了好追踪 */
	UserID uint64 `gorm:"type:bigint;" form:"userId" json:"userId"`

	//OptionList []*ProductOption `gorm:"ForeignKey:ProductId;AssociationForeignKey:ProductId" json:"OptionList"`
	CrudTime
}

产品分类结构体

func (*Sku) BeforeCreate

func (sku *Sku) BeforeCreate(db *gorm.DB) error

插入前生成主键

type StringDuration

type StringDuration struct {
	/** 开始时间 */
	BeginAt string `gorm:"type:varchar(20);default:NULL" json:"beginAt"`

	/** 结束时间 */
	EndAt string `gorm:"type:varchar(20);default:NULL" json:"endAt"`
}

type TotalResult

type TotalResult struct {
	TotalMoney uint64 `json:"total_money"`
}

type User

type User struct {
	/** 主键 */
	Model

	/** 姓名 */
	Username string `gorm:"type:varchar(32);unique" json:"username" form:"username" binding:"required"`

	Nickname string `gorm:"type:varchar(32);" json:"nickname" form:"nickname"`

	/** 密码  */
	Password string `gorm:"type:varchar(64)" json:"-" form:"password" binding:"required"`

	/** 电话 */
	Phone string `gorm:"type:varchar(11);unique" json:"phone" form:"phone" binding:"required"`

	/** 头像 */
	Avatar string `gorm:"type:varchar(500)" json:"avatar" form:"avatar"`

	/** 邮件 */
	Email string `gorm:"type:varchar(64);unique" json:"email" form:"email"`

	/** 商户号 */
	MerchantNo string `gorm:"type:varchar(32)" json:"merchant_no" form:"merchant_no"`

	/** 标志 1 表示这个账号是由管理方为商户添加的账号 */
	Flag int `json:"-"`

	/** 登陆次数 */
	LogonCount int `json:"-"`

	/** 状态  0 正常  */
	Status int `json:"status"`

	/** 最后一次登陆时间 */
	LoginTime time.Time `gorm:"default:null" json:"loginTime"`

	/** 增删改的时间 */
	CrudTime

	/** 用户类型,1:管理员,2:平台员工,3:商户,4:普通用户*/
	Type uint8 `gorm:"tinyint(3);column:type;default:2" json:"type"`

	/** 外键 */
	RoleId *string `gorm:"type:varchar(36)" form:"role_id"`

	/** 微信app支付的openid **/
	OpenId string `gorm:"type:varchar(64);column:openid;unique" form:"openid" json:"openid" weChat:"openid"`

	/** 微信商户号的openid **/
	MPOpenId string `gorm:"type:varchar(64);column:mp_openid;unique" json:"mp_openid" weChat:"openid"`

	/** 微信的unionid **/
	UnionId string `gorm:"type:varchar(64);column:unionid;" form:"unionid" json:"unionid" weChat:"unionid"`

	/** 微信的 access token **/
	AccessToken string `gorm:"type:varchar(128)" json:"-" weChat:"access_token"`

	/** 微信的 refresh token **/
	RefreshToken string `gorm:"type:varchar(128)" json:"-" weChat:"refresh_token"`

	/** 上一级用户id **/
	MultiLevel uint64 `gorm:"type:bigint" json:"multi_level"`

	/** 积分 **/
	Score int64 `gorm:"type:bigint(20)" json:"score"`
}

func (*User) BeforeCreate

func (user *User) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*User) Validator

func (user *User) Validator() error

校验表单中提交的参数是否合法

type UserOrderDetail

type UserOrderDetail struct {
	Model
	OrderId    uint64 `gorm:"type:bigint;column:order_id;not null;" json:"order_id"`
	MerchantId uint64 `gorm:"type:bigint;column:merchant_id;not null;" json:"merchant_id"`
	Number     uint64 `gorm:"type:int(10)" json:"number"`
	Money      uint64 `gorm:"type:bigint(20)" json:"money"`
	ShopId     uint64 `gorm:"type:bigint;column:shop_id" json:"shop_id"`
	/**1: */
	Status   uint8  `gorm:"type:tinyint(3);" json:"status"`
	Platform string `gorm:"type:varchar(10)" json:"platform"`

	/** 购买者userId,或者推荐者的userId*/
	UserID uint64 `gorm:"type:bigint;column:user_id;" form:"user_id" json:"user_id" weChat:"user_id"`

	/** 核销店员的userId,或者下线的userId*/
	CheckUserID uint64 `gorm:"type:bigint;column:check_user_id;" form:"check_user_id" json:"check_user_id"`

	ProductId uint64 `gorm:"type:bigint;column:product_id;" json:"product_id"`
	Describe  string `gorm:"type:varchar(255)" json:"describe"`

	/** 1:用户核销(贷入)2:和平台结算(贷出) */
	Type uint8 `gorm:"type:tinyint(1)" json:"type"`

	/** 1:实物,2:代金券 3.下线消费提成 对应order的type*/
	GoodsType uint8 `gorm:"type:tinyint(1)" json:"goods_type"`

	Shop    *Shop    `gorm:"ForeignKey:ShopId;association_foreignkey:ShopId" json:"shop"`
	Product *Product `gorm:"ForeignKey:ProductId;association_foreignkey:ProductId" json:"product"`

	CrudTime
}

func (*UserOrderDetail) BeforeCreate

func (order *UserOrderDetail) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*UserOrderDetail) Validator

func (order *UserOrderDetail) Validator() error

校验表单中提交的参数是否合法

type UserOrderListsResponse

type UserOrderListsResponse struct {
	helper.JsonObject
	Data []UserOrderDetail
}

type UserShop

type UserShop struct {
	Model
	//UserShopId string `gorm:"type:varchar(36);column:user_shop_id;not null;" json:"user_shop_id"`
	UserID uint64 `gorm:"type:bigint;column:user_id;" form:"user_id" json:"user_id" weChat:"user_id"`
	ShopId uint64 `gorm:"type:bigint;column:shop_id;not null;" json:"shop_id"`
	CrudTime
}

这个用于添加商户和官方店的关联,商户的分销从这个表来找,然后分走指定的提成

func (*UserShop) BeforeCreate

func (userShop *UserShop) BeforeCreate(db *gorm.DB) error

插入前生成主键

func (*UserShop) Validator

func (userShop *UserShop) Validator() error

校验表单中提交的参数是否合法

type UserShopListsResponse

type UserShopListsResponse struct {
	helper.JsonObject
	Data []UserShop
}

type Wallet

type Wallet struct {
	Model

	/** 用户id */
	UserID uint64 `gorm:"type:bigint;" form:"userId" json:"userId"`

	/** 用户积分 */
	Score uint64 `gorm:"type:bigint;" form:"score" json:"score"`

	/** 用户总金额*/
	Money uint64 `gorm:"type:bigint;" form:"money" json:"money"`

	/** 用户余额,总额度-冻结金额 */
	Balance uint64 `gorm:"type:bigint;" form:"balance" json:"balance"`

	/** 用户冻结金额*/
	Freeze uint64 `gorm:"type:bigint;" form:"freeze" json:"freeze"`

	/** 用户成长值*/
	Growth uint64 `gorm:"type:bigint;" form:"money" json:"growth"`

	ExpiredTime
	CrudTime
}

功能菜单结构体

func (*Wallet) BeforeCreate

func (wallet *Wallet) BeforeCreate(db *gorm.DB) error

插入前生成主键

type WechatUserInfo

type WechatUserInfo struct {
	AccessToken  string `json:"access_token" weChat:"access_token"`
	OpenId       string `json:"openid" weChat:"openid"`
	HeadImageURL string `json:"head_image_url,omitempty" weChat:"HeadImageURL"`
	Nickname     string `json:"nickname" weChat:"nickname"`
	UserType     uint8  `json:"user_type"`
	UserID       string `json:"user_id"`
}

Jump to

Keyboard shortcuts

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