新增查询全部用户api
This commit is contained in:
@@ -209,14 +209,14 @@ func GetAllUserInfo(c *gin.Context) {
|
|||||||
var alla []PublicAllInfoResponse
|
var alla []PublicAllInfoResponse
|
||||||
Link()
|
Link()
|
||||||
DB := db.DBsnctf
|
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 {
|
if err != nil {
|
||||||
c.JSON(400, gin.H{"code": 400, "msg": "Get info error!"})
|
c.JSON(400, gin.H{"code": 400, "msg": "Get info error!"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for rows.Next() {
|
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)
|
alla = append(alla, info)
|
||||||
}
|
}
|
||||||
c.JSON(200, gin.H{"code": 200, "data": alla})
|
c.JSON(200, gin.H{"code": 200, "data": alla})
|
||||||
|
Reference in New Issue
Block a user