|
|
@@ -1380,6 +1380,24 @@ public class EnergyService {
|
|
|
return deductEnergy(memberId, dim.getId(), amount, reason);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 发放能量 — 通过维度code(自动查ID),无日上限/配置约束,供低频行为直接发放
|
|
|
+ *
|
|
|
+ * @return 发放结果 Map<dimensionCode, amount>(空 = 维度不存在未发放)
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ public Map<String, Integer> awardEnergyByCode(Long memberId, String dimensionCode, Integer amount, String reason) {
|
|
|
+ if (amount == null || amount <= 0) return new HashMap<>();
|
|
|
+ EnergyDimension dim = getDimByCode(dimensionCode);
|
|
|
+ if (dim == null) {
|
|
|
+ log.warn("EnergyService.awardEnergyByCode: dimension not found, code={}", dimensionCode);
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
+ Map<Long, Integer> allocations = new LinkedHashMap<>();
|
|
|
+ allocations.put(dim.getId(), amount);
|
|
|
+ return executeAward(memberId, "challenge", null, amount, reason, null, allocations);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询五维能量概览
|
|
|
*/
|