feat 添加calculate-process
This commit is contained in:
parent
4bef487066
commit
033c875d5e
@ -16,6 +16,7 @@ type providerApi struct {
|
||||
// ProviderArticleApi 管理供应商商品的接口
|
||||
type ProviderArticleApi interface {
|
||||
Get(query GetProviderArticleQuery) (article v2.ProviderArticle, err error)
|
||||
Upsert(article v2.ProviderArticle) error
|
||||
}
|
||||
|
||||
type providerArticleApi struct {
|
||||
|
@ -16,6 +16,7 @@ type sellerApi struct {
|
||||
// SellerArticleApi 管理供应商商品的接口
|
||||
type SellerArticleApi interface {
|
||||
Get(query GetProviderArticleQuery) (article v2.ProviderArticle, err error)
|
||||
Upsert(article v2.SellerArticle) error
|
||||
}
|
||||
|
||||
type sellerArticleApi struct {
|
||||
|
24
structs/v2/calculate-process.go
Normal file
24
structs/v2/calculate-process.go
Normal file
@ -0,0 +1,24 @@
|
||||
package v2
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type CalculateProcess struct {
|
||||
ID uint `gorm:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
//所有人ID
|
||||
OwnerID uint `gorm:"index" json:"ownerID"`
|
||||
// 所有者类型,是provider还是providerArticle还是Seller还是sellerArticle
|
||||
Kind string `gorm:"index" json:"kind"`
|
||||
// 条件
|
||||
Condition string `json:"condition"`
|
||||
// 计算过程
|
||||
Process string `json:"process"`
|
||||
// 名称
|
||||
Name string `json:"name"`
|
||||
}
|
@ -1,14 +1,33 @@
|
||||
package v2
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ProviderId string
|
||||
|
||||
const (
|
||||
ProviderId_CoachOutlet_US ProviderId = "coachOutlet_us"
|
||||
ProviderId_CoachOutlet_CN ProviderId = "coachOutlet_cn"
|
||||
ProviderId_Coach_CN ProviderId = "coach_cn"
|
||||
)
|
||||
type Provider struct {
|
||||
ID uint `gorm:"primary_key" json:"-"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
|
||||
ProviderId ProviderId `gorm:"unique" json:"providerId"`
|
||||
// 供应商的名称
|
||||
Name string `json:"name"`
|
||||
// 供应商配置
|
||||
Config ProviderOption `gorm:"type:json;serializer:json" json:"config"`
|
||||
//计算过程
|
||||
CalculateProcess []CalculateProcess `json:"calculateProcess" gorm:"polymorphicType:Kind;polymorphicId:OwnerID;polymorphicValue:provider"`
|
||||
}
|
||||
|
||||
type ProviderOption struct {
|
||||
Interval time.Duration `yaml:"interval" json:"interval"` //抓取间隔
|
||||
ExchangeRate float64 `yaml:"exchangeRate" json:"exchangeRate"` //汇率
|
||||
Freight float64 `yaml:"freight" json:"freight"` //运费
|
||||
}
|
||||
|
||||
// ProviderArticle 供应商商品信息
|
||||
type ProviderArticle struct {
|
||||
@ -31,6 +50,8 @@ type ProviderArticle struct {
|
||||
Cost ProviderPrice `json:"cost" gorm:"type:json;serializer:json"`
|
||||
// 历史成本价格
|
||||
HistoryPrice []ProviderPrice `json:"historyPrice"`
|
||||
// 计算过程
|
||||
CalculateProcess []CalculateProcess `json:"calculateProcess" gorm:"polymorphicType:Kind;polymorphicId:OwnerID;polymorphicValue:providerArticle"`
|
||||
}
|
||||
|
||||
// ProviderPrice 供应商成本价格
|
||||
|
@ -1,12 +1,32 @@
|
||||
package v2
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type SellerId string
|
||||
|
||||
const (
|
||||
SellerId_DW SellerId = "dewu"
|
||||
)
|
||||
// Seller 出货商
|
||||
type Seller struct {
|
||||
ID uint `gorm:"primary_key" json:"-"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
|
||||
SellerId SellerId `gorm:"unique" json:"sellerId"`
|
||||
// 出货商的名称
|
||||
Name string `json:"name"`
|
||||
// 出货商配置
|
||||
Config SellerOption `gorm:"type:json;serializer:json" json:"config"`
|
||||
//计算过程
|
||||
CalculateProcess []CalculateProcess `json:"calculateProcess" gorm:"polymorphicType:Kind;polymorphicId:OwnerID;polymorphicValue:seller"`
|
||||
}
|
||||
|
||||
type SellerOption struct {
|
||||
Interval time.Duration `yaml:"interval" json:"interval"` //抓取间隔
|
||||
}
|
||||
|
||||
// SellerArticle 销售商商品信息
|
||||
type SellerArticle struct {
|
||||
@ -28,6 +48,8 @@ type SellerArticle struct {
|
||||
Sell SellerPrice `json:"sell" gorm:"type:json;serializer:json"`
|
||||
// 历史出售价格
|
||||
HistoryPrice []SellerPrice `json:"historyPrice"`
|
||||
// 计算过程
|
||||
CalculateProcess []CalculateProcess `json:"calculateProcess" gorm:"polymorphicType:Kind;polymorphicId:OwnerID;polymorphicValue:sellerArticle"`
|
||||
}
|
||||
|
||||
// SellerPrice 供应商成本价格
|
||||
|
Loading…
Reference in New Issue
Block a user