修正params
This commit is contained in:
@@ -94,7 +94,7 @@ func SessionsPost(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// 獲取會話
|
||||
func SessionsItemGet(w http.ResponseWriter, r *http.Request) {
|
||||
session := models.Session{ID: mux.Vars(r)["session_id"]}
|
||||
session := models.Session{ID: mux.Vars(r)["id"]}
|
||||
if err := configs.ORMDB().Find(&session).Error; err != nil {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
w.Write([]byte("404 - Not Found"))
|
||||
@@ -106,7 +106,7 @@ func SessionsItemGet(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// 更新會話
|
||||
func SessionsItemPatch(w http.ResponseWriter, r *http.Request) {
|
||||
session := models.Session{ID: mux.Vars(r)["session_id"]}
|
||||
session := models.Session{ID: mux.Vars(r)["id"]}
|
||||
if err := configs.ORMDB().Model(&session).Updates(GetForm(r)).Error; err != nil {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
w.Write([]byte("404 - Not Found"))
|
||||
|
Reference in New Issue
Block a user