Example #1
0
func (u *User) UpdateMany(cx *goblet.Context) {
	rec := new(UserModule)
	cx.Fill(rec)
	var err error
	if rec.Name != "" && rec.Pwd != "" {
		var has bool
		if has, err = goblet.DB.Where("name = ? and pwd = ?", rec.Name, rec.Pwd).Get(rec); err == nil && has {
			cx.AddLoginId(rec.Id)
			cx.RespondOK()
		} else {
			cx.RespondWithStatus("用户名或密码错误", http.StatusForbidden)
		}
	} else {
		cx.RespondWithStatus("用户名或密码为空", http.StatusForbidden)
	}

}