增加获取patch接口,未测试
This commit is contained in:
@@ -1,13 +1,25 @@
|
||||
package com.mir4updater.backend.controller.apk;
|
||||
|
||||
import com.mir4updater.backend.entity.PatchFileInfo;
|
||||
import com.mir4updater.backend.result.Result;
|
||||
import com.mir4updater.backend.service.DiffPathService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class CheckPatchController {
|
||||
public static Logger logger = LogManager.getLogger(CheckPatchController.class);
|
||||
|
||||
@Autowired
|
||||
DiffPathService diffPathService;
|
||||
|
||||
@GetMapping("/android/check_patch")
|
||||
public Result checkPatch(@RequestParam("pkg") String pkg, @RequestParam(value = "version_code") Long versionCode) {
|
||||
PatchFileInfo patchFileInfo = diffPathService.getPatchInfo(pkg, versionCode);
|
||||
return Result.success(patchFileInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class PatchFileInfo implements Serializable {
|
||||
String packageName;
|
||||
|
||||
@Column(name = "old_version", nullable = false)
|
||||
long old_version;
|
||||
long oldVersion;
|
||||
|
||||
@Column(name = "old_md5", nullable = false)
|
||||
String old_md5;
|
||||
@@ -32,7 +32,7 @@ public class PatchFileInfo implements Serializable {
|
||||
String old_sha256;
|
||||
|
||||
@Column(name = "new_version", nullable = false)
|
||||
long new_version;
|
||||
long newVersion;
|
||||
|
||||
@Column(name = "new_md5", nullable = false)
|
||||
String new_md5;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.mir4updater.backend.repository;
|
||||
|
||||
import com.mir4updater.backend.entity.ApkInfo;
|
||||
import com.mir4updater.backend.entity.PatchFileInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
//public class PatchInfoRepository extends JpaRepository<ApkInfo, Long> {
|
||||
//}
|
||||
public interface PatchInfoRepository extends JpaRepository<PatchFileInfo, Long> {
|
||||
public PatchFileInfo findPatchFileInfoByPackageNameAndOldVersion(String packageName, Long version);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
package com.mir4updater.backend.service;
|
||||
|
||||
import com.mir4updater.backend.entity.PatchFileInfo;
|
||||
import com.mir4updater.backend.repository.PatchInfoRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class DiffPathService {
|
||||
@Autowired
|
||||
PatchInfoRepository patchInfoRepository;
|
||||
|
||||
public PatchFileInfo getPatchInfo(String packageName, Long oldVersion) {
|
||||
return patchInfoRepository.findPatchFileInfoByPackageNameAndOldVersion(packageName, oldVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user