- CaculateSkuPric 250, 500
This commit is contained in:
@@ -90,7 +90,7 @@ func GetPlaces(ctx *jxcontext.Context, keyword string, includeDisabled bool, par
|
|||||||
sqlParams = append(sqlParams, params["level"])
|
sqlParams = append(sqlParams, params["level"])
|
||||||
}
|
}
|
||||||
sql += " ORDER BY t1.level, t1.name"
|
sql += " ORDER BY t1.level, t1.name"
|
||||||
globals.SugarLogger.Debug(sql)
|
// globals.SugarLogger.Debug(sql)
|
||||||
places := []*model.Place{}
|
places := []*model.Place{}
|
||||||
return places, dao.GetRows(nil, &places, sql, sqlParams)
|
return places, dao.GetRows(nil, &places, sql, sqlParams)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,10 +119,17 @@ func CaculateSkuPrice(unitPrice int, specQuality float32, specUnit string, skuNa
|
|||||||
if skuNameUnit != "份" {
|
if skuNameUnit != "份" {
|
||||||
return unitPrice
|
return unitPrice
|
||||||
}
|
}
|
||||||
if strings.ToLower(specUnit) == "kg" {
|
lowerSpecUnit := strings.ToLower(specUnit)
|
||||||
|
if lowerSpecUnit == "kg" || lowerSpecUnit == "l" {
|
||||||
specQuality *= 1000
|
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 {
|
func GetSliceLen(list interface{}) int {
|
||||||
|
|||||||
Reference in New Issue
Block a user