2 Commits 25e105dadf ... 0da9f91e85

Autor SHA1 Mensaje Fecha
  YH_0525 0da9f91e85 Merge remote-tracking branch 'origin/test_dev' into test hace 1 mes
  YH_0525 2c2f61e314 上传资源线索获取积分 hace 1 mes

+ 2 - 2
LiangZhiYUMao/pages/matchmaker-workbench/earn-points.vue

@@ -187,9 +187,9 @@ export default {
         }
         await this.doSignIn(rule)
       } else if (rule.ruleType === 2) {
-        // 上传线索
+        // 上传资源 - 跳转到我的资源的信息录入页面
         uni.navigateTo({
-          url: '/pages/matchmaker-workbench/add-resource'
+          url: '/pages/matchmaker-workbench/resource-input'
         })
       } else if (rule.ruleType === 4) {
         // 培训课程

+ 10 - 0
service/homePage/src/main/java/com/zhentao/service/PointsManageService.java

@@ -21,6 +21,16 @@ public interface PointsManageService {
      */
     boolean addPointsByRuleName(Integer makerId, String ruleName, String reason);
 
+    /**
+     * 根据规则类型为红娘添加积分
+     *
+     * @param makerId 红娘ID
+     * @param ruleType 规则类型:1-签到 2-上传线索 3-撮合成功 4-完成培训 5-活动奖励
+     * @param reason 额外原因
+     * @return 是否成功
+     */
+    boolean addPointsByRuleType(Integer makerId, Integer ruleType, String reason);
+
     /**
      * 直接为红娘添加指定数量的积分
      *

+ 25 - 0
service/homePage/src/main/java/com/zhentao/service/impl/MyResourceServiceImpl.java

@@ -52,6 +52,9 @@ public class MyResourceServiceImpl extends ServiceImpl<MyResourceMapper, MyResou
     
     @Autowired(required = false)
     private com.zhentao.service.UserFollowUpService userFollowUpService;
+    
+    @Autowired(required = false)
+    private com.zhentao.service.PointsManageService pointsManageService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -131,6 +134,28 @@ public class MyResourceServiceImpl extends ServiceImpl<MyResourceMapper, MyResou
             System.out.println("=== 标签关联保存完成 ===");
         }
         
+        // 资源录入成功后,为红娘添加积分奖励
+        if (result && myResource.getMatchmakerId() != null && pointsManageService != null) {
+            try {
+                String resourceName = myResource.getName() != null ? myResource.getName() : "未知";
+                // 使用规则类型2(上传线索)添加积分
+                boolean pointsAdded = pointsManageService.addPointsByRuleType(
+                    myResource.getMatchmakerId(), 
+                    2,  // 规则类型2 = 上传线索
+                    "录入资源: " + resourceName
+                );
+                if (pointsAdded) {
+                    System.out.println("✅ 资源录入积分奖励添加成功,红娘ID: " + myResource.getMatchmakerId());
+                } else {
+                    System.out.println("⚠️ 资源录入积分奖励添加失败,红娘ID: " + myResource.getMatchmakerId());
+                }
+            } catch (Exception e) {
+                // 积分添加失败不影响资源录入
+                System.err.println("⚠️ 添加积分奖励时发生异常: " + e.getMessage());
+                e.printStackTrace();
+            }
+        }
+        
         return result;
     }
 

+ 31 - 0
service/homePage/src/main/java/com/zhentao/service/impl/PointsManageServiceImpl.java

@@ -61,6 +61,37 @@ public class PointsManageServiceImpl implements PointsManageService {
         return addPoints(makerId, rule.getPointValue(), fullReason);
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean addPointsByRuleType(Integer makerId, Integer ruleType, String reason) {
+        // 根据规则类型查询积分规则
+        com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<PointRule> wrapper = 
+            new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<>();
+        wrapper.eq("rule_type", ruleType).eq("status", 1);
+        PointRule rule = pointRuleMapper.selectOne(wrapper);
+        
+        if (rule == null) {
+            System.err.println("积分规则不存在,规则类型: " + ruleType);
+            return false;
+        }
+        if (rule.getPointValue() <= 0) {
+            System.err.println("积分值必须为正数,规则类型: " + ruleType);
+            return false;
+        }
+
+        // 构建积分变动原因
+        String fullReason = rule.getRuleName();
+        if (reason != null && !reason.isEmpty()) {
+            fullReason += "-" + reason;
+        }
+
+        System.out.println("添加积分 - 红娘ID: " + makerId + ", 规则类型: " + ruleType + 
+                          ", 规则名称: " + rule.getRuleName() + ", 积分值: " + rule.getPointValue());
+
+        // 调用添加积分方法
+        return addPoints(makerId, rule.getPointValue(), fullReason);
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean addPoints(Integer makerId, Integer points, String reason) {