🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 组件源码 /** * <b>方法描述:</b> 增加元素的排序值 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 11:01:09 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param score * 入参|排序值|{@link double} * @param member * 入参|元素|{@link java.lang.String} * @param newscore * 出参|新排序值|{@link double} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "增加元素的排序值", style = "判断型", type = "同步组件", comment = "成员member的score值加上增量;score值必须整数值或双精度浮点数", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 11:01:09") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class), @Param(name = "score", comment = "排序值", type = double.class), @Param(name = "member", comment = "元素", type = java.lang.String.class) }) @OutParams(param = { @Param(name = "newscore", comment = "新排序值", type = double.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_zincrby(String key, double score, String member) { try { double obj = redisTemplate.opsForZSet().incrementScore(key, member, score); return ResultBase.newSuccessResult(obj); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR6006", "增加元素的排序值 异常:" + AppLog.errorMsg(e)); } } 交易中组件使用方式: ![](https://img.kancloud.cn/02/52/0252b10602c33e319f133d839356579d_1055x750.jpg) ## 参数说明及示例 key:redis中的key,示例: `"qwer"` 排序值:增加的排序值,示例: `5` 元素:给当前元素增加排序值,示例: `"test"` 新排序值:返回当前元素新的排序值,示例: `__INNER__["newScore"]` > 成员member的score值加上增量;score值必须整数值或双精度浮点数