🐛 Fix query statement in shuffle

This commit is contained in:
LittleSheep 2024-07-24 14:37:21 +08:00
parent 1925f26f16
commit 2f8f799926

View File

@ -6,7 +6,6 @@ import (
"git.solsynth.dev/hydrogen/interactive/pkg/internal/database" "git.solsynth.dev/hydrogen/interactive/pkg/internal/database"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/services" "git.solsynth.dev/hydrogen/interactive/pkg/internal/services"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"gorm.io/gorm"
) )
func listRecommendationDefault(c *fiber.Ctx) error { func listRecommendationDefault(c *fiber.Ctx) error {
@ -64,7 +63,7 @@ func listRecommendationShuffle(c *fiber.Ctx) error {
return fiber.NewError(fiber.StatusInternalServerError, err.Error()) return fiber.NewError(fiber.StatusInternalServerError, err.Error())
} }
items, err := services.ListPost(tx, take, offset, gorm.Expr("RANDOM()")) items, err := services.ListPost(tx, take, offset, "RANDOM()")
if err != nil { if err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error()) return fiber.NewError(fiber.StatusBadRequest, err.Error())
} }