go-common/app/admin/main/up-rating/http/authority.go

39 lines
775 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package http
import (
"go-common/library/log"
"go-common/library/net/http/blademaster"
)
func addAuthority(c *blademaster.Context) {
v := new(struct {
MIDS []int64 `form:"mids,split" validate:"required"`
})
if err := c.Bind(v); err != nil {
return
}
num, err := svr.AddAuthority(c, v.MIDS)
if err != nil {
log.Error("svr.AddAuthority error(%v) arg(%v)", err, v)
c.JSON(nil, err)
return
}
c.JSON(num, nil)
}
func removeAuthority(c *blademaster.Context) {
v := new(struct {
MIDS []int64 `form:"mids,split" validate:"required"`
})
if err := c.Bind(v); err != nil {
return
}
num, err := svr.RemoveAuthority(c, v.MIDS)
if err != nil {
log.Error("svr.RemoveAuthority error(%v) arg(%v)", err, v)
c.JSON(nil, err)
return
}
c.JSON(num, nil)
}