UpdateActPrice4StoreSkuNameNew

This commit is contained in:
gazebo
2019-12-24 10:41:46 +08:00
parent e8352cd412
commit 3d8781ca0f

View File

@@ -1280,8 +1280,11 @@ func UpdateActPrice4StoreSkuNameNew(db *DaoDB, storeIDs, skuIDs []int, skuNamesI
if actStoreSku := actStoreSkuMap4EarningPrice.GetActStoreSku(skuName.StoreID, v.SkuID, -1); actStoreSku != nil {
v.EarningPrice = int(actStoreSku.EarningPrice)
v.EarningActID = actStoreSku.ActID
} else if v.EarningPrice == 0 {
v.EarningPrice = int(jxutils.CaculateSkuEarningPrice(int64(v.BindPrice), int64(v.BindPrice), skuName.PayPercentage))
} else {
earningPrice := int(jxutils.CaculateSkuEarningPrice(int64(v.BindPrice), int64(v.BindPrice), skuName.PayPercentage))
if earningPrice < v.EbaiPrice {
v.EbaiPrice = earningPrice
}
}
}
} else {
@@ -1290,3 +1293,18 @@ func UpdateActPrice4StoreSkuNameNew(db *DaoDB, storeIDs, skuIDs []int, skuNamesI
}
return err
}
func GetDeletedStoreSkuBind(db *DaoDB, storeID, skuID int) (storeSkuBind *model.StoreSkuBind) {
sql := `
SELECT a.*
FROM store_sku_bind a
WHERE a.store_id = ? AND a.sku_id = ?
ORDER BY a.deleted_at DESC`
sqlParams := []interface{}{
storeID, skuID,
}
if err := GetRow(db, &storeSkuBind, sql, sqlParams...); err != nil {
storeSkuBind = nil
}
return storeSkuBind
}