Ver Fonte

僵尸积分调整

sunkean há 3 anos atrás
pai
commit
9088d33054

+ 1 - 1
src/main/java/com/izouma/nineth/repo/MetaGameProcessRepo.java

@@ -17,7 +17,7 @@ public interface MetaGameProcessRepo extends JpaRepository<MetaGameProcess, Long
     MetaGameProcess findTopPoint(Long userId);
 
     @Query(value = "select sum(m.point) from MetaGameProcess m where m.userId = ?1 and m.metaGameCopyId in ?2 and m.del = false")
-    int sumPoint(Long userId, List<Long> metaGameCopyIds);
+    Long sumPoint(Long userId, List<Long> metaGameCopyIds);
 
     @Query(value = " SELECT new com.izouma.nineth.dto.SnapshotDTO(m.userId, u.nickname, u.phone, 0) FROM (SELECT user_id userId , sum( point ) point FROM meta_game_process WHERE meta_game_copy_id IN ?2) m LEFT JOIN user u ON m.userId = u.id WHERE m.point > ?1", nativeQuery = true)
     List<SnapshotDTO> snapshot(int point, List<Long> metaGameCopyIds);

+ 5 - 1
src/main/java/com/izouma/nineth/web/MetaGameCopyController.java

@@ -156,7 +156,11 @@ public class MetaGameCopyController extends BaseController {
     @GetMapping("/sumPoint")
     public MetaRestResult<MetaZombieFinishRecord> sumPoint() {
         Long userId = SecurityUtils.getAuthenticatedUser().getId();
-        int sumPoint = metaGameProcessRepo.sumPoint(userId, List.of(8746067L, 8734418L, 8734417L));
+        Long sum = metaGameProcessRepo.sumPoint(userId, List.of(8746067L, 8734418L, 8734417L));
+        if (Objects.isNull(sum)) {
+            return MetaRestResult.returnSuccess(new MetaZombieFinishRecord(userId, false, false, 0));
+        }
+        int sumPoint = sum.intValue();
         int point = sysConfigService.getInt("zombie_point");
         if (sumPoint < point) {
             return MetaRestResult.returnSuccess(new MetaZombieFinishRecord(userId, false, false, sumPoint));