You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
789 B
38 lines
789 B
package http |
|
|
|
import ( |
|
"strconv" |
|
|
|
artmdl "go-common/app/interface/openplatform/article/model" |
|
bm "go-common/library/net/http/blademaster" |
|
"go-common/library/net/metadata" |
|
) |
|
|
|
func rankCategories(c *bm.Context) { |
|
c.JSON(artSrv.RankCategories(c), nil) |
|
} |
|
|
|
func ranks(c *bm.Context) { |
|
var ( |
|
request = c.Request |
|
params = request.Form |
|
cid, mid int64 |
|
) |
|
cid, _ = strconv.ParseInt(params.Get("cid"), 10, 64) |
|
if midInter, ok := c.Get("mid"); ok { |
|
mid = midInter.(int64) |
|
} |
|
data, note, err := artSrv.Ranks(c, cid, mid, metadata.String(c, metadata.RemoteIP)) |
|
if err != nil { |
|
c.JSON(nil, err) |
|
return |
|
} |
|
if data == nil { |
|
data = []*artmdl.RankMeta{} |
|
} |
|
res := make(map[string]interface{}) |
|
res["data"] = data |
|
res["note"] = note |
|
res["message"] = "ok" |
|
c.JSONMap(res, nil) |
|
}
|
|
|