企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 /** * <b>方法描述:</b> 获取元素排序值 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 11:02:10 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param member * 入参|元素|{@link java.lang.String} * @param score * 出参|排序值|{@link double} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "获取元素排序值", style = "判断型", type = "同步组件", comment = "返回有序集key中,成员member的score值;如果member元素不是有序集key的成员,或key不存在,返回null", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 11:02:10") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class), @Param(name = "member", comment = "元素", type = java.lang.String.class) }) @OutParams(param = { @Param(name = "score", comment = "排序值", type = double.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_zscore(String key, String member) { try { double obj = redisTemplate.opsForZSet().score(key, member); return ResultBase.newSuccessResult(obj); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR6010", "获取元素排序值 异常:" + AppLog.errorMsg(e)); } } 交易中组件使用方式: ![](https://img.kancloud.cn/79/05/79058e3c590ebe2f58925472a99955bd_950x750.jpg) ## 参数说明及示例 key:redis中的key,示例: `"qwer"` 元素:需要获取排序值的元素,示例: `"test"` 排序值:返回当前元素的排序值,示例: `__INNER__["num"]` > 返回有序集key中,成员member的score值;如果member元素不是有序集key的成员,或key不存在,返回null