首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏Java升级打怪进阶之路

    用户积分和积分排行榜功能微服务实现

    redisTemplate; } } 新增用户积分功能 用户积分实体 /** * 用户积分实体 * @author zjq */ @Getter @Setter public class UserPoints userPoints = new UserPoints(); userPoints.setFkUserId(userId); userPoints.setPoints( points); userPoints.setTypes(types); userPointsMapper.save(userPoints); } 数据交互mapper 层 /** * 添加积分 * @param userPoints 用户积分实体 */ @Insert("insert into t_user_points userPoints); 网关 ms-gateway 服务添加积分微服务路由 spring: application: name: ms-gateway cloud: gateway

    1.4K20编辑于 2023-01-13
  • 来自专栏dongfanger

    代码评审,揭示黑盒背后的真相

    { String productCategory = "electronics"; float productPrice = 999.99f; int userPoints "electronics".equals(productCategory)) { if (productPrice > 1000) { if (userPoints applyDiscount(0.1f); } } else { if (userPoints if ("clothing".equals(productCategory)) { if (productPrice > 500) { if (userPoints applyDiscount(0.2f); } } else { if (userPoints

    38810编辑于 2023-08-09
  • 体育直播平台开发中的积分商城系统技术架构详解

    UserPoints::hasEnough($userId, $item->point_price * $num)) { return error('积分不足'); } // item->point_price * $num, 'type' => 'exchange', 'ref_id' => 0 ]); UserPoints

    37000编辑于 2025-08-07
  • 来自专栏苏三说技术

    分布式事务的7种方案,yyds!

    Transactional public boolean tryDeductPoints(Long userId, int points) { // 检查用户积分是否充足 UserPoints

    59210编辑于 2025-08-06
领券