代码拉取完成,页面将自动刷新
package api
import (
"github.com/emicklei/go-restful/v3"
"github.com/infraboard/mcube/http/response"
"gitee.com/talk-about-articles/keyauth-tz/apps/role"
)
func (h *handler) CreateRole(r *restful.Request, w *restful.Response) {
req := role.NewCreateRoleRequest()
if err := r.ReadEntity(req); err != nil {
response.Failed(w.ResponseWriter, err)
return
}
set, err := h.service.CreateRole(r.Request.Context(), req)
if err != nil {
response.Failed(w.ResponseWriter, err)
return
}
response.Success(w.ResponseWriter, set)
}
func (h *handler) QueryRole(r *restful.Request, w *restful.Response) {
req := role.NewQueryRoleRequestFromHTTP(r.Request)
set, err := h.service.QueryRole(r.Request.Context(), req)
if err != nil {
response.Failed(w.ResponseWriter, err)
return
}
response.Success(w.ResponseWriter, set)
}
//func (h *handler) DescribeRole(r *restful.Request, w *restful.Response) {
// req := role.NewDescribeRoleRequest(r.PathParameter("id"))
// ins, err := h.service.DescribeRole(r.Request.Context(), req)
// if err != nil {
// response.Failed(w.ResponseWriter, err)
// return
// }
//
// response.Success(w.ResponseWriter, ins)
//}
//
//func (h *handler) UpdateRole(r *restful.Request, w *restful.Response) {
// req := role.NewPutRoleRequest(r.PathParameter("id"))
//
// if err := r.ReadEntity(req.Data); err != nil {
// response.Failed(w.ResponseWriter, err)
// return
// }
//
// set, err := h.service.UpdateRole(r.Request.Context(), req)
// if err != nil {
// response.Failed(w.ResponseWriter, err)
// return
// }
// response.Success(w.ResponseWriter, set)
//}
//
//func (h *handler) PatchRole(r *restful.Request, w *restful.Response) {
// req := role.NewPatchRoleRequest(r.PathParameter("id"))
//
// if err := r.ReadEntity(req.Data); err != nil {
// response.Failed(w.ResponseWriter, err)
// return
// }
//
// set, err := h.service.UpdateRole(r.Request.Context(), req)
// if err != nil {
// response.Failed(w.ResponseWriter, err)
// return
// }
// response.Success(w.ResponseWriter, set)
//}
//
//func (h *handler) DeleteRole(r *restful.Request, w *restful.Response) {
// req := role.NewDeleteRoleRequestWithID(r.PathParameter("id"))
// set, err := h.service.DeleteRole(r.Request.Context(), req)
// if err != nil {
// response.Failed(w.ResponseWriter, err)
// return
// }
// response.Success(w.ResponseWriter, set)
//}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。