fix: 修复检测更新 API 使用正确的字段名

- 将 status 字段改为 publish_status
- 将 active 值改为 published
- 确保能正确查询已发布的版本

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 02:54:02 +08:00
parent 1575d32133
commit 97dbd76414
+4 -4
View File
@@ -62,9 +62,9 @@ func handleAppCheckUpdate(c *gin.Context) {
return
}
// 查询该应用的所有版本,按ID降序(创建顺序)
// 查询该应用的所有已发布版本,按ID降序(创建顺序)
var allVersions []model.Version
if err := database.DB.Where("application_id = ? AND status = ?", app.ID, "active").
if err := database.DB.Where("application_id = ? AND publish_status = ?", app.ID, "published").
Order("id DESC").
Preload("Files").
Find(&allVersions).Error; err != nil {
@@ -252,8 +252,8 @@ func handleAppCheckUpdate(c *gin.Context) {
// 检查是否有适合客户端版本的增量更新
// 查找以客户端版本为基础版本的 patch 更新
var patchVersion model.Version
err := database.DB.Where("application_id = ? AND update_type = ? AND base_version_id = ? AND status = ?",
app.ID, "patch", clientVersionRecord.ID, "active").
err := database.DB.Where("application_id = ? AND update_type = ? AND base_version_id = ? AND publish_status = ?",
app.ID, "patch", clientVersionRecord.ID, "published").
Order("id DESC").
Preload("Files").
First(&patchVersion).Error