- CaculateSkuPric 250, 500

This commit is contained in:
gazebo
2018-10-25 15:43:12 +08:00
parent e4b46c9706
commit 3af1e0a2ac
2 changed files with 10 additions and 3 deletions

View File

@@ -90,7 +90,7 @@ func GetPlaces(ctx *jxcontext.Context, keyword string, includeDisabled bool, par
sqlParams = append(sqlParams, params["level"])
}
sql += " ORDER BY t1.level, t1.name"
globals.SugarLogger.Debug(sql)
// globals.SugarLogger.Debug(sql)
places := []*model.Place{}
return places, dao.GetRows(nil, &places, sql, sqlParams)
}

View File

@@ -119,10 +119,17 @@ func CaculateSkuPrice(unitPrice int, specQuality float32, specUnit string, skuNa
if skuNameUnit != "份" {
return unitPrice
}
if strings.ToLower(specUnit) == "kg" {
lowerSpecUnit := strings.ToLower(specUnit)
if lowerSpecUnit == "kg" || lowerSpecUnit == "l" {
specQuality *= 1000
}
return int(math.Round(float64(float32(unitPrice) * specQuality / 500)))
price := int(math.Round(float64(float32(unitPrice) * specQuality / 500)))
if specQuality < 250 {
price = price * 120 / 100
} else if specQuality < 500 {
price = price * 110 / 100
}
return price
}
func GetSliceLen(list interface{}) int {