新增查询全部用户api
This commit is contained in:
@@ -209,14 +209,14 @@ func GetAllUserInfo(c *gin.Context) {
|
||||
var alla []PublicAllInfoResponse
|
||||
Link()
|
||||
DB := db.DBsnctf
|
||||
rows, err := DB.Debug().Select([]string{"id", "username", "affiliation", "country", "website", "hidden"}).Table("user").Rows()
|
||||
rows, err := DB.Debug().Select([]string{"id", "username", "affiliation", "country", "website"}).Table("user").Where("hidden = ?", 0).Rows()
|
||||
|
||||
if err != nil {
|
||||
c.JSON(400, gin.H{"code": 400, "msg": "Get info error!"})
|
||||
return
|
||||
}
|
||||
for rows.Next() {
|
||||
rows.Scan(&info.Id, &info.Username, &info.Affiliation, &info.Country, &info.Website, &info.Hidden)
|
||||
rows.Scan(&info.Id, &info.Username, &info.Affiliation, &info.Country, &info.Website)
|
||||
alla = append(alla, info)
|
||||
}
|
||||
c.JSON(200, gin.H{"code": 200, "data": alla})
|
||||
|
Reference in New Issue
Block a user