123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package authority
- import (
- "net/http"
- "github.com/zeromicro/go-zero/rest/httpx"
- "github.com/suyuan32/simple-admin-core/api/internal/logic/authority"
- "github.com/suyuan32/simple-admin-core/api/internal/svc"
- "github.com/suyuan32/simple-admin-core/api/internal/types"
- )
- // swagger:route post /authority/api/role authority GetApiAuthority
- //
- // Get role's API authorization list | 获取角色api权限列表
- //
- // Get role's API authorization list | 获取角色api权限列表
- //
- // Parameters:
- // + name: body
- // require: true
- // in: body
- // type: IDReq
- //
- // Responses:
- // 200: ApiAuthorityListResp
- func GetApiAuthorityHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req types.IDReq
- if err := httpx.Parse(r, &req, true); err != nil {
- httpx.ErrorCtx(r.Context(), w, err)
- return
- }
- l := authority.NewGetApiAuthorityLogic(r.Context(), svcCtx)
- resp, err := l.GetApiAuthority(&req)
- if err != nil {
- err = svcCtx.Trans.TransError(r.Context(), err)
- httpx.ErrorCtx(r.Context(), w, err)
- } else {
- httpx.OkJsonCtx(r.Context(), w, resp)
- }
- }
- }
|