xiongzhu 3 tahun lalu
induk
melakukan
5d952bfbac

+ 2 - 2
src/main/java/com/izouma/nineth/repo/AppVersionRepo.java

@@ -15,7 +15,7 @@ public interface AppVersionRepo extends JpaRepository<AppVersion, Long>, JpaSpec
     @Transactional
     void softDelete(Long id);
 
-    Optional<AppVersion> findByPlatformAndVersion(String platform, String version);
+    Optional<AppVersion> findByPlatformAndVersionAndDelFalse(String platform, String version);
 
-    Optional<AppVersion> findFirstByPlatformAndReviewFalseOrderByVersionNumDesc(String platform);
+    Optional<AppVersion> findFirstByPlatformAndReviewFalseAndDelFalseOrderByVersionNumDesc(String platform);
 }

+ 4 - 4
src/main/java/com/izouma/nineth/web/AppVersionController.java

@@ -79,24 +79,24 @@ public class AppVersionController extends BaseController {
 
     @GetMapping("/checkIosReview")
     public AppVersion checkIosReview(@RequestParam String version) {
-        return appVersionRepo.findByPlatformAndVersion("iOS", version).orElseThrow(new BusinessException("版本不存在"));
+        return appVersionRepo.findByPlatformAndVersionAndDelFalse("iOS", version).orElseThrow(new BusinessException("版本不存在"));
     }
 
     @GetMapping("/checkAndroidReview")
     public AppVersion checkAndroidReview(@RequestParam String version) {
-        return appVersionRepo.findByPlatformAndVersion("Android", version).orElseThrow(new BusinessException("版本不存在"));
+        return appVersionRepo.findByPlatformAndVersionAndDelFalse("Android", version).orElseThrow(new BusinessException("版本不存在"));
     }
 
     @GetMapping("/getVersion")
     public AppVersion checkReview(@RequestParam String platform, @RequestParam String version) {
-        return appVersionRepo.findByPlatformAndVersion(platform, version).orElseThrow(new BusinessException("版本不存在"));
+        return appVersionRepo.findByPlatformAndVersionAndDelFalse(platform, version).orElseThrow(new BusinessException("版本不存在"));
     }
 
     @GetMapping("/checkUpdate")
     @Cacheable(value = "checkUpdate", key = "#platform+'@'+#version")
     public Map<String, Object> checkUpdate(@RequestParam String platform, @RequestParam String version) {
         Map<String, Object> map = new HashMap<>();
-        AppVersion appVersion = appVersionRepo.findFirstByPlatformAndReviewFalseOrderByVersionNumDesc(platform)
+        AppVersion appVersion = appVersionRepo.findFirstByPlatformAndReviewFalseAndDelFalseOrderByVersionNumDesc(platform)
                 .orElseThrow(new BusinessException("版本不存在"));
         map.put("version", appVersion);