查询时出现301 Moved Permanently
//为什么在路由id为1和2时 返回的状态码是 301 Moved Permanently 而id在3和之后的则正常
type User struct {
Id int
Username string
}
func (User) TabkeName() string {
return "user"
}
func GetUserTest(id int) (User, error) {
var user User
err := dao.Db.Where("id = ?", id).First(&user).Error
return user, err
}