Schiavo is like a son with a down syndrome.
You love him, like every child you have, but you have to accept the fact that he's fucking down, and so he's completely retarded and makes everything the wrong way. Also, in this commit: set_status is now no more fucking retarded, as in it actually returns the beatmap it was requested, and some minor things.
This commit is contained in:
parent
4be5948d97
commit
e858ed94bc
|
@ -2,6 +2,8 @@ package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"git.zxq.co/ripple/rippleapi/common"
|
"git.zxq.co/ripple/rippleapi/common"
|
||||||
)
|
)
|
||||||
|
@ -82,9 +84,32 @@ func BeatmapSetStatusPOST(md common.MethodData) common.CodeMessager {
|
||||||
SET ranked = ?, ranked_status_freezed = ?
|
SET ranked = ?, ranked_status_freezed = ?
|
||||||
WHERE beatmapset_id = ?`, req.RankedStatus, req.Frozen, param)
|
WHERE beatmapset_id = ?`, req.RankedStatus, req.Frozen, param)
|
||||||
|
|
||||||
|
var x = make(map[string]interface{}, 1)
|
||||||
|
if req.BeatmapID != 0 {
|
||||||
|
x["bb"] = req.BeatmapID
|
||||||
|
} else {
|
||||||
|
x["s"] = req.BeatmapsetID
|
||||||
|
}
|
||||||
|
md.C.Request.URL = genURL(x)
|
||||||
return getMultipleBeatmaps(md)
|
return getMultipleBeatmaps(md)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func genURL(d map[string]interface{}) *url.URL {
|
||||||
|
var s string
|
||||||
|
for k, v := range d {
|
||||||
|
if s != "" {
|
||||||
|
s += "&"
|
||||||
|
}
|
||||||
|
s += k + "=" + url.QueryEscape(fmt.Sprintf("%v", v))
|
||||||
|
}
|
||||||
|
u := new(url.URL)
|
||||||
|
if len(d) == 0 {
|
||||||
|
return u
|
||||||
|
}
|
||||||
|
u.RawQuery = s
|
||||||
|
return u
|
||||||
|
}
|
||||||
|
|
||||||
// BeatmapGET retrieves a beatmap.
|
// BeatmapGET retrieves a beatmap.
|
||||||
func BeatmapGET(md common.MethodData) common.CodeMessager {
|
func BeatmapGET(md common.MethodData) common.CodeMessager {
|
||||||
beatmapID := common.Int(md.Query("b"))
|
beatmapID := common.Int(md.Query("b"))
|
||||||
|
@ -124,7 +149,9 @@ func getMultipleBeatmaps(md common.MethodData) common.CodeMessager {
|
||||||
Default: "id DESC",
|
Default: "id DESC",
|
||||||
Table: "beatmaps",
|
Table: "beatmaps",
|
||||||
})
|
})
|
||||||
where := common.Where("beatmapset_id = ?", md.Query("s")).
|
where := common.
|
||||||
|
Where("beatmap_id = ?", md.Query("bb")).
|
||||||
|
Where("beatmapset_id = ?", md.Query("s")).
|
||||||
Where("song_name = ?", md.Query("song_name")).
|
Where("song_name = ?", md.Query("song_name")).
|
||||||
Where("ranked_status_freezed = ?", md.Query("ranked_status_frozen"), "0", "1")
|
Where("ranked_status_freezed = ?", md.Query("ranked_status_frozen"), "0", "1")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user