Skip to content

Commit 1845e2d

Browse files
committed
mg
2 parents 61fad9e + f8a671a commit 1845e2d

File tree

16 files changed

+37
-23
lines changed

16 files changed

+37
-23
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,11 @@ swag init
306306
如果你觉得这个项目对你有帮助,你可以请作者喝饮料 :tropical_drink: [点我](https://www.gin-vue-admin.com/docs/coffee)
307307

308308
## 10. 友情链接
309-
310-
[H5-Dooring | H5页面制作神器](https://github.com/MrXujiang/h5-Dooring)
311-
309+
310+
[H5-Dooring | H5页面制作神器](https://github.com/MrXujiang/h5-Dooring)
311+
312+
[go-zero 微服务框架|缩短从需求到上线的距离](https://github.com/zeromicro/go-zero)
313+
312314
## 11. 商用注意事项
313315

314316
如果您将此项目用于商业用途,请遵守Apache2.0协议并保留作者技术支持声明。

server/api/v1/example/exa_excel.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package example
22

33
import (
4+
"os"
5+
46
"github.com/flipped-aurora/gin-vue-admin/server/global"
57
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
68
"github.com/flipped-aurora/gin-vue-admin/server/model/example"
7-
"github.com/flipped-aurora/gin-vue-admin/server/utils"
89
"github.com/gin-gonic/gin"
910
"go.uber.org/zap"
1011
)
@@ -89,12 +90,18 @@ func (e *ExcelApi) LoadExcel(c *gin.Context) {
8990
func (e *ExcelApi) DownloadTemplate(c *gin.Context) {
9091
fileName := c.Query("fileName")
9192
filePath := global.GVA_CONFIG.Excel.Dir + fileName
92-
ok, err := utils.PathExists(filePath)
93-
if !ok || err != nil {
93+
94+
fi, err := os.Stat(filePath)
95+
if err != nil {
9496
global.GVA_LOG.Error("文件不存在!", zap.Error(err))
9597
response.FailWithMessage("文件不存在", c)
9698
return
9799
}
100+
if fi.IsDir() {
101+
global.GVA_LOG.Error("不支持下载文件夹!", zap.Error(err))
102+
response.FailWithMessage("不支持下载文件夹", c)
103+
return
104+
}
98105
c.Writer.Header().Add("success", "true")
99106
c.File(filePath)
100107
}

server/api/v1/system/sys_user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (b *BaseApi) tokenNext(c *gin.Context, user system.SysUser) {
105105
// @Produce application/json
106106
// @Param data body systemReq.Register true "用户名, 昵称, 密码, 角色ID"
107107
// @Success 200 {object} response.Response{data=systemRes.SysUserResponse,msg=string} "用户注册账号,返回包括用户信息"
108-
// @Router /user/register [post]
108+
// @Router /user/admin_register [post]
109109
func (b *BaseApi) Register(c *gin.Context) {
110110
var r systemReq.Register
111111
_ = c.ShouldBindJSON(&r)

server/model/system/request/sys_casbin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func DefaultCasbin() []CasbinInfo {
1717
{Path: "/menu/getMenu", Method: "POST"},
1818
{Path: "/jwt/jsonInBlacklist", Method: "POST"},
1919
{Path: "/base/login", Method: "POST"},
20-
{Path: "/user/register", Method: "POST"},
20+
{Path: "/user/admin_register", Method: "POST"},
2121
{Path: "/user/changePassword", Method: "POST"},
2222
{Path: "/user/setUserAuthority", Method: "POST"},
2323
{Path: "/user/setUserInfo", Method: "PUT"},

server/resource/template/web/table.vue.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<el-button size="small" type="primary" @click="onDelete">确定</el-button>
3838
</div>
3939
<template #reference>
40-
<el-button icon="delete" size="small" style="margin-left: 10px;" :disabled="!multipleSelection.length">删除</el-button>
40+
<el-button icon="delete" size="small" style="margin-left: 10px;" :disabled="!multipleSelection.length" @click="deleteVisible = true">删除</el-button>
4141
</template>
4242
</el-popover>
4343
</div>

server/router/system/sys_user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func (s *UserRouter) InitUserRouter(Router *gin.RouterGroup) {
1313
userRouterWithoutRecord := Router.Group("user")
1414
baseApi := v1.ApiGroupApp.SystemApiGroup.BaseApi
1515
{
16-
userRouter.POST("register", baseApi.Register) // 用户注册账号
16+
userRouter.POST("admin_register", baseApi.Register) // 管理员注册账号
1717
userRouter.POST("changePassword", baseApi.ChangePassword) // 用户修改密码
1818
userRouter.POST("setUserAuthority", baseApi.SetUserAuthority) // 设置用户权限
1919
userRouter.DELETE("deleteUser", baseApi.DeleteUser) // 删除用户

server/service/system/sys_api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package system
22

33
import (
44
"errors"
5+
"fmt"
56

67
"github.com/flipped-aurora/gin-vue-admin/server/global"
78
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
@@ -89,6 +90,9 @@ func (apiService *ApiService) GetAPIInfoList(api system.SysApi, info request.Pag
8990
} else {
9091
OrderStr = order
9192
}
93+
} else { // didn't matched any order key in `orderMap`
94+
err = fmt.Errorf("非法的排序字段: %v", order)
95+
return err, apiList, total
9296
}
9397

9498
err = db.Order(OrderStr).Find(&apiList).Error

server/service/system/sys_initdb.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ type InitDBService struct{}
2020
func (initDBService *InitDBService) InitDB(conf request.InitDB) error {
2121
switch conf.DBType {
2222
case "mysql":
23-
return initDBService.initMsqlDB(conf)
23+
return initDBService.initMysqlDB(conf)
2424
case "pgsql":
2525
return initDBService.initPgsqlDB(conf)
2626
default:
27-
return initDBService.initMsqlDB(conf)
27+
return initDBService.initMysqlDB(conf)
2828
}
2929
}
3030

server/service/system/sys_initdb_mysql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ func (initDBService *InitDBService) writeMysqlConfig(mysql config.Mysql) error {
2929
return global.GVA_VP.WriteConfig()
3030
}
3131

32-
// initMsqlDB 创建数据库并初始化 mysql
32+
// initMysqlDB 创建数据库并初始化 mysql
3333
// Author [piexlmax](https://github.com/piexlmax)
3434
// Author [SliverHorn](https://github.com/SliverHorn)
3535
// Author: [songzhibin97](https://github.com/songzhibin97)
36-
func (initDBService *InitDBService) initMsqlDB(conf request.InitDB) error {
36+
func (initDBService *InitDBService) initMysqlDB(conf request.InitDB) error {
3737
dsn := conf.MysqlEmptyDsn()
3838
createSql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS `%s` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;", conf.DBName)
3939
if err := initDBService.createDatabase(dsn, "mysql", createSql); err != nil {

server/source/system/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func (a *api) Initialize() error {
2222
{ApiGroup: "jwt", Method: "POST", Path: "/jwt/jsonInBlacklist", Description: "jwt加入黑名单(退出,必选)"},
2323

2424
{ApiGroup: "系统用户", Method: "DELETE", Path: "/user/deleteUser", Description: "删除用户"},
25-
{ApiGroup: "系统用户", Method: "POST", Path: "/user/register", Description: "用户注册"},
25+
{ApiGroup: "系统用户", Method: "POST", Path: "/user/admin_register", Description: "用户注册"},
2626
{ApiGroup: "系统用户", Method: "POST", Path: "/user/getUserList", Description: "获取用户列表"},
2727
{ApiGroup: "系统用户", Method: "PUT", Path: "/user/setUserInfo", Description: "设置用户信息"},
2828
{ApiGroup: "系统用户", Method: "PUT", Path: "/user/setSelfInfo", Description: "设置自身信息(必选)"},

0 commit comments

Comments
 (0)