🐛 Fix batch get userinfo
This commit is contained in:
parent
c51af61820
commit
817c573048
@ -38,8 +38,10 @@ func getOtherUserinfo(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getOtherUserinfoBatch(c *fiber.Ctx) error {
|
func getOtherUserinfoBatch(c *fiber.Ctx) error {
|
||||||
idSet := strings.Split(c.Query("id"), ",")
|
idFilter := c.Query("id")
|
||||||
nameSet := strings.Split(c.Query("name"), ",")
|
nameFilter := c.Query("name")
|
||||||
|
idSet := strings.Split(idFilter, ",")
|
||||||
|
nameSet := strings.Split(nameFilter, ",")
|
||||||
if len(idSet) == 0 && len(nameSet) == 0 {
|
if len(idSet) == 0 && len(nameSet) == 0 {
|
||||||
return fiber.NewError(fiber.StatusBadRequest, "query filter is required")
|
return fiber.NewError(fiber.StatusBadRequest, "query filter is required")
|
||||||
}
|
}
|
||||||
@ -49,10 +51,10 @@ func getOtherUserinfoBatch(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tx := database.C.Model(&models.Account{}).Limit(100)
|
tx := database.C.Model(&models.Account{}).Limit(100)
|
||||||
if len(idSet) > 0 {
|
if len(idFilter) > 0 {
|
||||||
tx = tx.Where("id IN ?", idSet)
|
tx = tx.Where("id IN ?", idSet)
|
||||||
}
|
}
|
||||||
if len(nameSet) > 0 {
|
if len(nameFilter) > 0 {
|
||||||
tx = tx.Where("name IN ?", nameSet)
|
tx = tx.Where("name IN ?", nameSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user