Browse Source

fix: casbin gorm-adapter has no sqlite3 support

Signed-off-by: closetool <c299999999@qq.com>
main
closetool 4 years ago
parent
commit
0c461a94fe
  1. 4
      server/api/v1/exa_breakpoint_continue.go
  2. 2
      server/api/v1/exa_simple_uploader.go
  3. 3
      server/api/v1/sys_api.go
  4. 1
      server/api/v1/sys_casbin.go
  5. 2
      server/api/v1/sys_menu.go
  6. 12
      server/go.mod
  7. 2
      server/initialize/redis.go
  8. 2
      server/model/request/sys_dictionary.go
  9. 2
      server/model/request/sys_dictionary_detail.go
  10. 10
      server/service/exa_excel_parse.go
  11. 6
      server/service/sys_api.go
  12. 6
      server/service/sys_casbin.go
  13. 7
      server/service/sys_system.go
  14. 3
      server/service/sys_user.go
  15. 2
      server/source/api.go
  16. 297
      server/source/casbin.go
  17. 2
      server/utils/directory.go
  18. 7
      server/utils/server.go
  19. 1
      server/utils/upload/local.go
  20. 2
      server/utils/upload/qiniu.go

4
server/api/v1/exa_breakpoint_continue.go

@ -82,7 +82,7 @@ func FindFile(c *gin.Context) {
global.GVA_LOG.Error("查找失败!", zap.Any("err", err)) global.GVA_LOG.Error("查找失败!", zap.Any("err", err))
response.FailWithMessage("查找失败", c) response.FailWithMessage("查找失败", c)
} else { } else {
response.OkWithDetailed(response.FileResponse{File: file},"查找成功", c)
response.OkWithDetailed(response.FileResponse{File: file}, "查找成功", c)
} }
} }
@ -122,7 +122,7 @@ func RemoveChunk(c *gin.Context) {
err = service.DeleteFileChunk(fileMd5, fileName, filePath) err = service.DeleteFileChunk(fileMd5, fileName, filePath)
if err != nil { if err != nil {
global.GVA_LOG.Error("缓存切片删除失败!", zap.Any("err", err)) global.GVA_LOG.Error("缓存切片删除失败!", zap.Any("err", err))
response.FailWithDetailed(response.FilePathResponse{FilePath: filePath},"缓存切片删除失败", c)
response.FailWithDetailed(response.FilePathResponse{FilePath: filePath}, "缓存切片删除失败", c)
} else { } else {
response.OkWithDetailed(response.FilePathResponse{FilePath: filePath}, "缓存切片删除成功", c) response.OkWithDetailed(response.FilePathResponse{FilePath: filePath}, "缓存切片删除成功", c)
} }

2
server/api/v1/exa_simple_uploader.go

@ -69,7 +69,7 @@ func CheckFileMd5(c *gin.Context) {
response.OkWithDetailed(gin.H{ response.OkWithDetailed(gin.H{
"chunks": chunks, "chunks": chunks,
"isDone": isDone, "isDone": isDone,
},"查询成功", c)
}, "查询成功", c)
} }
} }

3
server/api/v1/sys_api.go

@ -148,7 +148,6 @@ func GetAllApis(c *gin.Context) {
} }
} }
// @Tags SysApi // @Tags SysApi
// @Summary 删除选中Api // @Summary 删除选中Api
// @Security ApiKeyAuth // @Security ApiKeyAuth
@ -164,6 +163,6 @@ func DeleteApisByIds(c *gin.Context) {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c) response.FailWithMessage("删除失败", c)
} else { } else {
response.OkWithMessage("删除成功",c)
response.OkWithMessage("删除成功", c)
} }
} }

1
server/api/v1/sys_casbin.go

@ -51,4 +51,3 @@ func GetPolicyPathByAuthorityId(c *gin.Context) {
paths := service.GetPolicyPathByAuthorityId(casbin.AuthorityId) paths := service.GetPolicyPathByAuthorityId(casbin.AuthorityId)
response.OkWithDetailed(response.PolicyPathResponse{Paths: paths}, "获取成功", c) response.OkWithDetailed(response.PolicyPathResponse{Paths: paths}, "获取成功", c)
} }

2
server/api/v1/sys_menu.go

@ -214,6 +214,6 @@ func GetMenuList(c *gin.Context) {
Total: total, Total: total,
Page: pageInfo.Page, Page: pageInfo.Page,
PageSize: pageInfo.PageSize, PageSize: pageInfo.PageSize,
},"获取成功", c)
}, "获取成功", c)
} }
} }

12
server/go.mod

@ -8,9 +8,8 @@ require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/aliyun/aliyun-oss-go-sdk v2.1.6+incompatible github.com/aliyun/aliyun-oss-go-sdk v2.1.6+incompatible
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/casbin/casbin v1.9.1
github.com/casbin/casbin/v2 v2.11.0
github.com/casbin/gorm-adapter/v3 v3.0.2
github.com/casbin/casbin/v2 v2.25.6
github.com/casbin/gorm-adapter/v3 v3.2.5
github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
github.com/fsnotify/fsnotify v1.4.9 github.com/fsnotify/fsnotify v1.4.9
@ -30,7 +29,6 @@ require (
github.com/lestrrat-go/file-rotatelogs v2.3.0+incompatible github.com/lestrrat-go/file-rotatelogs v2.3.0+incompatible
github.com/lestrrat-go/strftime v1.0.3 // indirect github.com/lestrrat-go/strftime v1.0.3 // indirect
github.com/mailru/easyjson v0.7.1 // indirect github.com/mailru/easyjson v0.7.1 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.2.2 // indirect github.com/mitchellh/mapstructure v1.2.2 // indirect
github.com/mojocn/base64Captcha v1.3.1 github.com/mojocn/base64Captcha v1.3.1
github.com/onsi/ginkgo v1.7.0 // indirect github.com/onsi/ginkgo v1.7.0 // indirect
@ -42,8 +40,8 @@ require (
github.com/shirou/gopsutil v3.21.1+incompatible github.com/shirou/gopsutil v3.21.1+incompatible
github.com/spf13/afero v1.2.2 // indirect github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.1 // indirect github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v1.1.1
github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.7.0 github.com/spf13/viper v1.7.0
github.com/swaggo/gin-swagger v1.2.0 github.com/swaggo/gin-swagger v1.2.0
github.com/swaggo/swag v1.6.7 github.com/swaggo/swag v1.6.7
@ -56,8 +54,6 @@ require (
google.golang.org/protobuf v1.24.0 // indirect google.golang.org/protobuf v1.24.0 // indirect
gopkg.in/ini.v1 v1.55.0 // indirect gopkg.in/ini.v1 v1.55.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect
gorm.io/driver/mysql v0.3.0
gorm.io/driver/mysql v1.0.1
gorm.io/gorm v1.20.9 gorm.io/gorm v1.20.9
) )
replace github.com/casbin/gorm-adapter/v3 => github.com/casbin/gorm-adapter/v3 v3.0.2

2
server/initialize/redis.go

@ -17,7 +17,7 @@ func Redis() {
if err != nil { if err != nil {
global.GVA_LOG.Error("redis connect ping failed, err:", zap.Any("err", err)) global.GVA_LOG.Error("redis connect ping failed, err:", zap.Any("err", err))
} else { } else {
global.GVA_LOG.Info("redis connect ping response:", zap.String("pong",pong))
global.GVA_LOG.Info("redis connect ping response:", zap.String("pong", pong))
global.GVA_REDIS = client global.GVA_REDIS = client
} }
} }

2
server/model/request/sys_dictionary.go

@ -2,7 +2,7 @@ package request
import "gin-vue-admin/model" import "gin-vue-admin/model"
type SysDictionarySearch struct{
type SysDictionarySearch struct {
model.SysDictionary model.SysDictionary
PageInfo PageInfo
} }

2
server/model/request/sys_dictionary_detail.go

@ -2,7 +2,7 @@ package request
import "gin-vue-admin/model" import "gin-vue-admin/model"
type SysDictionaryDetailSearch struct{
type SysDictionaryDetailSearch struct {
model.SysDictionaryDetail model.SysDictionaryDetail
PageInfo PageInfo
} }

10
server/service/exa_excel_parse.go

@ -11,10 +11,10 @@ import (
func ParseInfoList2Excel(infoList []model.SysBaseMenu, filePath string) error { func ParseInfoList2Excel(infoList []model.SysBaseMenu, filePath string) error {
excel := excelize.NewFile() excel := excelize.NewFile()
excel.SetSheetRow("Sheet1","A1",&[]string{"ID","路由Name","路由Path","是否隐藏","父节点","排序","文件名称"})
excel.SetSheetRow("Sheet1", "A1", &[]string{"ID", "路由Name", "路由Path", "是否隐藏", "父节点", "排序", "文件名称"})
for i, menu := range infoList { for i, menu := range infoList {
axis := fmt.Sprintf("A%d",i+2)
excel.SetSheetRow("Sheet1",axis,&[]interface{}{
axis := fmt.Sprintf("A%d", i+2)
excel.SetSheetRow("Sheet1", axis, &[]interface{}{
menu.ID, menu.ID,
menu.Name, menu.Name,
menu.Path, menu.Path,
@ -30,8 +30,8 @@ func ParseInfoList2Excel(infoList []model.SysBaseMenu, filePath string) error {
func ParseExcel2InfoList() ([]model.SysBaseMenu, error) { func ParseExcel2InfoList() ([]model.SysBaseMenu, error) {
skipHeader := true skipHeader := true
fixedHeader := []string{"ID","路由Name","路由Path","是否隐藏","父节点","排序","文件名称"}
file, err := excelize.OpenFile(global.GVA_CONFIG.Excel.Dir+"ExcelImport.xlsx")
fixedHeader := []string{"ID", "路由Name", "路由Path", "是否隐藏", "父节点", "排序", "文件名称"}
file, err := excelize.OpenFile(global.GVA_CONFIG.Excel.Dir + "ExcelImport.xlsx")
if err != nil { if err != nil {
return nil, err return nil, err
} }

6
server/service/sys_api.go

@ -5,6 +5,7 @@ import (
"gin-vue-admin/global" "gin-vue-admin/global"
"gin-vue-admin/model" "gin-vue-admin/model"
"gin-vue-admin/model/request" "gin-vue-admin/model/request"
"gorm.io/gorm" "gorm.io/gorm"
) )
@ -130,8 +131,6 @@ func UpdateApi(api model.SysApi) (err error) {
return err return err
} }
//@author: [piexlmax](https://github.com/piexlmax) //@author: [piexlmax](https://github.com/piexlmax)
//@function: DeleteApis //@function: DeleteApis
//@description: 删除选中API //@description: 删除选中API
@ -139,7 +138,6 @@ func UpdateApi(api model.SysApi) (err error) {
//@return: err error //@return: err error
func DeleteApisByIds(ids request.IdsReq) (err error) { func DeleteApisByIds(ids request.IdsReq) (err error) {
err = global.GVA_DB.Delete(&[]model.SysApi{},"id in ?",ids.Ids).Error
err = global.GVA_DB.Delete(&[]model.SysApi{}, "id in ?", ids.Ids).Error
return err return err
return
} }

6
server/service/sys_casbin.go

@ -5,11 +5,12 @@ import (
"gin-vue-admin/global" "gin-vue-admin/global"
"gin-vue-admin/model" "gin-vue-admin/model"
"gin-vue-admin/model/request" "gin-vue-admin/model/request"
"github.com/casbin/casbin/util"
"strings"
"github.com/casbin/casbin/v2" "github.com/casbin/casbin/v2"
"github.com/casbin/casbin/v2/util"
gormadapter "github.com/casbin/gorm-adapter/v3" gormadapter "github.com/casbin/gorm-adapter/v3"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
"strings"
) )
//@author: [piexlmax](https://github.com/piexlmax) //@author: [piexlmax](https://github.com/piexlmax)
@ -58,7 +59,6 @@ func UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod
//@param: authorityId string //@param: authorityId string
//@return: pathMaps []request.CasbinInfo //@return: pathMaps []request.CasbinInfo
func GetPolicyPathByAuthorityId(authorityId string) (pathMaps []request.CasbinInfo) { func GetPolicyPathByAuthorityId(authorityId string) (pathMaps []request.CasbinInfo) {
e := Casbin() e := Casbin()
list := e.GetFilteredPolicy(0, authorityId) list := e.GetFilteredPolicy(0, authorityId)

7
server/service/sys_system.go

@ -41,19 +41,18 @@ func SetSystemConfig(system model.System) (err error) {
func GetServerInfo() (server *utils.Server, err error) { func GetServerInfo() (server *utils.Server, err error) {
var s utils.Server var s utils.Server
s.Os = utils.InitOS() s.Os = utils.InitOS()
if s.Cpu, err = utils.InitCPU(); err != nil{
if s.Cpu, err = utils.InitCPU(); err != nil {
global.GVA_LOG.Error("func utils.InitCPU() Failed!", zap.String("err", err.Error())) global.GVA_LOG.Error("func utils.InitCPU() Failed!", zap.String("err", err.Error()))
return &s, err return &s, err
} }
if s.Rrm, err = utils.InitRAM(); err != nil{
if s.Rrm, err = utils.InitRAM(); err != nil {
global.GVA_LOG.Error("func utils.InitRAM() Failed!", zap.String("err", err.Error())) global.GVA_LOG.Error("func utils.InitRAM() Failed!", zap.String("err", err.Error()))
return &s, err return &s, err
} }
if s.Disk, err = utils.InitDisk(); err != nil{
if s.Disk, err = utils.InitDisk(); err != nil {
global.GVA_LOG.Error("func utils.InitDisk() Failed!", zap.String("err", err.Error())) global.GVA_LOG.Error("func utils.InitDisk() Failed!", zap.String("err", err.Error()))
return &s, err return &s, err
} }
return &s, nil return &s, nil
} }

3
server/service/sys_user.go

@ -10,7 +10,6 @@ import (
"gorm.io/gorm" "gorm.io/gorm"
) )
//@author: [piexlmax](https://github.com/piexlmax) //@author: [piexlmax](https://github.com/piexlmax)
//@function: Register //@function: Register
//@description: 用户注册 //@description: 用户注册
@ -125,7 +124,7 @@ func FindUserById(id int) (err error, user *model.SysUser) {
func FindUserByUuid(uuid string) (err error, user *model.SysUser) { func FindUserByUuid(uuid string) (err error, user *model.SysUser) {
var u model.SysUser var u model.SysUser
if err = global.GVA_DB.Where("`uuid` = ?", uuid).First(&u).Error; err != nil{
if err = global.GVA_DB.Where("`uuid` = ?", uuid).First(&u).Error; err != nil {
return errors.New("用户不存在"), &u return errors.New("用户不存在"), &u
} }
return nil, &u return nil, &u

2
server/source/api.go

@ -88,8 +88,6 @@ var apis = []model.SysApi{
{global.GVA_MODEL{ID: 85, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/deleteApisByIds", "批量删除api", "api", "DELETE"}, {global.GVA_MODEL{ID: 85, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/deleteApisByIds", "批量删除api", "api", "DELETE"},
} }
//@author: [SliverHorn](https://github.com/SliverHorn) //@author: [SliverHorn](https://github.com/SliverHorn)
//@description: sys_apis 表数据初始化 //@description: sys_apis 表数据初始化
func (a *api) Init() error { func (a *api) Init() error {

297
server/source/casbin.go

@ -2,6 +2,7 @@ package source
import ( import (
"gin-vue-admin/global" "gin-vue-admin/global"
gormadapter "github.com/casbin/gorm-adapter/v3" gormadapter "github.com/casbin/gorm-adapter/v3"
"github.com/gookit/color" "github.com/gookit/color"
"gorm.io/gorm" "gorm.io/gorm"
@ -12,154 +13,154 @@ var Casbin = new(casbin)
type casbin struct{} type casbin struct{}
var carbines = []gormadapter.CasbinRule{ var carbines = []gormadapter.CasbinRule{
{PType: "p", V0: "888", V1: "/base/login", V2: "POST"},
{PType: "p", V0: "888", V1: "/user/register", V2: "POST"},
{PType: "p", V0: "888", V1: "/api/createApi", V2: "POST"},
{PType: "p", V0: "888", V1: "/api/getApiList", V2: "POST"},
{PType: "p", V0: "888", V1: "/api/getApiById", V2: "POST"},
{PType: "p", V0: "888", V1: "/api/deleteApi", V2: "POST"},
{PType: "p", V0: "888", V1: "/api/updateApi", V2: "POST"},
{PType: "p", V0: "888", V1: "/api/getAllApis", V2: "POST"},
{PType: "p", V0: "888", V1: "/authority/createAuthority", V2: "POST"},
{PType: "p", V0: "888", V1: "/authority/deleteAuthority", V2: "POST"},
{PType: "p", V0: "888", V1: "/authority/getAuthorityList", V2: "POST"},
{PType: "p", V0: "888", V1: "/authority/setDataAuthority", V2: "POST"},
{PType: "p", V0: "888", V1: "/authority/updateAuthority", V2: "PUT"},
{PType: "p", V0: "888", V1: "/authority/copyAuthority", V2: "POST"},
{PType: "p", V0: "888", V1: "/menu/getMenu", V2: "POST"},
{PType: "p", V0: "888", V1: "/menu/getMenuList", V2: "POST"},
{PType: "p", V0: "888", V1: "/menu/addBaseMenu", V2: "POST"},
{PType: "p", V0: "888", V1: "/menu/getBaseMenuTree", V2: "POST"},
{PType: "p", V0: "888", V1: "/menu/addMenuAuthority", V2: "POST"},
{PType: "p", V0: "888", V1: "/menu/getMenuAuthority", V2: "POST"},
{PType: "p", V0: "888", V1: "/menu/deleteBaseMenu", V2: "POST"},
{PType: "p", V0: "888", V1: "/menu/updateBaseMenu", V2: "POST"},
{PType: "p", V0: "888", V1: "/menu/getBaseMenuById", V2: "POST"},
{PType: "p", V0: "888", V1: "/user/changePassword", V2: "POST"},
{PType: "p", V0: "888", V1: "/user/getUserList", V2: "POST"},
{PType: "p", V0: "888", V1: "/user/setUserAuthority", V2: "POST"},
{PType: "p", V0: "888", V1: "/user/deleteUser", V2: "DELETE"},
{PType: "p", V0: "888", V1: "/fileUploadAndDownload/upload", V2: "POST"},
{PType: "p", V0: "888", V1: "/fileUploadAndDownload/getFileList", V2: "POST"},
{PType: "p", V0: "888", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"},
{PType: "p", V0: "888", V1: "/casbin/updateCasbin", V2: "POST"},
{PType: "p", V0: "888", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"},
{PType: "p", V0: "888", V1: "/casbin/casbinTest/:pathParam", V2: "GET"},
{PType: "p", V0: "888", V1: "/jwt/jsonInBlacklist", V2: "POST"},
{PType: "p", V0: "888", V1: "/system/getSystemConfig", V2: "POST"},
{PType: "p", V0: "888", V1: "/system/setSystemConfig", V2: "POST"},
{PType: "p", V0: "888", V1: "/system/getServerInfo", V2: "POST"},
{PType: "p", V0: "888", V1: "/customer/customer", V2: "POST"},
{PType: "p", V0: "888", V1: "/customer/customer", V2: "PUT"},
{PType: "p", V0: "888", V1: "/customer/customer", V2: "DELETE"},
{PType: "p", V0: "888", V1: "/customer/customer", V2: "GET"},
{PType: "p", V0: "888", V1: "/customer/customerList", V2: "GET"},
{PType: "p", V0: "888", V1: "/autoCode/createTemp", V2: "POST"},
{PType: "p", V0: "888", V1: "/autoCode/preview", V2: "POST"},
{PType: "p", V0: "888", V1: "/autoCode/getTables", V2: "GET"},
{PType: "p", V0: "888", V1: "/autoCode/getDB", V2: "GET"},
{PType: "p", V0: "888", V1: "/autoCode/getColumn", V2: "GET"},
{PType: "p", V0: "888", V1: "/sysDictionaryDetail/createSysDictionaryDetail", V2: "POST"},
{PType: "p", V0: "888", V1: "/sysDictionaryDetail/deleteSysDictionaryDetail", V2: "DELETE"},
{PType: "p", V0: "888", V1: "/sysDictionaryDetail/updateSysDictionaryDetail", V2: "PUT"},
{PType: "p", V0: "888", V1: "/sysDictionaryDetail/findSysDictionaryDetail", V2: "GET"},
{PType: "p", V0: "888", V1: "/sysDictionaryDetail/getSysDictionaryDetailList", V2: "GET"},
{PType: "p", V0: "888", V1: "/sysDictionary/createSysDictionary", V2: "POST"},
{PType: "p", V0: "888", V1: "/sysDictionary/deleteSysDictionary", V2: "DELETE"},
{PType: "p", V0: "888", V1: "/sysDictionary/updateSysDictionary", V2: "PUT"},
{PType: "p", V0: "888", V1: "/sysDictionary/findSysDictionary", V2: "GET"},
{PType: "p", V0: "888", V1: "/sysDictionary/getSysDictionaryList", V2: "GET"},
{PType: "p", V0: "888", V1: "/sysOperationRecord/createSysOperationRecord", V2: "POST"},
{PType: "p", V0: "888", V1: "/sysOperationRecord/deleteSysOperationRecord", V2: "DELETE"},
{PType: "p", V0: "888", V1: "/sysOperationRecord/updateSysOperationRecord", V2: "PUT"},
{PType: "p", V0: "888", V1: "/sysOperationRecord/findSysOperationRecord", V2: "GET"},
{PType: "p", V0: "888", V1: "/sysOperationRecord/getSysOperationRecordList", V2: "GET"},
{PType: "p", V0: "888", V1: "/sysOperationRecord/deleteSysOperationRecordByIds", V2: "DELETE"},
{PType: "p", V0: "888", V1: "/user/setUserInfo", V2: "PUT"},
{PType: "p", V0: "888", V1: "/email/emailTest", V2: "POST"},
{PType: "p", V0: "888", V1: "/simpleUploader/upload", V2: "POST"},
{PType: "p", V0: "888", V1: "/simpleUploader/checkFileMd5", V2: "GET"},
{PType: "p", V0: "888", V1: "/simpleUploader/mergeFileMd5", V2: "GET"},
{PType: "p", V0: "888", V1: "/excel/importExcel", V2: "POST"},
{PType: "p", V0: "888", V1: "/excel/loadExcel", V2: "GET"},
{PType: "p", V0: "888", V1: "/excel/exportExcel", V2: "POST"},
{PType: "p", V0: "888", V1: "/excel/downloadTemplate", V2: "GET"},
{PType: "p", V0: "888", V1: "/api/deleteApisByIds", V2: "DELETE"},
{PType: "p", V0: "8881", V1: "/base/login", V2: "POST"},
{PType: "p", V0: "8881", V1: "/user/register", V2: "POST"},
{PType: "p", V0: "8881", V1: "/api/createApi", V2: "POST"},
{PType: "p", V0: "8881", V1: "/api/getApiList", V2: "POST"},
{PType: "p", V0: "8881", V1: "/api/getApiById", V2: "POST"},
{PType: "p", V0: "8881", V1: "/api/deleteApi", V2: "POST"},
{PType: "p", V0: "8881", V1: "/api/updateApi", V2: "POST"},
{PType: "p", V0: "8881", V1: "/api/getAllApis", V2: "POST"},
{PType: "p", V0: "8881", V1: "/authority/createAuthority", V2: "POST"},
{PType: "p", V0: "8881", V1: "/authority/deleteAuthority", V2: "POST"},
{PType: "p", V0: "8881", V1: "/authority/getAuthorityList", V2: "POST"},
{PType: "p", V0: "8881", V1: "/authority/setDataAuthority", V2: "POST"},
{PType: "p", V0: "8881", V1: "/menu/getMenu", V2: "POST"},
{PType: "p", V0: "8881", V1: "/menu/getMenuList", V2: "POST"},
{PType: "p", V0: "8881", V1: "/menu/addBaseMenu", V2: "POST"},
{PType: "p", V0: "8881", V1: "/menu/getBaseMenuTree", V2: "POST"},
{PType: "p", V0: "8881", V1: "/menu/addMenuAuthority", V2: "POST"},
{PType: "p", V0: "8881", V1: "/menu/getMenuAuthority", V2: "POST"},
{PType: "p", V0: "8881", V1: "/menu/deleteBaseMenu", V2: "POST"},
{PType: "p", V0: "8881", V1: "/menu/updateBaseMenu", V2: "POST"},
{PType: "p", V0: "8881", V1: "/menu/getBaseMenuById", V2: "POST"},
{PType: "p", V0: "8881", V1: "/user/changePassword", V2: "POST"},
{PType: "p", V0: "8881", V1: "/user/getUserList", V2: "POST"},
{PType: "p", V0: "8881", V1: "/user/setUserAuthority", V2: "POST"},
{PType: "p", V0: "8881", V1: "/fileUploadAndDownload/upload", V2: "POST"},
{PType: "p", V0: "8881", V1: "/fileUploadAndDownload/getFileList", V2: "POST"},
{PType: "p", V0: "8881", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"},
{PType: "p", V0: "8881", V1: "/casbin/updateCasbin", V2: "POST"},
{PType: "p", V0: "8881", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"},
{PType: "p", V0: "8881", V1: "/jwt/jsonInBlacklist", V2: "POST"},
{PType: "p", V0: "8881", V1: "/system/getSystemConfig", V2: "POST"},
{PType: "p", V0: "8881", V1: "/system/setSystemConfig", V2: "POST"},
{PType: "p", V0: "8881", V1: "/customer/customer", V2: "POST"},
{PType: "p", V0: "8881", V1: "/customer/customer", V2: "PUT"},
{PType: "p", V0: "8881", V1: "/customer/customer", V2: "DELETE"},
{PType: "p", V0: "8881", V1: "/customer/customer", V2: "GET"},
{PType: "p", V0: "8881", V1: "/customer/customerList", V2: "GET"},
{PType: "p", V0: "9528", V1: "/base/login", V2: "POST"},
{PType: "p", V0: "9528", V1: "/user/register", V2: "POST"},
{PType: "p", V0: "9528", V1: "/api/createApi", V2: "POST"},
{PType: "p", V0: "9528", V1: "/api/getApiList", V2: "POST"},
{PType: "p", V0: "9528", V1: "/api/getApiById", V2: "POST"},
{PType: "p", V0: "9528", V1: "/api/deleteApi", V2: "POST"},
{PType: "p", V0: "9528", V1: "/api/updateApi", V2: "POST"},
{PType: "p", V0: "9528", V1: "/api/getAllApis", V2: "POST"},
{PType: "p", V0: "9528", V1: "/authority/createAuthority", V2: "POST"},
{PType: "p", V0: "9528", V1: "/authority/deleteAuthority", V2: "POST"},
{PType: "p", V0: "9528", V1: "/authority/getAuthorityList", V2: "POST"},
{PType: "p", V0: "9528", V1: "/authority/setDataAuthority", V2: "POST"},
{PType: "p", V0: "9528", V1: "/menu/getMenu", V2: "POST"},
{PType: "p", V0: "9528", V1: "/menu/getMenuList", V2: "POST"},
{PType: "p", V0: "9528", V1: "/menu/addBaseMenu", V2: "POST"},
{PType: "p", V0: "9528", V1: "/menu/getBaseMenuTree", V2: "POST"},
{PType: "p", V0: "9528", V1: "/menu/addMenuAuthority", V2: "POST"},
{PType: "p", V0: "9528", V1: "/menu/getMenuAuthority", V2: "POST"},
{PType: "p", V0: "9528", V1: "/menu/deleteBaseMenu", V2: "POST"},
{PType: "p", V0: "9528", V1: "/menu/updateBaseMenu", V2: "POST"},
{PType: "p", V0: "9528", V1: "/menu/getBaseMenuById", V2: "POST"},
{PType: "p", V0: "9528", V1: "/user/changePassword", V2: "POST"},
{PType: "p", V0: "9528", V1: "/user/getUserList", V2: "POST"},
{PType: "p", V0: "9528", V1: "/user/setUserAuthority", V2: "POST"},
{PType: "p", V0: "9528", V1: "/fileUploadAndDownload/upload", V2: "POST"},
{PType: "p", V0: "9528", V1: "/fileUploadAndDownload/getFileList", V2: "POST"},
{PType: "p", V0: "9528", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"},
{PType: "p", V0: "9528", V1: "/casbin/updateCasbin", V2: "POST"},
{PType: "p", V0: "9528", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"},
{PType: "p", V0: "9528", V1: "/jwt/jsonInBlacklist", V2: "POST"},
{PType: "p", V0: "9528", V1: "/system/getSystemConfig", V2: "POST"},
{PType: "p", V0: "9528", V1: "/system/setSystemConfig", V2: "POST"},
{PType: "p", V0: "9528", V1: "/customer/customer", V2: "POST"},
{PType: "p", V0: "9528", V1: "/customer/customer", V2: "PUT"},
{PType: "p", V0: "9528", V1: "/customer/customer", V2: "DELETE"},
{PType: "p", V0: "9528", V1: "/customer/customer", V2: "GET"},
{PType: "p", V0: "9528", V1: "/customer/customerList", V2: "GET"},
{PType: "p", V0: "9528", V1: "/autoCode/createTemp", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/base/login", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/user/register", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/api/createApi", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/api/getApiList", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/api/getApiById", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/api/deleteApi", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/api/updateApi", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/api/getAllApis", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/authority/createAuthority", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/authority/deleteAuthority", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/authority/getAuthorityList", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/authority/setDataAuthority", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/authority/updateAuthority", V2: "PUT"},
{Ptype: "p", V0: "888", V1: "/authority/copyAuthority", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/menu/getMenu", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/menu/getMenuList", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/menu/addBaseMenu", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/menu/getBaseMenuTree", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/menu/addMenuAuthority", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/menu/getMenuAuthority", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/menu/deleteBaseMenu", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/menu/updateBaseMenu", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/menu/getBaseMenuById", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/user/changePassword", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/user/getUserList", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/user/setUserAuthority", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/user/deleteUser", V2: "DELETE"},
{Ptype: "p", V0: "888", V1: "/fileUploadAndDownload/upload", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/fileUploadAndDownload/getFileList", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/casbin/updateCasbin", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/casbin/casbinTest/:pathParam", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/jwt/jsonInBlacklist", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/system/getSystemConfig", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/system/setSystemConfig", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/system/getServerInfo", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/customer/customer", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/customer/customer", V2: "PUT"},
{Ptype: "p", V0: "888", V1: "/customer/customer", V2: "DELETE"},
{Ptype: "p", V0: "888", V1: "/customer/customer", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/customer/customerList", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/autoCode/createTemp", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/autoCode/preview", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/autoCode/getTables", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/autoCode/getDB", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/autoCode/getColumn", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/sysDictionaryDetail/createSysDictionaryDetail", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/sysDictionaryDetail/deleteSysDictionaryDetail", V2: "DELETE"},
{Ptype: "p", V0: "888", V1: "/sysDictionaryDetail/updateSysDictionaryDetail", V2: "PUT"},
{Ptype: "p", V0: "888", V1: "/sysDictionaryDetail/findSysDictionaryDetail", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/sysDictionaryDetail/getSysDictionaryDetailList", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/sysDictionary/createSysDictionary", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/sysDictionary/deleteSysDictionary", V2: "DELETE"},
{Ptype: "p", V0: "888", V1: "/sysDictionary/updateSysDictionary", V2: "PUT"},
{Ptype: "p", V0: "888", V1: "/sysDictionary/findSysDictionary", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/sysDictionary/getSysDictionaryList", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/sysOperationRecord/createSysOperationRecord", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/sysOperationRecord/deleteSysOperationRecord", V2: "DELETE"},
{Ptype: "p", V0: "888", V1: "/sysOperationRecord/updateSysOperationRecord", V2: "PUT"},
{Ptype: "p", V0: "888", V1: "/sysOperationRecord/findSysOperationRecord", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/sysOperationRecord/getSysOperationRecordList", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/sysOperationRecord/deleteSysOperationRecordByIds", V2: "DELETE"},
{Ptype: "p", V0: "888", V1: "/user/setUserInfo", V2: "PUT"},
{Ptype: "p", V0: "888", V1: "/email/emailTest", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/simpleUploader/upload", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/simpleUploader/checkFileMd5", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/simpleUploader/mergeFileMd5", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/excel/importExcel", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/excel/loadExcel", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/excel/exportExcel", V2: "POST"},
{Ptype: "p", V0: "888", V1: "/excel/downloadTemplate", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/api/deleteApisByIds", V2: "DELETE"},
{Ptype: "p", V0: "8881", V1: "/base/login", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/user/register", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/api/createApi", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/api/getApiList", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/api/getApiById", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/api/deleteApi", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/api/updateApi", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/api/getAllApis", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/authority/createAuthority", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/authority/deleteAuthority", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/authority/getAuthorityList", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/authority/setDataAuthority", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/menu/getMenu", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/menu/getMenuList", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/menu/addBaseMenu", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/menu/getBaseMenuTree", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/menu/addMenuAuthority", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/menu/getMenuAuthority", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/menu/deleteBaseMenu", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/menu/updateBaseMenu", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/menu/getBaseMenuById", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/user/changePassword", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/user/getUserList", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/user/setUserAuthority", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/fileUploadAndDownload/upload", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/fileUploadAndDownload/getFileList", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/casbin/updateCasbin", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/jwt/jsonInBlacklist", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/system/getSystemConfig", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/system/setSystemConfig", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/customer/customer", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/customer/customer", V2: "PUT"},
{Ptype: "p", V0: "8881", V1: "/customer/customer", V2: "DELETE"},
{Ptype: "p", V0: "8881", V1: "/customer/customer", V2: "GET"},
{Ptype: "p", V0: "8881", V1: "/customer/customerList", V2: "GET"},
{Ptype: "p", V0: "9528", V1: "/base/login", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/user/register", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/api/createApi", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/api/getApiList", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/api/getApiById", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/api/deleteApi", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/api/updateApi", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/api/getAllApis", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/authority/createAuthority", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/authority/deleteAuthority", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/authority/getAuthorityList", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/authority/setDataAuthority", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/menu/getMenu", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/menu/getMenuList", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/menu/addBaseMenu", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/menu/getBaseMenuTree", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/menu/addMenuAuthority", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/menu/getMenuAuthority", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/menu/deleteBaseMenu", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/menu/updateBaseMenu", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/menu/getBaseMenuById", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/user/changePassword", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/user/getUserList", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/user/setUserAuthority", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/fileUploadAndDownload/upload", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/fileUploadAndDownload/getFileList", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/casbin/updateCasbin", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/jwt/jsonInBlacklist", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/system/getSystemConfig", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/system/setSystemConfig", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/customer/customer", V2: "POST"},
{Ptype: "p", V0: "9528", V1: "/customer/customer", V2: "PUT"},
{Ptype: "p", V0: "9528", V1: "/customer/customer", V2: "DELETE"},
{Ptype: "p", V0: "9528", V1: "/customer/customer", V2: "GET"},
{Ptype: "p", V0: "9528", V1: "/customer/customerList", V2: "GET"},
{Ptype: "p", V0: "9528", V1: "/autoCode/createTemp", V2: "POST"},
} }
//@author: [SliverHorn](https://github.com/SliverHorn) //@author: [SliverHorn](https://github.com/SliverHorn)

2
server/utils/directory.go

@ -39,7 +39,7 @@ func CreateDir(dirs ...string) (err error) {
global.GVA_LOG.Debug("create directory" + v) global.GVA_LOG.Debug("create directory" + v)
err = os.MkdirAll(v, os.ModePerm) err = os.MkdirAll(v, os.ModePerm)
if err != nil { if err != nil {
global.GVA_LOG.Error("create directory"+ v, zap.Any(" error:", err))
global.GVA_LOG.Error("create directory"+v, zap.Any(" error:", err))
} }
} }
} }

7
server/utils/server.go

@ -35,7 +35,6 @@ type Cpu struct {
Cores int `json:"cores"` Cores int `json:"cores"`
} }
type Rrm struct { type Rrm struct {
UsedMB int `json:"usedMb"` UsedMB int `json:"usedMb"`
TotalMB int `json:"totalMb"` TotalMB int `json:"totalMb"`
@ -89,9 +88,9 @@ func InitCPU() (c Cpu, err error) {
//@return: r Rrm, err error //@return: r Rrm, err error
func InitRAM() (r Rrm, err error) { func InitRAM() (r Rrm, err error) {
if u, err := mem.VirtualMemory(); err != nil{
if u, err := mem.VirtualMemory(); err != nil {
return r, err return r, err
}else {
} else {
r.UsedMB = int(u.Used) / MB r.UsedMB = int(u.Used) / MB
r.TotalMB = int(u.Total) / MB r.TotalMB = int(u.Total) / MB
r.UsedPercent = int(u.UsedPercent) r.UsedPercent = int(u.UsedPercent)
@ -105,7 +104,7 @@ func InitRAM() (r Rrm, err error) {
//@return: d Disk, err error //@return: d Disk, err error
func InitDisk() (d Disk, err error) { func InitDisk() (d Disk, err error) {
if u, err := disk.Usage("/"); err != nil{
if u, err := disk.Usage("/"); err != nil {
return d, err return d, err
} else { } else {
d.UsedMB = int(u.Used) / MB d.UsedMB = int(u.Used) / MB

1
server/utils/upload/local.go

@ -1,4 +1,5 @@
package upload package upload
import ( import (
"errors" "errors"
"gin-vue-admin/global" "gin-vue-admin/global"

2
server/utils/upload/qiniu.go

@ -60,7 +60,7 @@ func (*Qiniu) DeleteFile(key string) error {
mac := qbox.NewMac(global.GVA_CONFIG.Qiniu.AccessKey, global.GVA_CONFIG.Qiniu.SecretKey) mac := qbox.NewMac(global.GVA_CONFIG.Qiniu.AccessKey, global.GVA_CONFIG.Qiniu.SecretKey)
cfg := qiniuConfig() cfg := qiniuConfig()
bucketManager := storage.NewBucketManager(mac, cfg) bucketManager := storage.NewBucketManager(mac, cfg)
if err := bucketManager.Delete(global.GVA_CONFIG.Qiniu.Bucket, key); err != nil{
if err := bucketManager.Delete(global.GVA_CONFIG.Qiniu.Bucket, key); err != nil {
global.GVA_LOG.Error("function bucketManager.Delete() Filed", zap.Any("err", err.Error())) global.GVA_LOG.Error("function bucketManager.Delete() Filed", zap.Any("err", err.Error()))
return errors.New("function bucketManager.Delete() Filed, err:" + err.Error()) return errors.New("function bucketManager.Delete() Filed, err:" + err.Error())
} }

Loading…
Cancel
Save