- 整理StoreSkuSyncInfo
This commit is contained in:
@@ -42,32 +42,42 @@ type StoreCatSyncInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StoreSkuSyncInfo struct {
|
type StoreSkuSyncInfo struct {
|
||||||
BindID int `orm:"column(bind_id)"`
|
// 平台无关的store sku信息
|
||||||
Price int64
|
BindID int `orm:"column(bind_id)"` // 换名的原因是与Sku.ID同名区别
|
||||||
UnitPrice int64
|
StoreID int `orm:"column(store_id)"`
|
||||||
|
SkuID int `orm:"column(sku_id)"` // 这个与Sku.ID的区别是SkuID是必然存在的
|
||||||
|
Price int64
|
||||||
|
UnitPrice int64
|
||||||
|
|
||||||
|
// 平台相关的store sku信息
|
||||||
StoreSkuStatus int
|
StoreSkuStatus int
|
||||||
SkuSyncStatus int8
|
SkuSyncStatus int8
|
||||||
SkuID int `orm:"column(sku_id)"`
|
VendorSkuID string `orm:"column(vendor_sku_id)"`
|
||||||
|
|
||||||
model.Sku
|
model.Sku
|
||||||
VendorSkuID string `orm:"column(vendor_sku_id)"`
|
|
||||||
|
// sku_name
|
||||||
Prefix string
|
Prefix string
|
||||||
NameID int `orm:"column(name_id)"`
|
NameID int `orm:"column(name_id)"`
|
||||||
VendorNameID string `orm:"column(vendor_name_id)"`
|
VendorNameID string `orm:"column(vendor_name_id)"`
|
||||||
Name string
|
Name string
|
||||||
Unit string
|
Unit string
|
||||||
Img string
|
|
||||||
Upc string
|
Upc string
|
||||||
DescImg string
|
|
||||||
|
|
||||||
VendorVendorCatID int64 `orm:"column(vendor_vendor_cat_id)"`
|
// 平台相关的图片信息
|
||||||
|
Img string
|
||||||
|
DescImg string
|
||||||
|
|
||||||
CatSyncStatus int8
|
VendorVendorCatID int64 `orm:"column(vendor_vendor_cat_id)"` // 平台商品分类
|
||||||
VendorCatID string `orm:"column(vendor_cat_id)"`
|
|
||||||
|
|
||||||
|
// sku的商家分类信息
|
||||||
SkuCatSyncStatus int8
|
SkuCatSyncStatus int8
|
||||||
SkuVendorCatID string `orm:"column(sku_vendor_cat_id)"`
|
SkuVendorCatID string `orm:"column(sku_vendor_cat_id)"`
|
||||||
|
|
||||||
|
// sku_name的商家分类信息
|
||||||
|
CatSyncStatus int8
|
||||||
|
VendorCatID string `orm:"column(vendor_cat_id)"`
|
||||||
|
|
||||||
CatPricePercentage int
|
CatPricePercentage int
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +145,7 @@ func GetStoreCategories(db *DaoDB, vendorID, storeID int, level int) (cats []*St
|
|||||||
return cats, err
|
return cats, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 以store_sku_bind为基础来做同步,正常情况下使用
|
||||||
// 单多门店模式厂商通用
|
// 单多门店模式厂商通用
|
||||||
func GetStoreSkus(db *DaoDB, vendorID, storeID int, skuIDs []int) (skus []*StoreSkuSyncInfo, err error) {
|
func GetStoreSkus(db *DaoDB, vendorID, storeID int, skuIDs []int) (skus []*StoreSkuSyncInfo, err error) {
|
||||||
isSingleStorePF := model.MultiStoresVendorMap[vendorID] != 1
|
isSingleStorePF := model.MultiStoresVendorMap[vendorID] != 1
|
||||||
@@ -148,7 +159,7 @@ func GetStoreSkus(db *DaoDB, vendorID, storeID int, skuIDs []int) (skus []*Store
|
|||||||
}
|
}
|
||||||
fieldPrefix := ConvertDBFieldPrefix(model.VendorNames[vendorID])
|
fieldPrefix := ConvertDBFieldPrefix(model.VendorNames[vendorID])
|
||||||
sql := `
|
sql := `
|
||||||
SELECT t1.id bind_id, t1.sku_id, t1.price, t1.unit_price, t1.status store_sku_status, %s.%s_id vendor_sku_id, t1.%s_sync_status sku_sync_status, %s vendor_name_id,
|
SELECT t1.id bind_id, t1.sku_id, t1.price, t1.unit_price, t1.status store_sku_status, %s.%s_id vendor_sku_id, t1.%s_sync_status sku_sync_status, %s vendor_name_id, t1.store_id,
|
||||||
t2.*,
|
t2.*,
|
||||||
t3.id name_id, t3.prefix, t3.name, t3.unit, IF(t3.%s <> '', t3.%s, t3.img) img, t3.upc, t3.%s desc_img,
|
t3.id name_id, t3.prefix, t3.name, t3.unit, IF(t3.%s <> '', t3.%s, t3.img) img, t3.upc, t3.%s desc_img,
|
||||||
t4.%s_category_id vendor_vendor_cat_id, t4.%s_price_percentage cat_price_percentage
|
t4.%s_category_id vendor_vendor_cat_id, t4.%s_price_percentage cat_price_percentage
|
||||||
@@ -197,12 +208,13 @@ func GetStoreSkus(db *DaoDB, vendorID, storeID int, skuIDs []int) (skus []*Store
|
|||||||
return skus, err
|
return skus, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 以sku为基础来做全同步,
|
||||||
// 多门店模式厂商适用
|
// 多门店模式厂商适用
|
||||||
func GetFullStoreSkus(db *DaoDB, vendorID, storeID int) (skus []*StoreSkuSyncInfo, err error) {
|
func GetFullStoreSkus(db *DaoDB, vendorID, storeID int) (skus []*StoreSkuSyncInfo, err error) {
|
||||||
globals.SugarLogger.Debugf("GetFullStoreSkus, storeID:%d, vendorID:%d", storeID, vendorID)
|
globals.SugarLogger.Debugf("GetFullStoreSkus, storeID:%d, vendorID:%d", storeID, vendorID)
|
||||||
|
|
||||||
sql := `
|
sql := `
|
||||||
SELECT t1.id bind_id, t1.price, t1.unit_price, t1.status store_sku_status, t2.%s_id vendor_sku_id, t1.%s_sync_status sku_sync_status,
|
SELECT t1.id bind_id, t1.price, t1.unit_price, t1.status store_sku_status, t2.%s_id vendor_sku_id, t1.%s_sync_status sku_sync_status, t1.store_id,
|
||||||
t2.*, t2.id sku_id,
|
t2.*, t2.id sku_id,
|
||||||
t3.id name_id, t3.prefix, t3.name, t3.unit, IF(t3.%s <> '', t3.%s, t3.img) img,
|
t3.id name_id, t3.prefix, t3.name, t3.unit, IF(t3.%s <> '', t3.%s, t3.img) img,
|
||||||
t4.%s_category_id vendor_vendor_cat_id,
|
t4.%s_category_id vendor_vendor_cat_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user