瀏覽代碼

风控体系代码提交

zjy 1 月之前
父節點
當前提交
4a6651f561

+ 3 - 0
alien-entity/src/main/resources/mapper/second/SecondGoodsInfoMapper.xml

@@ -66,6 +66,7 @@
             g.goods_status,
             g.goods_status,
             g.delete_flag,
             g.delete_flag,
             g.release_time,
             g.release_time,
+            g.video_first_frame,
             ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
             ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when llr.id is null then '0' else '1' end likeStatus,
             g.home_image,
             g.home_image,
@@ -115,6 +116,7 @@
             CONCAT('user_', u.user_phone) as user_phone,
             CONCAT('user_', u.user_phone) as user_phone,
             g.goods_status,
             g.goods_status,
             g.home_image,
             g.home_image,
+            g.video_first_frame,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when lc.id is null then '0' else '1' end collectStatus,
             case when lc.id is null then '0' else '1' end collectStatus,
             (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL
             (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL
@@ -198,6 +200,7 @@
             g.delete_flag,
             g.delete_flag,
             ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
             ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
             g.home_image,
             g.home_image,
+            g.video_first_frame,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when lc.id is null then '0' else '1' end collectStatus,
             case when lc.id is null then '0' else '1' end collectStatus,
             (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL
             (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL

+ 23 - 0
alien-second/src/main/java/shop/alien/second/service/impl/SecondUserCreditServiceImpl.java

@@ -97,6 +97,29 @@ public class SecondUserCreditServiceImpl extends ServiceImpl<SecondUserCreditMap
             // 检查是否已存在记录
             // 检查是否已存在记录
             SecondUserCredit existingPoints = getByUserId(userId);
             SecondUserCredit existingPoints = getByUserId(userId);
             if (existingPoints != null) {
             if (existingPoints != null) {
+                // 使用LambdaQueryWrapper的exists方法 查看是否已添加基础积分
+                LambdaQueryWrapper<SecondUserCreditRecord> queryWrapper = new LambdaQueryWrapper<>();
+                queryWrapper.eq(SecondUserCreditRecord::getUserId, userId)
+                        .eq(SecondUserCreditRecord::getPointsType, 1)
+                        .eq(SecondUserCreditRecord::getDeleteFlag, 0);
+                boolean exists = secondUserCreditRecordMapper.selectCount(queryWrapper) > 0;
+
+                if (!exists) {
+                    // 更新积分
+                    int newPoints = existingPoints.getUserPoints() + initialPoints;
+                    existingPoints.setUserPoints(newPoints > 0 ? newPoints : 0);
+                    existingPoints.setUpdatedTime(new Date());
+                    secondUserCreditMapper.updateById(existingPoints);
+
+                    // 创建积分记录
+                    SecondUserCreditRecord record = new SecondUserCreditRecord();
+                    record.setUserId(userId);
+                    record.setPoints(initialPoints);
+                    record.setPointsType(pointsType);
+                    serviceImpl.createRecord(record);
+                    return true;
+                }
+
                 log.warn("用户积分记录已存在,userId={}", userId);
                 log.warn("用户积分记录已存在,userId={}", userId);
                 return false;
                 return false;
             }
             }

+ 2 - 10
alien-store/src/main/java/shop/alien/store/service/LifeUserService.java

@@ -352,16 +352,8 @@ public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
                     alienSecondFeign.recordRiskControlData(null, 2, "账号异常", macIp, detailInfo);
                     alienSecondFeign.recordRiskControlData(null, 2, "账号异常", macIp, detailInfo);
                 }
                 }
             }
             }
-
-
-            // 使用LambdaQueryWrapper的exists方法 查看是否已添加基础积分
-            LambdaQueryWrapper<SecondUserCredit> queryWrapper = new LambdaQueryWrapper<>();
-            queryWrapper.eq(SecondUserCredit::getUserId, user.getId()).eq(SecondUserCredit::getDeleteFlag, 0);
-            boolean exists = secondUserCreditMapper.selectCount(queryWrapper) > 0;
-            if (!exists) {
-                // 第一次登录,添加用户基础积分
-                alienSecondFeign.createPointsRecord(user.getId(), 300, 1);
-            }
+            // 第一次登录,添加用户基础积分
+            alienSecondFeign.createPointsRecord(user.getId(), 300, 1);
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("用户登录log存放异常:{}", e);
             log.error("用户登录log存放异常:{}", e);
         }
         }