209 lines
9.3 KiB
Go
209 lines
9.3 KiB
Go
package dao
|
|
|
|
import "time"
|
|
|
|
// 产品类型
|
|
const (
|
|
ProductTypeNormal = 1 // 普通产品
|
|
ProductFirstTry = 2 // 首次试用
|
|
ProductTry = 3 // 再次试用
|
|
ProductFirstTryName = "首次试用"
|
|
ProductTryName = "多次试用"
|
|
)
|
|
|
|
// 销售模式
|
|
const (
|
|
ProductSalesModelOffline = 1 // 线下
|
|
ProductSalesModelOnline = 2 // 线上
|
|
)
|
|
|
|
// 产品状态 / 审核状态(与老库约定一致)
|
|
const (
|
|
ProductStatusNormal uint8 = 1 // 正常
|
|
ProductStatusDisabled uint8 = 2 // 禁用
|
|
ProductStatusUnpublished uint8 = 3 // 未发布
|
|
|
|
VerifyStatusPass uint8 = 1 // 通过
|
|
VerifyStatusRefuse uint8 = 2 // 驳回
|
|
VerifyStatusChecking uint8 = 3 // 审核中
|
|
VerifyStatusSecond uint8 = 4 // 二审中
|
|
)
|
|
|
|
type Product struct {
|
|
Id int `gorm:"column:id;primaryKey;autoIncrement"`
|
|
Name string `gorm:"column:name;type:varchar(256);not null"`
|
|
Subhead string `gorm:"column:subhead;type:varchar(255)"`
|
|
SalesModel uint8 `gorm:"column:sales_model;type:tinyint(1);default:1"`
|
|
Content string `gorm:"column:content;type:text;not null"`
|
|
ModelCode string `gorm:"column:model_code;type:varchar(255)"`
|
|
Price float32 `gorm:"column:price;type:decimal(10,2);not null"`
|
|
StorePrice float32 `gorm:"column:store_price;type:decimal(10,2)"`
|
|
SalePrice float32 `gorm:"column:sale_price;type:decimal(10,2)"`
|
|
SharePrice float32 `gorm:"column:share_price;type:decimal(10,2)"`
|
|
Waybill string `gorm:"column:waybill;type:varchar(255)"`
|
|
AgentPrice float32 `gorm:"column:agent_price;type:decimal(10,2)"`
|
|
SaleReward string `gorm:"column:sale_reward;type:varchar(255)"`
|
|
Images string `gorm:"column:images;type:varchar(512);not null"`
|
|
Weight float32 `gorm:"column:weight;type:double"`
|
|
Cubage string `gorm:"column:cubage;type:varchar(255)"`
|
|
IsIndex uint8 `gorm:"column:is_index;type:tinyint(4);default:2"`
|
|
IndexImage string `gorm:"column:index_image;type:varchar(255)"`
|
|
Label string `gorm:"column:label;type:varchar(255)"`
|
|
PeriodValidity int16 `gorm:"column:period_validity;type:smallint(4)"`
|
|
PublishTime time.Time `gorm:"column:publish_time;type:datetime"`
|
|
Sort uint16 `gorm:"column:sort;type:smallint(6) unsigned"`
|
|
IsBuy uint8 `gorm:"column:is_buy;type:tinyint(1);default:2"`
|
|
Type uint8 `gorm:"column:type;type:tinyint(1);default:1;not null"`
|
|
NormsNumber uint8 `gorm:"column:norms_number;type:smallint(4);default:1;not null"`
|
|
BoxNumber float64 `gorm:"column:box_number;type:smallint(6) unsigned;default:0"`
|
|
Number uint `gorm:"column:number;type:int(10) unsigned;default:0;not null"`
|
|
TryNumber uint8 `gorm:"column:try_number;type:tinyint(2);default:1"`
|
|
Status uint8 `gorm:"column:status;type:tinyint(1);default:3;not null"`
|
|
VerifyStatus uint8 `gorm:"column:verify_status;type:tinyint(1);default:3"`
|
|
VerifyId int `gorm:"column:verify_id;type:int(11)"`
|
|
VerifyName string `gorm:"column:verify_name;type:varchar(50)"`
|
|
VerifySecondId int `gorm:"column:verify_second_id;type:int(11)"`
|
|
VerifySecondName string `gorm:"column:verify_second_name;type:varchar(255)"`
|
|
Reason string `gorm:"column:reason;type:varchar(255)"`
|
|
AdminName string `gorm:"column:admin_name;type:varchar(50);not null"`
|
|
AdminId int `gorm:"column:admin_id;type:int(11);not null"`
|
|
}
|
|
|
|
type ProductCreate struct {
|
|
Id int `gorm:"column:id;primaryKey;autoIncrement"`
|
|
Name string `gorm:"column:name"`
|
|
Subhead string `gorm:"column:subhead"`
|
|
SalesModel uint8 `gorm:"column:sales_model"`
|
|
Content string `gorm:"column:content"`
|
|
ModelCode string `gorm:"column:model_code"`
|
|
Price float32 `gorm:"column:price"`
|
|
StorePrice float32 `gorm:"column:store_price"`
|
|
SalePrice float32 `gorm:"column:sale_price"`
|
|
SharePrice float32 `gorm:"column:share_price"`
|
|
Waybill string `gorm:"column:waybill"`
|
|
AgentPrice float32 `gorm:"column:agent_price"`
|
|
SaleReward string `gorm:"column:sale_reward"`
|
|
Images string `gorm:"column:images"`
|
|
Weight float32 `gorm:"column:weight"`
|
|
Cubage string `gorm:"column:cubage"`
|
|
IsIndex uint8 `gorm:"column:is_index"`
|
|
IndexImage string `gorm:"column:index_image"`
|
|
Label string `gorm:"column:label"`
|
|
PeriodValidity int16 `gorm:"column:period_validity"`
|
|
PublishTime time.Time `gorm:"column:publish_time"`
|
|
Sort uint16 `gorm:"column:sort"`
|
|
IsBuy uint8 `gorm:"column:is_buy"`
|
|
Type uint8 `gorm:"column:type"`
|
|
NormsNumber uint8 `gorm:"column:norms_number"`
|
|
BoxNumber float64 `gorm:"column:box_number"`
|
|
Number uint `gorm:"column:number"`
|
|
TryNumber uint8 `gorm:"column:try_number"`
|
|
AdminName string `gorm:"column:admin_name"`
|
|
AdminId int `gorm:"column:admin_id"`
|
|
}
|
|
|
|
type ProductCheckExist struct {
|
|
Id int `gorm:"column:id"`
|
|
Name string `gorm:"column:name"`
|
|
ModelCode string `gorm:"column:model_code"`
|
|
Status uint8 `gorm:"column:status"`
|
|
}
|
|
|
|
type ProductVerify struct {
|
|
Id int `json:"id"`
|
|
Name string `json:"name,omitempty"`
|
|
ModelCode string `json:"model_code"`
|
|
Price float32 `json:"price"`
|
|
StorePrice float32 `json:"store_price"`
|
|
SalePrice float32 `json:"sale_price"`
|
|
SharePrice float32 `json:"share_price"`
|
|
AgentPrice float32 `json:"agent_price"`
|
|
SaleReward string `json:"sale_reward"`
|
|
SalesModel uint8 `json:"sales_model,omitempty"`
|
|
Type uint8 `json:"type"`
|
|
NormsNumber uint8 `json:"norms_number"`
|
|
BoxNumber float64 `json:"box_number"`
|
|
AdminName string `json:"admin_name"`
|
|
AdminId int `json:"admin_id"`
|
|
IsIndex uint8 `json:"is_index,omitempty"`
|
|
IndexImage string `json:"index_image,omitempty"`
|
|
}
|
|
|
|
type ProductEditBase struct {
|
|
Id int `gorm:"column:id;primaryKey"`
|
|
Name string `gorm:"column:name"`
|
|
Subhead string `gorm:"column:subhead"`
|
|
Content string `gorm:"column:content"`
|
|
Images string `gorm:"column:images"`
|
|
Weight float32 `gorm:"column:weight"`
|
|
Cubage string `gorm:"column:cubage"`
|
|
Waybill string `gorm:"column:waybill"`
|
|
Label string `gorm:"column:label"`
|
|
IsIndex uint8 `gorm:"column:is_index"`
|
|
IndexImage string `gorm:"column:index_image"`
|
|
PeriodValidity int16 `gorm:"column:period_validity"`
|
|
IsBuy uint8 `gorm:"column:is_buy"`
|
|
PublishTime time.Time `gorm:"column:publish_time"`
|
|
AdminName string `gorm:"column:admin_name"`
|
|
AdminId int `gorm:"column:admin_id"`
|
|
}
|
|
|
|
// ProductInfo 列表/详情查询投影
|
|
type ProductInfo struct {
|
|
Id int `gorm:"column:id"`
|
|
Name string `gorm:"column:name"`
|
|
Subhead string `gorm:"column:subhead"`
|
|
Content string `gorm:"column:content"`
|
|
ModelCode string `gorm:"column:model_code"`
|
|
Price float32 `gorm:"column:price"`
|
|
StorePrice float32 `gorm:"column:store_price"`
|
|
SalePrice float32 `gorm:"column:sale_price"`
|
|
SharePrice float32 `gorm:"column:share_price"`
|
|
AgentPrice float32 `gorm:"column:agent_price"`
|
|
SaleReward string `gorm:"column:sale_reward"`
|
|
SalesModel uint8 `gorm:"column:sales_model"`
|
|
Waybill string `gorm:"column:waybill"`
|
|
Status uint8 `gorm:"column:status"`
|
|
Weight float32 `gorm:"column:weight"`
|
|
IsIndex uint8 `gorm:"column:is_index"`
|
|
IndexImage string `gorm:"column:index_image"`
|
|
Cubage string `gorm:"column:cubage"`
|
|
Label string `gorm:"column:label"`
|
|
Images string `gorm:"column:images"`
|
|
IsBuy uint8 `gorm:"column:is_buy"`
|
|
PeriodValidity int16 `gorm:"column:period_validity"`
|
|
PublishTime time.Time `gorm:"column:publish_time"`
|
|
Type uint8 `gorm:"column:type"`
|
|
NormsNumber uint8 `gorm:"column:norms_number"`
|
|
BoxNumber float64 `gorm:"column:box_number"`
|
|
Sort uint16 `gorm:"column:sort"`
|
|
Number uint `gorm:"column:number"`
|
|
VerifyStatus uint8 `gorm:"column:verify_status"`
|
|
VerifyId int `gorm:"column:verify_id"`
|
|
VerifyName string `gorm:"column:verify_name"`
|
|
VerifySecondId int `gorm:"column:verify_second_id"`
|
|
VerifySecondName string `gorm:"column:verify_second_name"`
|
|
Reason string `gorm:"column:reason"`
|
|
AdminName string `gorm:"column:admin_name"`
|
|
Edit uint8 `gorm:"-"`
|
|
}
|
|
|
|
type ProductNames struct {
|
|
Id int `gorm:"column:id"`
|
|
Name string `gorm:"column:name"`
|
|
}
|
|
|
|
type ProductStatusUpdate struct {
|
|
Status uint8 `gorm:"column:status"`
|
|
Reason string `gorm:"column:reason"`
|
|
AdminName string `gorm:"column:admin_name"`
|
|
AdminId int `gorm:"column:admin_id"`
|
|
}
|
|
|
|
type ProductSort struct {
|
|
Id int `gorm:"column:id"`
|
|
Sort uint16 `gorm:"column:sort"`
|
|
AdminName string `gorm:"column:admin_name"`
|
|
AdminId int `gorm:"column:admin_id"`
|
|
}
|