|
|
@ -68,14 +68,7 @@ public class BeanConsumeServiceImpl implements BeanConsumeService { |
|
|
|
@Override |
|
|
|
public Result reduce(BeanConsume consume) { |
|
|
|
|
|
|
|
//获取用户当前余额 |
|
|
|
BeanUserCard user= beanUserMapper.userCard(consume.getJwcode()); |
|
|
|
if (user.getFreeBean() < consume.getFreeBean()) { |
|
|
|
return Result.error("用户免费金豆余额不足"); |
|
|
|
} |
|
|
|
if (user.getPermanentBean() < consume.getPermanentBean()) { |
|
|
|
return Result.error("用户永久金豆余额不足"); |
|
|
|
} |
|
|
|
|
|
|
|
// 验证精网号是否有效 |
|
|
|
if (consume.getJwcode() == null || consume.getJwcode().isEmpty()) { |
|
|
|
return Result.error("精网号不能为空"); |
|
|
@ -93,6 +86,14 @@ public class BeanConsumeServiceImpl implements BeanConsumeService { |
|
|
|
if (consume.getFreeBean() == 0 && consume.getPermanentBean() == 0) { |
|
|
|
return Result.error("免费豆和永久豆不能同时为0"); |
|
|
|
} |
|
|
|
//获取用户当前余额 |
|
|
|
BeanUserCard user= beanUserMapper.userCard(consume.getJwcode()); |
|
|
|
if (user.getFreeBean() < consume.getFreeBean()) { |
|
|
|
return Result.error("用户免费金豆余额不足"); |
|
|
|
} |
|
|
|
if (user.getPermanentBean() < consume.getPermanentBean()) { |
|
|
|
return Result.error("用户永久金豆余额不足"); |
|
|
|
} |
|
|
|
// 验证备注是否为空 |
|
|
|
if (consume.getRemark() == null || consume.getRemark().isEmpty()) { |
|
|
|
return Result.error("备注不能为空"); |
|
|
|