Xiaogang Liao 1 месяц назад
Родитель
Сommit
d769f6ed82

+ 3 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/Activity.java

@@ -81,6 +81,9 @@ public class Activity implements Serializable {
     /** 签到积分(0=使用系统默认) */
     private Integer checkinPoints;
 
+    /** 活动奖励CF值(0=不发) */
+    private Integer platformPoints;
+
     /** 是否需要报名(0=否,1=是) */
     private Integer requireRegistration;
 

+ 14 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/ActivityService.java

@@ -59,6 +59,9 @@ public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
     @Resource
     private UserMapper userMapper;
 
+    @Resource
+    private PlatformPointsService platformPointsService;
+
     public Result<Map<String, Object>> list(String dimensionCode, Integer page, Integer size, Long userId) {
         autoEndExpiredActivities();
         LambdaQueryWrapper<Activity> query = new LambdaQueryWrapper<Activity>()
@@ -373,6 +376,17 @@ public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
             memberId, activityId, e.getMessage());
         }
 
+        // 9b. 活动下发 CF 值(平台积分)
+        if (activity.getPlatformPoints() != null && activity.getPlatformPoints() > 0 && userId != null) {
+            try {
+                platformPointsService.earn(userId, activity.getPlatformPoints(),
+                        "activity", activityId, "活动签到: " + activity.getTitle());
+            } catch (Exception e) {
+                log.warn("活动CF值发放失败: userId={}, activityId={}, error={}",
+                        userId, activityId, e.getMessage());
+            }
+        }
+
         // 10. Return result
         result.put("taskId", task.getId());
         result.put("pointsEarned", points);