bilibili-backup/app/service/video/stream-mng/server/http/clear-cache.go
2019-04-22 02:59:20 +00:00

33 lines
755 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package http
import (
"go-common/library/ecode"
bm "go-common/library/net/http/blademaster"
"strconv"
)
// clearRoomCacheByRID删除room_id缓存的接口防止缓存问题出现的bug
func clearRoomCacheByRID(c *bm.Context) {
params := c.Request.URL.Query()
room := params.Get("room_id")
roomID, err := strconv.ParseInt(room, 10, 64)
if err != nil || roomID <= 0 {
c.Set("output_data", "room_id is empty")
c.JSONMap(map[string]interface{}{"message": "room_id is empty"}, ecode.RequestErr)
c.Abort()
return
}
err = srv.ClearRoomCacheByRID(c, roomID)
if err != nil {
c.JSONMap(map[string]interface{}{"message": err.Error()}, ecode.RequestErr)
c.Abort()
return
}
c.JSONMap(map[string]interface{}{"message": "ok"}, nil)
}