|
|
@@ -48,7 +48,7 @@ public class OrderService {
|
|
|
// 判断用户余额并预扣
|
|
|
User user = User.dao.findById(userId);
|
|
|
if (user.getBalance() < totalPrice) {
|
|
|
- throw new RuntimeException("火花余额不足,请充值。需要: " + totalPrice + ",你有:" + user.getBalance());
|
|
|
+ throw new RuntimeException("余额不足,请充值。需要: " + totalPrice + ",你有:" + user.getBalance());
|
|
|
}
|
|
|
user.setBalance(user.getBalance() - totalPrice);
|
|
|
if (!user.update()) {
|
|
|
@@ -166,13 +166,13 @@ public class OrderService {
|
|
|
throw new RuntimeException("订单日志创建失败"); // 抛出异常触发回滚
|
|
|
}
|
|
|
|
|
|
- // 5. 火花还给人家
|
|
|
+ // 5. 还给人家
|
|
|
User user = User.dao.findById(userId);
|
|
|
user.setBalance(user.getBalance() + order.getTotalPrice());
|
|
|
if (!user.update()) {
|
|
|
- throw new RuntimeException("火花归还失败"); // 抛出异常触发回滚
|
|
|
+ throw new RuntimeException("归还失败"); // 抛出异常触发回滚
|
|
|
}
|
|
|
- // 6. 火花归还记录
|
|
|
+ // 6. 归还记录
|
|
|
BalanceLog l = new BalanceLog();
|
|
|
l.set("create_time", System.currentTimeMillis());
|
|
|
l.set("is_deleted", 0);
|