|
|
@ -1670,14 +1670,15 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result updatePointsUser(UserPointsFormDTO formDTO) { |
|
|
|
public Result<Boolean> updatePointsUser(UserPointsFormDTO formDTO) { |
|
|
|
UserEntity userEntity = baseDao.selectById(formDTO.getUserId()); |
|
|
|
int activePoints = userEntity.getActivePoints() + formDTO.getPoints(); |
|
|
|
if (activePoints < 0) { |
|
|
|
throw new RenException("当前积分不够,不能够兑换"); |
|
|
|
return new Result<Boolean>().ok(false); |
|
|
|
} |
|
|
|
userEntity.setActivePoints(activePoints); |
|
|
|
return new Result().ok(baseDao.updateById(userEntity)); |
|
|
|
baseDao.updateById(userEntity); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|