Compare commits
No commits in common. "2dfacfbe2cb2a4ee25e644839a6812c8836add74" and "4dda7ac1fab41ae8f489224c9a38fb8cdf75b8bc" have entirely different histories.
2dfacfbe2c
...
4dda7ac1fa
@ -17,12 +17,6 @@ type articleApi struct {
|
|||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewArticleApi(db *gorm.DB) ArticleApi {
|
|
||||||
return &articleApi{
|
|
||||||
db: db,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Upsert 插入或者更新商品
|
// Upsert 插入或者更新商品
|
||||||
func (a *articleApi) Upsert(article v2.Article) error {
|
func (a *articleApi) Upsert(article v2.Article) error {
|
||||||
return a.db.Clauses(clause.OnConflict{
|
return a.db.Clauses(clause.OnConflict{
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
package storage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
v2 "gitea.timerzz.com/kedaya_haitao/common/structs/v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
var providerArticle = v2.ProviderArticle{
|
|
||||||
ArticleID: 1,
|
|
||||||
Brand: v2.Brand_Coach,
|
|
||||||
Cost: v2.ProviderPrice{
|
|
||||||
CalMark: "111",
|
|
||||||
FinalPrice: 1,
|
|
||||||
OriginalPrice: 0,
|
|
||||||
ProviderArticleID: 0,
|
|
||||||
},
|
|
||||||
HistoryPrice: []v2.ProviderPrice{
|
|
||||||
{
|
|
||||||
CalMark: "222",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestProviderArticleApi_Upsert(t *testing.T) {
|
|
||||||
db, err := GetDevDB()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
storage := NewStorage(db)
|
|
||||||
storage.ProviderArticle().Upsert(providerArticle)
|
|
||||||
}
|
|
@ -12,9 +12,10 @@ type Storage struct {
|
|||||||
|
|
||||||
func NewStorage(db *gorm.DB) *Storage {
|
func NewStorage(db *gorm.DB) *Storage {
|
||||||
return &Storage{
|
return &Storage{
|
||||||
articleApi: NewArticleApi(db),
|
articleApi: &articleApi{
|
||||||
|
db: db,
|
||||||
|
},
|
||||||
providerApi: NewProviderApi(db),
|
providerApi: NewProviderApi(db),
|
||||||
providerArticleApi: NewProviderArticleApi(db),
|
|
||||||
sellerApi: NewSellerApi(db),
|
sellerApi: NewSellerApi(db),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ type Provider struct {
|
|||||||
//计算过程
|
//计算过程
|
||||||
CalculateProcess []CalculateProcess `json:"calculateProcess" gorm:"polymorphicType:Kind;polymorphicId:OwnerID;polymorphicValue:provider"`
|
CalculateProcess []CalculateProcess `json:"calculateProcess" gorm:"polymorphicType:Kind;polymorphicId:OwnerID;polymorphicValue:provider"`
|
||||||
// 备注
|
// 备注
|
||||||
Remark string `json:"remark,omitempty"`
|
Mark string `json:"mark,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProviderOption struct {
|
type ProviderOption struct {
|
||||||
|
@ -19,8 +19,6 @@ type Seller struct {
|
|||||||
Config SellerOption `gorm:"type:json;serializer:json" json:"config"`
|
Config SellerOption `gorm:"type:json;serializer:json" json:"config"`
|
||||||
//计算过程
|
//计算过程
|
||||||
CalculateProcess []CalculateProcess `json:"calculateProcess" gorm:"polymorphicType:Kind;polymorphicId:OwnerID;polymorphicValue:seller"`
|
CalculateProcess []CalculateProcess `json:"calculateProcess" gorm:"polymorphicType:Kind;polymorphicId:OwnerID;polymorphicValue:seller"`
|
||||||
// 备注
|
|
||||||
Remark string `json:"remark,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SellerOption struct {
|
type SellerOption struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user