mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 10:58:35 +08:00
【更新】更新
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
entity "pandax/apps/system/entity"
|
||||
services "pandax/apps/system/services"
|
||||
"pandax/base/casbin"
|
||||
"pandax/base/ctx"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
"strconv"
|
||||
@@ -23,7 +22,7 @@ type SystemApiApi struct {
|
||||
// @Param data body entity.SysApi true "api路径, api中文描述, api组, 方法"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /system/api [post]
|
||||
func (s *SystemApiApi) CreateApi(rc *ctx.ReqCtx) {
|
||||
func (s *SystemApiApi) CreateApi(rc *ginx.ReqCtx) {
|
||||
var api entity.SysApi
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &api)
|
||||
log.Println(api)
|
||||
@@ -37,7 +36,7 @@ func (s *SystemApiApi) CreateApi(rc *ctx.ReqCtx) {
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /system/api/{id} [delete]
|
||||
func (s *SystemApiApi) DeleteApi(rc *ctx.ReqCtx) {
|
||||
func (s *SystemApiApi) DeleteApi(rc *ginx.ReqCtx) {
|
||||
ids := rc.GinCtx.Param("id")
|
||||
s.ApiApp.Delete(utils.IdsStrToIdsIntGroup(ids))
|
||||
}
|
||||
@@ -55,7 +54,7 @@ func (s *SystemApiApi) DeleteApi(rc *ctx.ReqCtx) {
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /system/api/list [get]
|
||||
func (s *SystemApiApi) GetApiList(rc *ctx.ReqCtx) {
|
||||
func (s *SystemApiApi) GetApiList(rc *ginx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
path := rc.GinCtx.Query("path")
|
||||
@@ -80,7 +79,7 @@ func (s *SystemApiApi) GetApiList(rc *ctx.ReqCtx) {
|
||||
// @Param id path int true "根据id获取api"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /system/api/{id} [get]
|
||||
func (s *SystemApiApi) GetApiById(rc *ctx.ReqCtx) {
|
||||
func (s *SystemApiApi) GetApiById(rc *ginx.ReqCtx) {
|
||||
id := ginx.QueryInt(rc.GinCtx, "id", 0)
|
||||
rc.ResData = s.ApiApp.FindOne(int64(id))
|
||||
|
||||
@@ -94,7 +93,7 @@ func (s *SystemApiApi) GetApiById(rc *ctx.ReqCtx) {
|
||||
// @Param data body entity.SysApi true "api路径, api中文描述, api组, 方法"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
// @Router /api/api [put]
|
||||
func (s *SystemApiApi) UpdateApi(rc *ctx.ReqCtx) {
|
||||
func (s *SystemApiApi) UpdateApi(rc *ginx.ReqCtx) {
|
||||
var api entity.SysApi
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &api)
|
||||
s.ApiApp.Update(api)
|
||||
@@ -107,7 +106,7 @@ func (s *SystemApiApi) UpdateApi(rc *ctx.ReqCtx) {
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /system/api/all [get]
|
||||
func (s *SystemApiApi) GetAllApis(rc *ctx.ReqCtx) {
|
||||
func (s *SystemApiApi) GetAllApis(rc *ginx.ReqCtx) {
|
||||
rc.ResData = s.ApiApp.FindList(entity.SysApi{})
|
||||
}
|
||||
|
||||
@@ -119,7 +118,7 @@ func (s *SystemApiApi) GetAllApis(rc *ctx.ReqCtx) {
|
||||
// @Param roleKey query string true "权限id, 权限模型列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /casbin/getPolicyPathByRoleId [get]
|
||||
func (s *SystemApiApi) GetPolicyPathByRoleId(rc *ctx.ReqCtx) {
|
||||
func (s *SystemApiApi) GetPolicyPathByRoleId(rc *ginx.ReqCtx) {
|
||||
roleKey := rc.GinCtx.Query("roleKey")
|
||||
tenantId := strconv.Itoa(int(rc.LoginAccount.TenantId))
|
||||
rc.ResData = casbin.GetPolicyPathByRoleId(tenantId, roleKey)
|
||||
|
||||
Reference in New Issue
Block a user