Beispiel #1
0
// Remove user from the sub group
func rm_user_sub(w http.ResponseWriter, r *http.Request, uu *user) {
	glog.Info("rm a user from a sub.")
	sm := new(define.Sub_map)
	r.ParseForm()
	sm.Sub_id = r.FormValue("sub_id")
	sm.User_id = r.FormValue("user_id")
	if err := store.Manager.DelUserFromSub(sm, uu.ID); err != nil {
		glog.Errorf("Del the user o error:%v\n", err)
		badReaquest(w, `{"status":"fail"}`)
	} else {
		uu.isOK = true
		io.WriteString(w, `{"status":"success"}`)
	}
}
Beispiel #2
0
// Add use into msg's sub group
func user_sub(w http.ResponseWriter, r *http.Request, uu *user) {
	glog.Info("Del a user sub.")
	sm := new(define.Sub_map)
	r.ParseForm()
	sm.Sub_id = r.FormValue("sub_id")
	sm.User_id = r.FormValue("user_id")
	// Write the response
	if err := store.Manager.AddUserToSub(sm, uu.ID); err != nil {
		glog.Errorf("Store the sub_map error:", err)
		badReaquest(w, `{"status":"fail"}`)
	} else {
		uu.isOK = true
		io.WriteString(w, `{"status":"success"}`)
	}
}