提交 ca4e151c authored 作者: 吴德鹏's avatar 吴德鹏

update activity

上级 05a2be6a
...@@ -174,12 +174,19 @@ public class ActivityController { ...@@ -174,12 +174,19 @@ public class ActivityController {
BigDecimal threshold = new BigDecimal(key); BigDecimal threshold = new BigDecimal(key);
double value = con.getValue(); double value = con.getValue();
discount = String.valueOf(value); discount = String.valueOf(value);
String msg = "";
if ("1".equals(type)) {
msg = "$" + discount;
} else {
msg = discount + "%";
}
if (itemPrice.compareTo(threshold) < 0) { if (itemPrice.compareTo(threshold) < 0) {
lessAmount = threshold.subtract(itemPrice); lessAmount = threshold.subtract(itemPrice);
map.put("message", "Spend " + lessAmount + " more to Enjoy " + discount + " off!");
map.put("message", "Spend " + lessAmount + " more to Enjoy " + msg + " off!");
break; break;
} else { } else {
map.put("message", "Congrats, you've got " + discount + " off!"); map.put("message", "Congrats, you've got " + msg + " off!");
} }
} }
} else if ("3".equals(type)) { } else if ("3".equals(type)) {
...@@ -188,10 +195,10 @@ public class ActivityController { ...@@ -188,10 +195,10 @@ public class ActivityController {
double value = con.getValue(); double value = con.getValue();
discount = String.valueOf(value); discount = String.valueOf(value);
if (itemCount < key) { if (itemCount < key) {
map.put("message", "Buy " + lessAmount + " more item to Enjoy " + discount + " off!"); map.put("message", "Buy " + key + " more item to Enjoy " + discount + "% off!");
break; break;
} else { } else {
map.put("message", "Congrats, you've got " + discount + " off!"); map.put("message", "Congrats, you've got " + discount + "% off!");
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论