订单计算相关
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
953 B

3 years ago
  1. package ordercalc
  2. import (
  3. "testing"
  4. )
  5. func Test_DistributionPrice(t *testing.T) {
  6. business := map[string]string{"Id": "4", "LevelId": "3", "Grade": "3"}
  7. productSpecialPrice := make([]map[string]string, 0)
  8. price := make(map[string]string)
  9. price["BusinessId"] = "0"
  10. price["BusinessLevelId"] = "2"
  11. // price["DistributionPrice"] = "#distribution_price#+5"
  12. price["DistributionPrice"] = "0.05"
  13. // productSpecialPrice = append(productSpecialPrice, price)
  14. price = make(map[string]string)
  15. price["BusinessId"] = "0"
  16. price["BusinessLevelId"] = "3"
  17. price["DistributionPrice"] = "0.05"
  18. // productSpecialPrice = append(productSpecialPrice, price)
  19. price = make(map[string]string)
  20. price["BusinessId"] = "0"
  21. price["BusinessLevelId"] = ""
  22. price["DistributionPrice"] = "12"
  23. // productSpecialPrice = append(productSpecialPrice, price)
  24. dis, err := DistributionPrice(business, productSpecialPrice, 0.07, "7:2:1", 0.5)
  25. t.Log(dis)
  26. t.Log(err)
  27. }