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.
34 lines
795 B
34 lines
795 B
package http |
|
|
|
import ( |
|
"go-common/app/interface/openplatform/article/conf" |
|
"go-common/app/service/main/archive/api" |
|
"go-common/library/ecode" |
|
bm "go-common/library/net/http/blademaster" |
|
"go-common/library/net/metadata" |
|
"go-common/library/xstr" |
|
) |
|
|
|
func archives(c *bm.Context) { |
|
var ( |
|
err error |
|
aids []int64 |
|
arcs map[int64]*api.Arc |
|
params = c.Request.Form |
|
ip = metadata.String(c, metadata.RemoteIP) |
|
) |
|
idsStr := params.Get("ids") |
|
if aids, err = xstr.SplitInts(idsStr); err != nil || len(aids) < 1 || len(aids) > conf.Conf.Article.MaxArchives { |
|
c.JSON(nil, ecode.RequestErr) |
|
return |
|
} |
|
if arcs, err = artSrv.Archives(c, aids, ip); err != nil { |
|
c.JSON(nil, err) |
|
return |
|
} |
|
if len(arcs) == 0 { |
|
c.JSON(nil, ecode.NothingFound) |
|
return |
|
} |
|
c.JSON(arcs, err) |
|
}
|
|
|