Przeglądaj źródła

fix: EnergyService 修复 JSONObject.getInt -> getIntValue 和 executeAward 缺少 totalAmount 参数

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Xiaogang Liao 1 miesiąc temu
rodzic
commit
fb83703576

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/service/EnergyService.java

@@ -1158,7 +1158,7 @@ public class EnergyService {
         // 3. 按比例分配
         Map<Long, Integer> allocations = calculateAllocations(totalAmount, dimRatios);
         // 4. 更新余额 + 写流水
-        return executeAward(childId, sourceType, sourceId, description, daysToExpire, allocations);
+        return executeAward(childId, sourceType, sourceId, totalAmount, description, daysToExpire, allocations);
     }
 
     /**
@@ -1299,7 +1299,7 @@ public class EnergyService {
             for (int i = 0; i < arr.size(); i++) {
                 com.alibaba.fastjson.JSONObject item = arr.getJSONObject(i);
                 String dimCode = item.getString("dim");
-                int ratio = item.getInt("ratio");
+                int ratio = item.getIntValue("ratio");
                 EnergyDimension dim = getDimByCode(dimCode);
                 if (dim != null) {
                     result.put(dim.getId(), ratio * 100); // 转为10000制