mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-24 03:18:35 +08:00
[优化]base模块提出
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/casbin"
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
"log"
|
||||
entity "pandax/apps/system/entity"
|
||||
services "pandax/apps/system/services"
|
||||
"pandax/base/casbin"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@@ -22,9 +22,9 @@ 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 *ginx.ReqCtx) {
|
||||
func (s *SystemApiApi) CreateApi(rc *restfulx.ReqCtx) {
|
||||
var api entity.SysApi
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &api)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &api)
|
||||
log.Println(api)
|
||||
s.ApiApp.Insert(api)
|
||||
}
|
||||
@@ -36,7 +36,7 @@ func (s *SystemApiApi) CreateApi(rc *ginx.ReqCtx) {
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /system/api/{id} [delete]
|
||||
func (s *SystemApiApi) DeleteApi(rc *ginx.ReqCtx) {
|
||||
func (s *SystemApiApi) DeleteApi(rc *restfulx.ReqCtx) {
|
||||
ids := rc.GinCtx.Param("id")
|
||||
s.ApiApp.Delete(utils.IdsStrToIdsIntGroup(ids))
|
||||
}
|
||||
@@ -54,9 +54,9 @@ func (s *SystemApiApi) DeleteApi(rc *ginx.ReqCtx) {
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /system/api/list [get]
|
||||
func (s *SystemApiApi) GetApiList(rc *ginx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
func (s *SystemApiApi) GetApiList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
path := rc.GinCtx.Query("path")
|
||||
description := rc.GinCtx.Query("description")
|
||||
method := rc.GinCtx.Query("method")
|
||||
@@ -79,8 +79,8 @@ func (s *SystemApiApi) GetApiList(rc *ginx.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 *ginx.ReqCtx) {
|
||||
id := ginx.QueryInt(rc.GinCtx, "id", 0)
|
||||
func (s *SystemApiApi) GetApiById(rc *restfulx.ReqCtx) {
|
||||
id := restfulx.QueryInt(rc.GinCtx, "id", 0)
|
||||
rc.ResData = s.ApiApp.FindOne(int64(id))
|
||||
|
||||
}
|
||||
@@ -93,9 +93,9 @@ func (s *SystemApiApi) GetApiById(rc *ginx.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 *ginx.ReqCtx) {
|
||||
func (s *SystemApiApi) UpdateApi(rc *restfulx.ReqCtx) {
|
||||
var api entity.SysApi
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &api)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &api)
|
||||
s.ApiApp.Update(api)
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ func (s *SystemApiApi) UpdateApi(rc *ginx.ReqCtx) {
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /system/api/all [get]
|
||||
func (s *SystemApiApi) GetAllApis(rc *ginx.ReqCtx) {
|
||||
func (s *SystemApiApi) GetAllApis(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = s.ApiApp.FindList(entity.SysApi{})
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ func (s *SystemApiApi) GetAllApis(rc *ginx.ReqCtx) {
|
||||
// @Param roleKey query string true "权限id, 权限模型列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /casbin/getPolicyPathByRoleId [get]
|
||||
func (s *SystemApiApi) GetPolicyPathByRoleId(rc *ginx.ReqCtx) {
|
||||
func (s *SystemApiApi) GetPolicyPathByRoleId(rc *restfulx.ReqCtx) {
|
||||
roleKey := rc.GinCtx.Query("roleKey")
|
||||
tenantId := strconv.Itoa(int(rc.LoginAccount.TenantId))
|
||||
rc.ResData = casbin.GetPolicyPathByRoleId(tenantId, roleKey)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
entity "pandax/apps/system/entity"
|
||||
services "pandax/apps/system/services"
|
||||
"pandax/base/biz"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
)
|
||||
|
||||
type ConfigApi struct {
|
||||
@@ -23,9 +23,9 @@ type ConfigApi struct {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/config [get]
|
||||
// @Security
|
||||
func (p *ConfigApi) GetConfigList(rc *ginx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
func (p *ConfigApi) GetConfigList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
configName := rc.GinCtx.Query("configName")
|
||||
configKey := rc.GinCtx.Query("configKey")
|
||||
configType := rc.GinCtx.Query("configType")
|
||||
@@ -47,7 +47,7 @@ func (p *ConfigApi) GetConfigList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/config/configKey [get]
|
||||
// @Security
|
||||
func (p *ConfigApi) GetConfigListByKey(rc *ginx.ReqCtx) {
|
||||
func (p *ConfigApi) GetConfigListByKey(rc *restfulx.ReqCtx) {
|
||||
configKey := rc.GinCtx.Query("configKey")
|
||||
biz.IsTrue(configKey != "", "请传入配置Key")
|
||||
rc.ResData = p.ConfigApp.FindList(entity.SysConfig{ConfigKey: configKey})
|
||||
@@ -60,8 +60,8 @@ func (p *ConfigApi) GetConfigListByKey(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/config/{configId} [get]
|
||||
// @Security
|
||||
func (p *ConfigApi) GetConfig(rc *ginx.ReqCtx) {
|
||||
id := ginx.PathParamInt(rc.GinCtx, "configId")
|
||||
func (p *ConfigApi) GetConfig(rc *restfulx.ReqCtx) {
|
||||
id := restfulx.PathParamInt(rc.GinCtx, "configId")
|
||||
p.ConfigApp.FindOne(int64(id))
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ func (p *ConfigApi) GetConfig(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/config [post]
|
||||
// @Security X-TOKEN
|
||||
func (p *ConfigApi) InsertConfig(rc *ginx.ReqCtx) {
|
||||
func (p *ConfigApi) InsertConfig(rc *restfulx.ReqCtx) {
|
||||
var config entity.SysConfig
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &config)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &config)
|
||||
|
||||
p.ConfigApp.Insert(config)
|
||||
}
|
||||
@@ -92,9 +92,9 @@ func (p *ConfigApi) InsertConfig(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/config [put]
|
||||
// @Security X-TOKEN
|
||||
func (p *ConfigApi) UpdateConfig(rc *ginx.ReqCtx) {
|
||||
func (p *ConfigApi) UpdateConfig(rc *restfulx.ReqCtx) {
|
||||
var post entity.SysConfig
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &post)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &post)
|
||||
p.ConfigApp.Update(post)
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ func (p *ConfigApi) UpdateConfig(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/config/{configId} [delete]
|
||||
func (p *ConfigApi) DeleteConfig(rc *ginx.ReqCtx) {
|
||||
func (p *ConfigApi) DeleteConfig(rc *restfulx.ReqCtx) {
|
||||
configId := rc.GinCtx.Param("configId")
|
||||
p.ConfigApp.Delete(utils.IdsStrToIdsIntGroup(configId))
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ package api
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
entity "pandax/apps/system/entity"
|
||||
services "pandax/apps/system/services"
|
||||
"pandax/base/biz"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
"pandax/apps/system/entity"
|
||||
"pandax/apps/system/services"
|
||||
"pandax/pkg/global"
|
||||
)
|
||||
|
||||
@@ -25,8 +25,8 @@ type DeptApi struct {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuTreRoleSelect/{roleId} [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *DeptApi) GetDeptTreeRoleSelect(rc *ginx.ReqCtx) {
|
||||
roleId := ginx.PathParamInt(rc.GinCtx, "roleId")
|
||||
func (m *DeptApi) GetDeptTreeRoleSelect(rc *restfulx.ReqCtx) {
|
||||
roleId := restfulx.PathParamInt(rc.GinCtx, "roleId")
|
||||
var dept entity.SysDept
|
||||
if !IsTenantAdmin(rc.LoginAccount.TenantId) {
|
||||
dept.TenantId = rc.LoginAccount.TenantId
|
||||
@@ -52,12 +52,12 @@ func (m *DeptApi) GetDeptTreeRoleSelect(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dept/deptList [get]
|
||||
// @Security
|
||||
func (a *DeptApi) GetDeptList(rc *ginx.ReqCtx) {
|
||||
//pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
//pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
func (a *DeptApi) GetDeptList(rc *restfulx.ReqCtx) {
|
||||
//pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
//pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
deptName := rc.GinCtx.Query("deptName")
|
||||
status := rc.GinCtx.Query("status")
|
||||
deptId := ginx.QueryInt(rc.GinCtx, "deptId", 0)
|
||||
deptId := restfulx.QueryInt(rc.GinCtx, "deptId", 0)
|
||||
dept := entity.SysDept{DeptName: deptName, Status: status, DeptId: int64(deptId)}
|
||||
if !IsTenantAdmin(rc.LoginAccount.TenantId) {
|
||||
dept.TenantId = rc.LoginAccount.TenantId
|
||||
@@ -75,7 +75,7 @@ func (a *DeptApi) GetDeptList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dept/ordinaryDeptLis [get]
|
||||
// @Security
|
||||
func (a *DeptApi) GetOrdinaryDeptList(rc *ginx.ReqCtx) {
|
||||
func (a *DeptApi) GetOrdinaryDeptList(rc *restfulx.ReqCtx) {
|
||||
var dept entity.SysDept
|
||||
if !IsTenantAdmin(rc.LoginAccount.TenantId) {
|
||||
dept.TenantId = rc.LoginAccount.TenantId
|
||||
@@ -93,10 +93,10 @@ func (a *DeptApi) GetOrdinaryDeptList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dept/deptTree [get]
|
||||
// @Security
|
||||
func (a *DeptApi) GetDeptTree(rc *ginx.ReqCtx) {
|
||||
func (a *DeptApi) GetDeptTree(rc *restfulx.ReqCtx) {
|
||||
deptName := rc.GinCtx.Query("deptName")
|
||||
status := rc.GinCtx.Query("status")
|
||||
deptId := ginx.QueryInt(rc.GinCtx, "deptId", 0)
|
||||
deptId := restfulx.QueryInt(rc.GinCtx, "deptId", 0)
|
||||
dept := entity.SysDept{DeptName: deptName, Status: status, DeptId: int64(deptId)}
|
||||
if !IsTenantAdmin(rc.LoginAccount.TenantId) {
|
||||
dept.TenantId = rc.LoginAccount.TenantId
|
||||
@@ -111,8 +111,8 @@ func (a *DeptApi) GetDeptTree(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dept/{deptId} [get]
|
||||
// @Security
|
||||
func (a *DeptApi) GetDept(rc *ginx.ReqCtx) {
|
||||
deptId := ginx.PathParamInt(rc.GinCtx, "deptId")
|
||||
func (a *DeptApi) GetDept(rc *restfulx.ReqCtx) {
|
||||
deptId := restfulx.PathParamInt(rc.GinCtx, "deptId")
|
||||
rc.ResData = a.DeptApp.FindOne(int64(deptId))
|
||||
}
|
||||
|
||||
@@ -126,10 +126,10 @@ func (a *DeptApi) GetDept(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dept [post]
|
||||
// @Security Bearer
|
||||
func (a *DeptApi) InsertDept(rc *ginx.ReqCtx) {
|
||||
func (a *DeptApi) InsertDept(rc *restfulx.ReqCtx) {
|
||||
var dept entity.SysDept
|
||||
g := rc.GinCtx
|
||||
ginx.BindJsonAndValid(g, &dept)
|
||||
restfulx.BindJsonAndValid(g, &dept)
|
||||
dept.TenantId = rc.LoginAccount.TenantId
|
||||
dept.CreateBy = rc.LoginAccount.UserName
|
||||
a.DeptApp.Insert(dept)
|
||||
@@ -145,10 +145,10 @@ func (a *DeptApi) InsertDept(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /system/dept [put]
|
||||
// @Security Bearer
|
||||
func (a *DeptApi) UpdateDept(rc *ginx.ReqCtx) {
|
||||
func (a *DeptApi) UpdateDept(rc *restfulx.ReqCtx) {
|
||||
var dept entity.SysDept
|
||||
g := rc.GinCtx
|
||||
ginx.BindJsonAndValid(g, &dept)
|
||||
restfulx.BindJsonAndValid(g, &dept)
|
||||
|
||||
dept.UpdateBy = rc.LoginAccount.UserName
|
||||
a.DeptApp.Update(dept)
|
||||
@@ -161,7 +161,7 @@ func (a *DeptApi) UpdateDept(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dept/{deptId} [delete]
|
||||
func (a *DeptApi) DeleteDept(rc *ginx.ReqCtx) {
|
||||
func (a *DeptApi) DeleteDept(rc *restfulx.ReqCtx) {
|
||||
deptId := rc.GinCtx.Param("deptId")
|
||||
deptIds := utils.IdsStrToIdsIntGroup(deptId)
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
entity "pandax/apps/system/entity"
|
||||
services "pandax/apps/system/services"
|
||||
"pandax/base/biz"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
"pandax/pkg/global"
|
||||
)
|
||||
|
||||
@@ -26,9 +26,9 @@ type DictApi struct {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/type/list [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictTypeList(rc *ginx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
func (p *DictApi) GetDictTypeList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
status := rc.GinCtx.Query("status")
|
||||
dictName := rc.GinCtx.Query("dictName")
|
||||
dictType := rc.GinCtx.Query("dictType")
|
||||
@@ -49,8 +49,8 @@ func (p *DictApi) GetDictTypeList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/type/{dictId} [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictType(rc *ginx.ReqCtx) {
|
||||
dictId := ginx.PathParamInt(rc.GinCtx, "dictId")
|
||||
func (p *DictApi) GetDictType(rc *restfulx.ReqCtx) {
|
||||
dictId := restfulx.PathParamInt(rc.GinCtx, "dictId")
|
||||
p.DictType.FindOne(int64(dictId))
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ func (p *DictApi) GetDictType(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/type [post]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) InsertDictType(rc *ginx.ReqCtx) {
|
||||
func (p *DictApi) InsertDictType(rc *restfulx.ReqCtx) {
|
||||
var dict entity.SysDictType
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &dict)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &dict)
|
||||
|
||||
dict.CreateBy = rc.LoginAccount.UserName
|
||||
p.DictType.Insert(dict)
|
||||
@@ -82,9 +82,9 @@ func (p *DictApi) InsertDictType(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/type [put]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) UpdateDictType(rc *ginx.ReqCtx) {
|
||||
func (p *DictApi) UpdateDictType(rc *restfulx.ReqCtx) {
|
||||
var dict entity.SysDictType
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &dict)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &dict)
|
||||
|
||||
dict.CreateBy = rc.LoginAccount.UserName
|
||||
p.DictType.Update(dict)
|
||||
@@ -97,7 +97,7 @@ func (p *DictApi) UpdateDictType(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/type/{dictId} [delete]
|
||||
func (p *DictApi) DeleteDictType(rc *ginx.ReqCtx) {
|
||||
func (p *DictApi) DeleteDictType(rc *restfulx.ReqCtx) {
|
||||
dictId := rc.GinCtx.Param("dictId")
|
||||
dictIds := utils.IdsStrToIdsIntGroup(dictId)
|
||||
|
||||
@@ -123,7 +123,7 @@ func (p *DictApi) DeleteDictType(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/type/export [get]
|
||||
func (p *DictApi) ExportDictType(rc *ginx.ReqCtx) {
|
||||
func (p *DictApi) ExportDictType(rc *restfulx.ReqCtx) {
|
||||
filename := rc.GinCtx.Query("filename")
|
||||
status := rc.GinCtx.Query("status")
|
||||
dictName := rc.GinCtx.Query("dictName")
|
||||
@@ -144,7 +144,7 @@ func (p *DictApi) ExportDictType(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/data/list [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictDataList(rc *ginx.ReqCtx) {
|
||||
func (p *DictApi) GetDictDataList(rc *restfulx.ReqCtx) {
|
||||
dictLabel := rc.GinCtx.Query("dictLabel")
|
||||
dictType := rc.GinCtx.Query("dictType")
|
||||
status := rc.GinCtx.Query("status")
|
||||
@@ -158,7 +158,7 @@ func (p *DictApi) GetDictDataList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/data/type [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictDataListByDictType(rc *ginx.ReqCtx) {
|
||||
func (p *DictApi) GetDictDataListByDictType(rc *restfulx.ReqCtx) {
|
||||
dictType := rc.GinCtx.Query("dictType")
|
||||
biz.IsTrue(dictType != "", "请传入字典类型")
|
||||
rc.ResData = p.DictData.FindList(entity.SysDictData{DictType: dictType})
|
||||
@@ -171,8 +171,8 @@ func (p *DictApi) GetDictDataListByDictType(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/data/{dictCode} [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictData(rc *ginx.ReqCtx) {
|
||||
dictCode := ginx.PathParamInt(rc.GinCtx, "dictCode")
|
||||
func (p *DictApi) GetDictData(rc *restfulx.ReqCtx) {
|
||||
dictCode := restfulx.PathParamInt(rc.GinCtx, "dictCode")
|
||||
p.DictData.FindOne(int64(dictCode))
|
||||
}
|
||||
|
||||
@@ -186,9 +186,9 @@ func (p *DictApi) GetDictData(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/data [post]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) InsertDictData(rc *ginx.ReqCtx) {
|
||||
func (p *DictApi) InsertDictData(rc *restfulx.ReqCtx) {
|
||||
var data entity.SysDictData
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &data)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &data)
|
||||
|
||||
data.CreateBy = rc.LoginAccount.UserName
|
||||
p.DictData.Insert(data)
|
||||
@@ -204,9 +204,9 @@ func (p *DictApi) InsertDictData(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/data [put]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) UpdateDictData(rc *ginx.ReqCtx) {
|
||||
func (p *DictApi) UpdateDictData(rc *restfulx.ReqCtx) {
|
||||
var data entity.SysDictData
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &data)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &data)
|
||||
|
||||
data.CreateBy = rc.LoginAccount.UserName
|
||||
p.DictData.Update(data)
|
||||
@@ -219,7 +219,7 @@ func (p *DictApi) UpdateDictData(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/data/{dictCode} [delete]
|
||||
func (p *DictApi) DeleteDictData(rc *ginx.ReqCtx) {
|
||||
func (p *DictApi) DeleteDictData(rc *restfulx.ReqCtx) {
|
||||
param := rc.GinCtx.Param("dictCode")
|
||||
p.DictData.Delete(utils.IdsStrToIdsIntGroup(param))
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
entity "pandax/apps/system/entity"
|
||||
services "pandax/apps/system/services"
|
||||
"pandax/base/biz"
|
||||
"pandax/base/ginx"
|
||||
)
|
||||
|
||||
type MenuApi struct {
|
||||
@@ -22,7 +22,7 @@ type MenuApi struct {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/menu/menuTreSelect [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuTreeSelect(rc *ginx.ReqCtx) {
|
||||
func (m *MenuApi) GetMenuTreeSelect(rc *restfulx.ReqCtx) {
|
||||
lable := m.MenuApp.SelectMenuLable(entity.SysMenu{})
|
||||
rc.ResData = lable
|
||||
}
|
||||
@@ -34,7 +34,7 @@ func (m *MenuApi) GetMenuTreeSelect(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuRole [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuRole(rc *ginx.ReqCtx) {
|
||||
func (m *MenuApi) GetMenuRole(rc *restfulx.ReqCtx) {
|
||||
roleKey := rc.GinCtx.Query("roleKey")
|
||||
biz.IsTrue(roleKey != "", "请传入角色Key")
|
||||
rc.ResData = Build(*m.MenuApp.SelectMenuRole(roleKey))
|
||||
@@ -48,8 +48,8 @@ func (m *MenuApi) GetMenuRole(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuTreRoleSelect/{roleId} [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuTreeRoleSelect(rc *ginx.ReqCtx) {
|
||||
roleId := ginx.PathParamInt(rc.GinCtx, "roleId")
|
||||
func (m *MenuApi) GetMenuTreeRoleSelect(rc *restfulx.ReqCtx) {
|
||||
roleId := restfulx.PathParamInt(rc.GinCtx, "roleId")
|
||||
|
||||
result := m.MenuApp.SelectMenuLable(entity.SysMenu{})
|
||||
menuIds := make([]int64, 0)
|
||||
@@ -70,7 +70,7 @@ func (m *MenuApi) GetMenuTreeRoleSelect(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuPaths [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuPaths(rc *ginx.ReqCtx) {
|
||||
func (m *MenuApi) GetMenuPaths(rc *restfulx.ReqCtx) {
|
||||
roleKey := rc.GinCtx.Query("roleKey")
|
||||
biz.IsTrue(roleKey != "", "请传入角色Key")
|
||||
rc.ResData = m.RoleMenuApp.GetMenuPaths(entity.SysRoleMenu{RoleName: roleKey})
|
||||
@@ -86,7 +86,7 @@ func (m *MenuApi) GetMenuPaths(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuList [get]
|
||||
// @Security Bearer
|
||||
func (m *MenuApi) GetMenuList(rc *ginx.ReqCtx) {
|
||||
func (m *MenuApi) GetMenuList(rc *restfulx.ReqCtx) {
|
||||
menuName := rc.GinCtx.Query("menuName")
|
||||
status := rc.GinCtx.Query("status")
|
||||
|
||||
@@ -106,8 +106,8 @@ func (m *MenuApi) GetMenuList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/{menuId} [get]
|
||||
// @Security Bearer
|
||||
func (m *MenuApi) GetMenu(rc *ginx.ReqCtx) {
|
||||
menuId := ginx.PathParamInt(rc.GinCtx, "menuId")
|
||||
func (m *MenuApi) GetMenu(rc *restfulx.ReqCtx) {
|
||||
menuId := restfulx.PathParamInt(rc.GinCtx, "menuId")
|
||||
|
||||
rc.ResData = m.MenuApp.FindOne(int64(menuId))
|
||||
}
|
||||
@@ -120,9 +120,9 @@ func (m *MenuApi) GetMenu(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /system/menu [post]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) InsertMenu(rc *ginx.ReqCtx) {
|
||||
func (m *MenuApi) InsertMenu(rc *restfulx.ReqCtx) {
|
||||
var menu entity.SysMenu
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &menu)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &menu)
|
||||
menu.CreateBy = rc.LoginAccount.UserName
|
||||
m.MenuApp.Insert(menu)
|
||||
permis := m.RoleMenuApp.GetPermis(rc.LoginAccount.RoleId)
|
||||
@@ -141,9 +141,9 @@ func (m *MenuApi) InsertMenu(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
|
||||
// @Router /system/menu [put]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) UpdateMenu(rc *ginx.ReqCtx) {
|
||||
func (m *MenuApi) UpdateMenu(rc *restfulx.ReqCtx) {
|
||||
var menu entity.SysMenu
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &menu)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &menu)
|
||||
menu.UpdateBy = rc.LoginAccount.UserName
|
||||
m.MenuApp.Update(menu)
|
||||
permis := m.RoleMenuApp.GetPermis(rc.LoginAccount.RoleId)
|
||||
@@ -161,7 +161,7 @@ func (m *MenuApi) UpdateMenu(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/menu/{menuId} [delete]
|
||||
func (m *MenuApi) DeleteMenu(rc *ginx.ReqCtx) {
|
||||
menuId := ginx.PathParamInt(rc.GinCtx, "menuId")
|
||||
func (m *MenuApi) DeleteMenu(rc *restfulx.ReqCtx) {
|
||||
menuId := restfulx.PathParamInt(rc.GinCtx, "menuId")
|
||||
m.MenuApp.Delete([]int64{int64(menuId)})
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
"pandax/apps/system/entity"
|
||||
"pandax/apps/system/services"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -23,9 +23,9 @@ type NoticeApi struct {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/post [get]
|
||||
// @Security
|
||||
func (p *NoticeApi) GetNoticeList(rc *ginx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
func (p *NoticeApi) GetNoticeList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
noticeType := rc.GinCtx.Query("noticeType")
|
||||
title := rc.GinCtx.Query("title")
|
||||
|
||||
@@ -55,9 +55,9 @@ func (p *NoticeApi) GetNoticeList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/notice [post]
|
||||
// @Security X-TOKEN
|
||||
func (p *NoticeApi) InsertNotice(rc *ginx.ReqCtx) {
|
||||
func (p *NoticeApi) InsertNotice(rc *restfulx.ReqCtx) {
|
||||
var notice entity.SysNotice
|
||||
ginx.BindJsonAndValid(rc.GinCtx, ¬ice)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, ¬ice)
|
||||
notice.UserName = rc.LoginAccount.UserName
|
||||
p.NoticeApp.Insert(notice)
|
||||
}
|
||||
@@ -72,9 +72,9 @@ func (p *NoticeApi) InsertNotice(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/notice [put]
|
||||
// @Security X-TOKEN
|
||||
func (p *NoticeApi) UpdateNotice(rc *ginx.ReqCtx) {
|
||||
func (p *NoticeApi) UpdateNotice(rc *restfulx.ReqCtx) {
|
||||
var notice entity.SysNotice
|
||||
ginx.BindJsonAndValid(rc.GinCtx, ¬ice)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, ¬ice)
|
||||
|
||||
p.NoticeApp.Update(notice)
|
||||
}
|
||||
@@ -86,7 +86,7 @@ func (p *NoticeApi) UpdateNotice(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/notice/{noticeId} [delete]
|
||||
func (p *NoticeApi) DeleteNotice(rc *ginx.ReqCtx) {
|
||||
func (p *NoticeApi) DeleteNotice(rc *restfulx.ReqCtx) {
|
||||
noticeId := rc.GinCtx.Param("noticeId")
|
||||
noticeIds := utils.IdsStrToIdsIntGroup(noticeId)
|
||||
p.NoticeApp.Delete(noticeIds)
|
||||
|
||||
@@ -3,11 +3,11 @@ package api
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
"pandax/apps/system/entity"
|
||||
"pandax/apps/system/services"
|
||||
"pandax/base/biz"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
"pandax/pkg/global"
|
||||
)
|
||||
|
||||
@@ -28,10 +28,10 @@ type PostApi struct {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/post [get]
|
||||
// @Security
|
||||
func (p *PostApi) GetPostList(rc *ginx.ReqCtx) {
|
||||
func (p *PostApi) GetPostList(rc *restfulx.ReqCtx) {
|
||||
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
status := rc.GinCtx.Query("status")
|
||||
postName := rc.GinCtx.Query("postName")
|
||||
postCode := rc.GinCtx.Query("postCode")
|
||||
@@ -58,8 +58,8 @@ func (p *PostApi) GetPostList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/post/{postId} [get]
|
||||
// @Security
|
||||
func (p *PostApi) GetPost(rc *ginx.ReqCtx) {
|
||||
postId := ginx.PathParamInt(rc.GinCtx, "postId")
|
||||
func (p *PostApi) GetPost(rc *restfulx.ReqCtx) {
|
||||
postId := restfulx.PathParamInt(rc.GinCtx, "postId")
|
||||
p.PostApp.FindOne(int64(postId))
|
||||
}
|
||||
|
||||
@@ -73,9 +73,9 @@ func (p *PostApi) GetPost(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/post [post]
|
||||
// @Security X-TOKEN
|
||||
func (p *PostApi) InsertPost(rc *ginx.ReqCtx) {
|
||||
func (p *PostApi) InsertPost(rc *restfulx.ReqCtx) {
|
||||
var post entity.SysPost
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &post)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &post)
|
||||
post.TenantId = rc.LoginAccount.TenantId
|
||||
post.CreateBy = rc.LoginAccount.UserName
|
||||
p.PostApp.Insert(post)
|
||||
@@ -91,9 +91,9 @@ func (p *PostApi) InsertPost(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/post [put]
|
||||
// @Security X-TOKEN
|
||||
func (p *PostApi) UpdatePost(rc *ginx.ReqCtx) {
|
||||
func (p *PostApi) UpdatePost(rc *restfulx.ReqCtx) {
|
||||
var post entity.SysPost
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &post)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &post)
|
||||
|
||||
post.CreateBy = rc.LoginAccount.UserName
|
||||
p.PostApp.Update(post)
|
||||
@@ -106,7 +106,7 @@ func (p *PostApi) UpdatePost(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/post/{postId} [delete]
|
||||
func (p *PostApi) DeletePost(rc *ginx.ReqCtx) {
|
||||
func (p *PostApi) DeletePost(rc *restfulx.ReqCtx) {
|
||||
|
||||
postId := rc.GinCtx.Param("postId")
|
||||
postIds := utils.IdsStrToIdsIntGroup(postId)
|
||||
|
||||
@@ -3,12 +3,12 @@ package api
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"github.com/XM-GO/PandaKit/casbin"
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
entity "pandax/apps/system/entity"
|
||||
services "pandax/apps/system/services"
|
||||
"pandax/base/biz"
|
||||
"pandax/base/casbin"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
"pandax/pkg/global"
|
||||
"strconv"
|
||||
)
|
||||
@@ -31,9 +31,9 @@ type RoleApi struct {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/role/rolelist [get]
|
||||
// @Security
|
||||
func (r *RoleApi) GetRoleList(rc *ginx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
func (r *RoleApi) GetRoleList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
status := rc.GinCtx.Query("status")
|
||||
roleName := rc.GinCtx.Query("roleName")
|
||||
roleKey := rc.GinCtx.Query("roleKey")
|
||||
@@ -61,8 +61,8 @@ func (r *RoleApi) GetRoleList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/role [get]
|
||||
// @Security X-TOKEN
|
||||
func (r *RoleApi) GetRole(rc *ginx.ReqCtx) {
|
||||
roleId := ginx.PathParamInt(rc.GinCtx, "roleId")
|
||||
func (r *RoleApi) GetRole(rc *restfulx.ReqCtx) {
|
||||
roleId := restfulx.PathParamInt(rc.GinCtx, "roleId")
|
||||
role := r.RoleApp.FindOne(int64(roleId))
|
||||
role.MenuIds = r.RoleApp.GetRoleMeunId(entity.SysRole{RoleId: int64(roleId)})
|
||||
|
||||
@@ -78,9 +78,9 @@ func (r *RoleApi) GetRole(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/role [post]
|
||||
func (r *RoleApi) InsertRole(rc *ginx.ReqCtx) {
|
||||
func (r *RoleApi) InsertRole(rc *restfulx.ReqCtx) {
|
||||
var role entity.SysRole
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &role)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &role)
|
||||
role.CreateBy = rc.LoginAccount.UserName
|
||||
role.TenantId = rc.LoginAccount.TenantId
|
||||
insert := r.RoleApp.Insert(role)
|
||||
@@ -100,9 +100,9 @@ func (r *RoleApi) InsertRole(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "修改失败"}"
|
||||
// @Router /system/role [put]
|
||||
func (r *RoleApi) UpdateRole(rc *ginx.ReqCtx) {
|
||||
func (r *RoleApi) UpdateRole(rc *restfulx.ReqCtx) {
|
||||
var role entity.SysRole
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &role)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &role)
|
||||
role.UpdateBy = rc.LoginAccount.UserName
|
||||
// 修改角色
|
||||
r.RoleApp.Update(role)
|
||||
@@ -124,9 +124,9 @@ func (r *RoleApi) UpdateRole(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "修改失败"}"
|
||||
// @Router /system/role/changeStatus [put]
|
||||
func (r *RoleApi) UpdateRoleStatus(rc *ginx.ReqCtx) {
|
||||
func (r *RoleApi) UpdateRoleStatus(rc *restfulx.ReqCtx) {
|
||||
var role entity.SysRole
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &role)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &role)
|
||||
role.UpdateBy = rc.LoginAccount.UserName
|
||||
// 修改角色
|
||||
r.RoleApp.Update(role)
|
||||
@@ -141,9 +141,9 @@ func (r *RoleApi) UpdateRoleStatus(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "修改失败"}"
|
||||
// @Router /system/role/dataScope [put]
|
||||
func (r *RoleApi) UpdateRoleDataScope(rc *ginx.ReqCtx) {
|
||||
func (r *RoleApi) UpdateRoleDataScope(rc *restfulx.ReqCtx) {
|
||||
var role entity.SysRole
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &role)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &role)
|
||||
role.UpdateBy = rc.LoginAccount.UserName
|
||||
// 修改角色
|
||||
update := r.RoleApp.Update(role)
|
||||
@@ -162,7 +162,7 @@ func (r *RoleApi) UpdateRoleDataScope(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/role/{roleId} [delete]
|
||||
func (r *RoleApi) DeleteRole(rc *ginx.ReqCtx) {
|
||||
func (r *RoleApi) DeleteRole(rc *restfulx.ReqCtx) {
|
||||
roleId := rc.GinCtx.Param("roleId")
|
||||
roleIds := utils.IdsStrToIdsIntGroup(roleId)
|
||||
|
||||
@@ -197,7 +197,7 @@ func (r *RoleApi) DeleteRole(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/type/export [get]
|
||||
func (p *RoleApi) ExportRole(rc *ginx.ReqCtx) {
|
||||
func (p *RoleApi) ExportRole(rc *restfulx.ReqCtx) {
|
||||
filename := rc.GinCtx.Query("filename")
|
||||
status := rc.GinCtx.Query("status")
|
||||
roleName := rc.GinCtx.Query("roleName")
|
||||
|
||||
@@ -2,13 +2,13 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/ws"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/kakuilan/kgo"
|
||||
"net/http"
|
||||
"pandax/base/biz"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/ws"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
@@ -71,8 +71,8 @@ func (s *System) ConnectWs(g *gin.Context) {
|
||||
panic(any(biz.NewBizErr("升级websocket失败")))
|
||||
}
|
||||
// 权限校验
|
||||
rc := ginx.NewReqCtx(g)
|
||||
if err = ginx.PermissionHandler(rc); err != nil {
|
||||
rc := restfulx.NewReqCtx(g)
|
||||
if err = restfulx.PermissionHandler(rc); err != nil {
|
||||
panic(any(biz.NewBizErr("没有权限")))
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ package api
|
||||
* @Date 2022/7/14 17:55
|
||||
**/
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
"pandax/apps/system/entity"
|
||||
"pandax/apps/system/services"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
)
|
||||
|
||||
type SysTenantsApi struct {
|
||||
@@ -23,10 +23,10 @@ type SysTenantsApi struct {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/tenant/list [get]
|
||||
// @Security
|
||||
func (p *SysTenantsApi) GetSysTenantsList(rc *ginx.ReqCtx) {
|
||||
func (p *SysTenantsApi) GetSysTenantsList(rc *restfulx.ReqCtx) {
|
||||
data := entity.SysTenants{}
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
|
||||
list, total := p.SysTenantsApp.FindListPage(pageNum, pageSize, data)
|
||||
|
||||
@@ -43,7 +43,7 @@ func (p *SysTenantsApi) GetSysTenantsList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/tenant/lists [get]
|
||||
// @Security
|
||||
func (p *SysTenantsApi) GetSysTenantsAll(rc *ginx.ReqCtx) {
|
||||
func (p *SysTenantsApi) GetSysTenantsAll(rc *restfulx.ReqCtx) {
|
||||
list := make([]entity.SysTenants, 0)
|
||||
if rc.LoginAccount.RoleKey == "admin" {
|
||||
data := entity.SysTenants{}
|
||||
@@ -61,8 +61,8 @@ func (p *SysTenantsApi) GetSysTenantsAll(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/tenant/{tenantId} [get]
|
||||
// @Security
|
||||
func (p *SysTenantsApi) GetSysTenants(rc *ginx.ReqCtx) {
|
||||
tenantId := ginx.PathParamInt(rc.GinCtx, "tenantId")
|
||||
func (p *SysTenantsApi) GetSysTenants(rc *restfulx.ReqCtx) {
|
||||
tenantId := restfulx.PathParamInt(rc.GinCtx, "tenantId")
|
||||
p.SysTenantsApp.FindOne(int64(tenantId))
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ func (p *SysTenantsApi) GetSysTenants(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/tenant [post]
|
||||
// @Security X-TOKEN
|
||||
func (p *SysTenantsApi) InsertSysTenants(rc *ginx.ReqCtx) {
|
||||
func (p *SysTenantsApi) InsertSysTenants(rc *restfulx.ReqCtx) {
|
||||
var data entity.SysTenants
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &data)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &data)
|
||||
|
||||
p.SysTenantsApp.Insert(data)
|
||||
}
|
||||
@@ -93,9 +93,9 @@ func (p *SysTenantsApi) InsertSysTenants(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/tenant [put]
|
||||
// @Security X-TOKEN
|
||||
func (p *SysTenantsApi) UpdateSysTenants(rc *ginx.ReqCtx) {
|
||||
func (p *SysTenantsApi) UpdateSysTenants(rc *restfulx.ReqCtx) {
|
||||
var data entity.SysTenants
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &data)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &data)
|
||||
|
||||
p.SysTenantsApp.Update(data)
|
||||
}
|
||||
@@ -107,7 +107,7 @@ func (p *SysTenantsApi) UpdateSysTenants(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/tenant/{tenantId} [delete]
|
||||
func (p *SysTenantsApi) DeleteSysTenants(rc *ginx.ReqCtx) {
|
||||
func (p *SysTenantsApi) DeleteSysTenants(rc *restfulx.ReqCtx) {
|
||||
tenantId := rc.GinCtx.Param("tenantId")
|
||||
tenantIds := utils.IdsStrToIdsIntGroup(tenantId)
|
||||
p.SysTenantsApp.Delete(tenantIds)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/token"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/kakuilan/kgo"
|
||||
@@ -9,16 +10,15 @@ import (
|
||||
"pandax/apps/system/api/form"
|
||||
"pandax/apps/system/api/vo"
|
||||
"pandax/apps/system/entity"
|
||||
"pandax/base/token"
|
||||
|
||||
logEntity "pandax/apps/log/entity"
|
||||
logServices "pandax/apps/log/services"
|
||||
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"github.com/XM-GO/PandaKit/captcha"
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
"pandax/apps/system/services"
|
||||
"pandax/base/biz"
|
||||
"pandax/base/captcha"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
"pandax/pkg/global"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -49,7 +49,7 @@ func (u *UserApi) GenerateCaptcha(c *gin.Context) {
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
|
||||
// @Router /system/user/refreshToken [get]
|
||||
func (u *UserApi) RefreshToken(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) RefreshToken(rc *restfulx.ReqCtx) {
|
||||
tokenStr := rc.GinCtx.Request.Header.Get("X-TOKEN")
|
||||
j := token.NewJWT("", []byte(global.Conf.Jwt.Key), jwt.SigningMethodHS256)
|
||||
token, err := j.RefreshToken(tokenStr)
|
||||
@@ -63,9 +63,9 @@ func (u *UserApi) RefreshToken(rc *ginx.ReqCtx) {
|
||||
// @Param data body form.Login true "用户名, 密码, 验证码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
|
||||
// @Router /system/user/login [post]
|
||||
func (u *UserApi) Login(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) Login(rc *restfulx.ReqCtx) {
|
||||
var l form.Login
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &l)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &l)
|
||||
biz.IsTrue(captcha.Verify(l.CaptchaId, l.Captcha), "验证码认证失败")
|
||||
|
||||
login := u.UserApp.Login(entity.Login{Username: l.Username, Password: l.Password})
|
||||
@@ -115,7 +115,7 @@ func (u *UserApi) Login(rc *ginx.ReqCtx) {
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"成功"}"
|
||||
// @Router /system/user/auth [get]
|
||||
func (u *UserApi) Auth(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) Auth(rc *restfulx.ReqCtx) {
|
||||
userName := rc.GinCtx.Query("username")
|
||||
biz.NotEmpty(userName, "用户名必传")
|
||||
var user entity.SysUser
|
||||
@@ -139,7 +139,7 @@ func (u *UserApi) Auth(rc *ginx.ReqCtx) {
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
|
||||
// @Router /system/user/logout [post]
|
||||
func (u *UserApi) LogOut(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) LogOut(rc *restfulx.ReqCtx) {
|
||||
var loginLog logEntity.LogLogin
|
||||
ua := user_agent.New(rc.GinCtx.Request.UserAgent())
|
||||
loginLog.Ipaddr = rc.GinCtx.ClientIP()
|
||||
@@ -167,13 +167,13 @@ func (u *UserApi) LogOut(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/user/sysUserList [get]
|
||||
// @Security X-TOKEN
|
||||
func (u *UserApi) GetSysUserList(rc *ginx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
func (u *UserApi) GetSysUserList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
status := rc.GinCtx.Query("status")
|
||||
userName := rc.GinCtx.Query("username")
|
||||
phone := rc.GinCtx.Query("phone")
|
||||
deptId := ginx.QueryInt(rc.GinCtx, "deptId", 0)
|
||||
deptId := restfulx.QueryInt(rc.GinCtx, "deptId", 0)
|
||||
var user entity.SysUser
|
||||
user.Status = status
|
||||
user.Username = userName
|
||||
@@ -199,7 +199,7 @@ func (u *UserApi) GetSysUserList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/user/profile [get]
|
||||
// @Security
|
||||
func (u *UserApi) GetSysUserProfile(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) GetSysUserProfile(rc *restfulx.ReqCtx) {
|
||||
|
||||
sysUser := entity.SysUser{}
|
||||
sysUser.UserId = rc.LoginAccount.UserId
|
||||
@@ -235,7 +235,7 @@ func (u *UserApi) GetSysUserProfile(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /system/user/profileAvatar [post]
|
||||
func (u *UserApi) InsetSysUserAvatar(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) InsetSysUserAvatar(rc *restfulx.ReqCtx) {
|
||||
form, err := rc.GinCtx.MultipartForm()
|
||||
biz.ErrIsNil(err, "头像上传失败")
|
||||
|
||||
@@ -262,9 +262,9 @@ func (u *UserApi) InsetSysUserAvatar(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /system/user/updatePwd [post]
|
||||
func (u *UserApi) SysUserUpdatePwd(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) SysUserUpdatePwd(rc *restfulx.ReqCtx) {
|
||||
var pws entity.SysUserPwd
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &pws)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &pws)
|
||||
|
||||
user := entity.SysUser{}
|
||||
user.UserId = rc.LoginAccount.UserId
|
||||
@@ -278,8 +278,8 @@ func (u *UserApi) SysUserUpdatePwd(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/user/sysUser/{userId} [get]
|
||||
// @Security
|
||||
func (u *UserApi) GetSysUser(rc *ginx.ReqCtx) {
|
||||
userId := ginx.PathParamInt(rc.GinCtx, "userId")
|
||||
func (u *UserApi) GetSysUser(rc *restfulx.ReqCtx) {
|
||||
userId := restfulx.PathParamInt(rc.GinCtx, "userId")
|
||||
|
||||
user := entity.SysUser{}
|
||||
user.UserId = int64(userId)
|
||||
@@ -312,7 +312,7 @@ func (u *UserApi) GetSysUser(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/user/getInit [get]
|
||||
// @Security
|
||||
func (u *UserApi) GetSysUserInit(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) GetSysUserInit(rc *restfulx.ReqCtx) {
|
||||
|
||||
var role entity.SysRole
|
||||
if !IsTenantAdmin(rc.LoginAccount.TenantId) {
|
||||
@@ -336,7 +336,7 @@ func (u *UserApi) GetSysUserInit(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/user/getInit [get]
|
||||
// @Security
|
||||
func (u *UserApi) GetUserRolePost(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) GetUserRolePost(rc *restfulx.ReqCtx) {
|
||||
var user entity.SysUser
|
||||
user.UserId = rc.LoginAccount.UserId
|
||||
|
||||
@@ -367,9 +367,9 @@ func (u *UserApi) GetUserRolePost(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/user/sysUser [post]
|
||||
func (u *UserApi) InsertSysUser(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) InsertSysUser(rc *restfulx.ReqCtx) {
|
||||
var sysUser entity.SysUser
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &sysUser)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &sysUser)
|
||||
sysUser.CreateBy = rc.LoginAccount.UserName
|
||||
u.UserApp.Insert(sysUser)
|
||||
}
|
||||
@@ -383,9 +383,9 @@ func (u *UserApi) InsertSysUser(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/user/sysUser [put]
|
||||
func (u *UserApi) UpdateSysUser(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) UpdateSysUser(rc *restfulx.ReqCtx) {
|
||||
var sysUser entity.SysUser
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &sysUser)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &sysUser)
|
||||
sysUser.CreateBy = rc.LoginAccount.UserName
|
||||
u.UserApp.Update(sysUser)
|
||||
}
|
||||
@@ -399,9 +399,9 @@ func (u *UserApi) UpdateSysUser(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/user/sysUser [put]
|
||||
func (u *UserApi) UpdateSysUserStu(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) UpdateSysUserStu(rc *restfulx.ReqCtx) {
|
||||
var sysUser entity.SysUser
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &sysUser)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &sysUser)
|
||||
sysUser.CreateBy = rc.LoginAccount.UserName
|
||||
u.UserApp.Update(sysUser)
|
||||
}
|
||||
@@ -413,7 +413,7 @@ func (u *UserApi) UpdateSysUserStu(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/user/sysuser/{userId} [delete]
|
||||
func (u *UserApi) DeleteSysUser(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) DeleteSysUser(rc *restfulx.ReqCtx) {
|
||||
userIds := rc.GinCtx.Param("userId")
|
||||
us := utils.IdsStrToIdsIntGroup(userIds)
|
||||
u.UserApp.Delete(us)
|
||||
@@ -428,7 +428,7 @@ func (u *UserApi) DeleteSysUser(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/type/export [get]
|
||||
func (u *UserApi) ExportUser(rc *ginx.ReqCtx) {
|
||||
func (u *UserApi) ExportUser(rc *restfulx.ReqCtx) {
|
||||
filename := rc.GinCtx.Query("filename")
|
||||
status := rc.GinCtx.Query("status")
|
||||
userName := rc.GinCtx.Query("username")
|
||||
|
||||
Reference in New Issue
Block a user