daShangDao_psiServer/models/employee_settings.go
2026-06-15 13:47:39 +08:00

88 lines
5.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package models
// EmployeeSettings 员工设置表
type EmployeeSettings struct {
ID int64 `json:"id" gorm:"primarykey;comment:自增ID"`
EmpID int64 `json:"emp_id" gorm:"not null;default:0;uniqueIndex;comment:员工ID(关联employees.id)"`
Settings string `json:"settings" gorm:"type:text;not null;comment:员工配置(JSON格式)"`
CreatedAt int64 `json:"created_at" gorm:"not null;default:0;comment:创建时间"`
UpdatedAt int64 `json:"updated_at" gorm:"not null;default:0;comment:更新时间"`
IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"`
}
func (EmployeeSettings) TableName() string {
return "employees_settings"
}
func (EmployeeSettings) TableOptions() string {
return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='员工设置表'"
}
// EmployeeSettingsConfig 员工配置结构体JSON格式
type EmployeeSettingsConfig struct {
// 筛选配置
ShowPrice int8 `form:"show_price" json:"show_price"` // 比价结果开关
ShowCategory int8 `form:"show_category" json:"show_category"` // 市场竞争开关
ShowCache int8 `form:"show_cache" json:"show_cache"` // 缓存开启
CompareCount int8 `form:"compare_count" json:"compare_count"` // 比较条数
CompareCountEditable int8 `form:"compare_count_editable" json:"compare_count_editable"` // 比较条数是否可编辑
PriceCompare string `form:"price_compare" json:"price_compare"` // 价格比较符号
PriceValue float64 `form:"price_value" json:"price_value"` // 价格数值
PriceEditable int8 `form:"price_editable" json:"price_editable"` // 比较条数是否可编辑
SellCountCompare string `form:"sell_count_compare" json:"sell_count_compare"` // 在售数量比较符号
SellCountValue float64 `form:"sell_count_value" json:"sell_count_value"` // 在售数量数值
SellCountEditable int8 `form:"sell_count_editable" json:"sell_count_editable"` // 在售数量是否可编辑
BuyCountCompare string `form:"buy_count_compare" json:"buy_count_compare"` // 已售数量比较符号
BuyCountValue float64 `form:"buy_count_value" json:"buy_count_value"` // 已售数量数值
BuyCountEditable int8 `form:"buy_count_editable" json:"buy_count_editable"` // 已售数量是否可编辑
Condition string `form:"condition" json:"condition"` // 品相
ConditionEditable int8 `form:"condition_editable" json:"condition_editable"` // 品相是否可编辑
// 精品书配置
JingpinEnabled int8 `form:"jingpin_enabled" json:"jingpin_enabled"` // 开启精品书开关
JingpinPriceCompare string `form:"jingpin_price_compare" json:"jingpin_price_compare"` // 精品书价格比较符号
JingpinPriceValue float64 `form:"jingpin_price_value" json:"jingpin_price_value"` // 精品书价格数值
JingpinPriceEditable int8 `form:"jingpin_price_editable" json:"jingpin_price_editable"` // 精品书价格是否可编辑
JingpinSellCountCompare string `form:"jingpin_sell_count_compare" json:"jingpin_sell_count_compare"` // 精品书在售数量比较符号
JingpinSellCountValue float64 `form:"jingpin_sell_count_value" json:"jingpin_sell_count_value"` // 精品书在售数量数值
JingpinSellCountEditable int8 `form:"jingpin_sell_count_editable" json:"jingpin_sell_count_editable"` // 精品书在售数量是否可编辑
JingpinBuyCountCompare string `form:"jingpin_buy_count_compare" json:"jingpin_buy_count_compare"` // 精品书已售数量比较符号
JingpinBuyCountValue float64 `form:"jingpin_buy_count_value" json:"jingpin_buy_count_value"` // 精品书已售数量数值
JingpinBuyCountEditable int8 `form:"jingpin_buy_count_editable" json:"jingpin_buy_count_editable"` // 精品书已售数量是否可编辑
}
// GetDefaultEmployeeSettingsConfig 获取默认用户配置
func GetDefaultEmployeeSettingsConfig() EmployeeSettingsConfig {
return EmployeeSettingsConfig{
// 筛选配置
ShowPrice: 0, // 比价结果开启
ShowCategory: 0, // 市场竞争开启
ShowCache: 1, // 缓存开启
CompareCount: 1, // 比较条数
CompareCountEditable: 0, // 比较条数是否可编辑
PriceCompare: ">=", // 价格比较符
PriceValue: 4, // 价格阈值
PriceEditable: 0, // 价格是否可编辑
SellCountCompare: ">=", // 在售数量比较符
SellCountValue: 10, // 在售数量阈值
SellCountEditable: 0, // 在售数量是否可编辑
BuyCountCompare: ">=", // 已售数量比较符
BuyCountValue: 10, // 已售数量阈值
BuyCountEditable: 0, // 已售数量是否可编辑
Condition: "85~", // 品相等级
ConditionEditable: 0,
// 精品书配置
JingpinEnabled: 0, // 开启精品书
JingpinPriceCompare: ">=", // 精品书价格比较符
JingpinPriceValue: 10, // 精品书价格阈值
JingpinPriceEditable: 0, // 精品书价格是否可编辑
JingpinSellCountCompare: ">=", // 精品书在售数量比较符
JingpinSellCountValue: 10, // 精品书在售数量阈值
JingpinSellCountEditable: 0, // 精品书在售数量是否可编辑
JingpinBuyCountCompare: ">=", // 精品书已售数量比较符
JingpinBuyCountValue: 10, // 精品书已售数量阈值
JingpinBuyCountEditable: 0, // 精品书已售数量是否可编辑
}
}