This commit is contained in:
苏尹岚
2019-10-31 13:55:29 +08:00
42 changed files with 647 additions and 454 deletions

View File

@@ -101,6 +101,10 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
if err = GetRow(db, storeDetail, sql, sqlParams...); err == nil {
storeDetail.PricePercentagePackObj = PricePercentagePack2Obj(storeDetail.PricePercentagePackStr)
storeDetail.FreightDeductionPackObj = FreightDeductionPack2Obj(storeDetail.FreightDeductionPackStr)
if vendorID == model.VendorIDJX {
storeDetail.VendorStatus = storeDetail.Status
storeDetail.PricePercentage = 100
}
return storeDetail, nil
}
return nil, err
@@ -114,16 +118,8 @@ func GetStoreDetailByVendorStoreID(db *DaoDB, vendorStoreID string, vendorID int
if vendorID != model.VendorIDJX {
return getStoreDetail(db, 0, vendorID, vendorStoreID)
}
store := &model.Store{}
store.ID = int(utils.Str2Int64WithDefault(vendorStoreID, 0))
if err = GetEntity(db, store); err == nil {
// todo 还要补全其它参数
storeDetail = &StoreDetail{
Store: *store,
VendorStoreID: vendorStoreID,
VendorStatus: store.Status,
PricePercentage: 100,
}
if storeDetail, err = getStoreDetail(db, int(utils.Str2Int64WithDefault(vendorStoreID, 0)), vendorID, ""); err == nil {
storeDetail.VendorStoreID = vendorStoreID
}
return storeDetail, err
}

View File

@@ -164,7 +164,7 @@ func GetSkusCategories(db *DaoDB, vendorID, storeID int, skuIDs []int, level int
// 单门店模式厂商适用
// 单纯的从已经创建的store_sku_category_map中得到相关的同步信息
func GetStoreCategories(db *DaoDB, vendorID, storeID int, level int, isDirty bool) (cats []*SkuStoreCatInfo, err error) {
func GetStoreCategories(db *DaoDB, vendorID, storeID int, level int, mustDirty bool) (cats []*SkuStoreCatInfo, err error) {
fieldPrefix := ConvertDBFieldPrefix(model.VendorNames[vendorID])
sql := `
SELECT t4.*,
@@ -183,7 +183,7 @@ func GetStoreCategories(db *DaoDB, vendorID, storeID int, level int, isDirty boo
storeID,
utils.DefaultTimeValue,
}
if isDirty {
if mustDirty {
sql += " AND t5.%s_sync_status <> 0"
fieldPrefixParams = append(fieldPrefixParams, fieldPrefix)
}
@@ -204,7 +204,7 @@ func GetDirtyStoreCategories(db *DaoDB, vendorID, storeID int, level int) (cats
// 以store_sku_bind为基础来做同步正常情况下使用
// !!! 此函数不要将store_sku_bind中的vendor_price取出来放到StoreSkuSyncInfo.VendorPrice中因为之后会依赖这个VendorPrice进行重算
// 单多门店模式厂商通用
func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, isDirty bool) (skus []*StoreSkuSyncInfo, err error) {
func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty bool) (skus []*StoreSkuSyncInfo, err error) {
if vendorID < 0 {
panic("vendorID<0")
}
@@ -275,7 +275,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, isDirty bool)
sql += " AND t1.store_id = ?"
sqlParams = append(sqlParams, storeID)
}
if isDirty {
if mustDirty {
sql += " AND (t1.%s_sync_status <> 0 OR (%s.%s_id <> 0 AND t3.id IS NULL))"
fmtParams = append(fmtParams, fieldPrefix, tableName, fieldPrefix)
} else {