fix: align admin behavior and Kratos integrations

This commit is contained in:
2026-08-14 14:14:51 +08:00
parent 8c4c6ba661
commit e0b0e1d8c8
123 changed files with 4334 additions and 1877 deletions
+14 -5
View File
@@ -23,7 +23,7 @@ func (h *Version) Delete(c *gin.Context) {
httpx.Fail(c, "删除失败")
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "删除成功")
}
func (h *Version) DeleteMany(c *gin.Context) {
raw := c.QueryArray("IDs[]")
@@ -36,7 +36,7 @@ func (h *Version) DeleteMany(c *gin.Context) {
httpx.Fail(c, "删除失败")
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "批量删除成功")
}
func (h *Version) Find(c *gin.Context) {
id, _ := strconv.ParseUint(c.Query("ID"), 10, 64)
@@ -49,7 +49,16 @@ func (h *Version) Find(c *gin.Context) {
}
func (h *Version) List(c *gin.Context) {
p, size := page(c)
items, total, err := h.service.Versions(c.Request.Context(), p, size, c.Query("versionName"), c.Query("versionCode"))
createdAtRange := make([]*time.Time, 0, 2)
for _, raw := range c.QueryArray("createdAtRange[]") {
value, parseErr := parseTime(raw)
if parseErr != nil {
httpx.Fail(c, parseErr.Error())
return
}
createdAtRange = append(createdAtRange, value)
}
items, total, err := h.service.Versions(c.Request.Context(), p, size, c.Query("versionName"), c.Query("versionCode"), createdAtRange)
if err != nil {
httpx.Fail(c, "获取失败")
return
@@ -66,7 +75,7 @@ func (h *Version) Export(c *gin.Context) {
httpx.Fail(c, "创建发版失败:"+err.Error())
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "创建发版成功")
}
func (h *Version) Download(c *gin.Context) {
id, _ := strconv.ParseUint(c.Query("ID"), 10, 64)
@@ -89,5 +98,5 @@ func (h *Version) Import(c *gin.Context) {
httpx.Fail(c, "导入失败:"+err.Error())
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "导入成功")
}