diff --git a/commission.go b/commission.go index 4681e79..0a5a180 100644 --- a/commission.go +++ b/commission.go @@ -6,8 +6,9 @@ package ordercalc import ( "errors" - "strings" + + "git.tetele.net/tgo/helper" ) /** @@ -22,7 +23,7 @@ import ( */ func DistributionPrice(business map[string]string, productSpecialPrice []map[string]string, distributionPrice interface{}, percentAge interface{}, productPrice interface{}) (float64, error) { - product_price := ToString(productPrice) + product_price := helper.ToString(productPrice) if len(business) < 1 { return 0, errors.New("参数错误") @@ -34,13 +35,13 @@ func DistributionPrice(business map[string]string, productSpecialPrice []map[str return 0, errors.New("分销商参数错误") } - distribution_price := ToString(distributionPrice) + distribution_price := helper.ToString(distributionPrice) distribution_price_float, err := ToFloat64(distributionPrice) if err != nil { return 0, err } - percent_age := ToString(percentAge) + percent_age := helper.ToString(percentAge) if len(productSpecialPrice) < 1 && percent_age == "" { return distribution_price_float, nil //没有特殊价格,没有分销比例,返回原分销价 @@ -179,7 +180,7 @@ func DistributionPrice(business map[string]string, productSpecialPrice []map[str */ func VipPrice(productSpecialPrice []map[string]string, productPrice interface{}) (float64, error) { - product_price := ToString(productPrice) + product_price := helper.ToString(productPrice) product_price_float, _ := ToFloat64(productPrice) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..08eb75c --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.tetele.net/tgo/ordercalc + +go 1.14