Skip to content

Commit 8bf33f1

Browse files
author
piexlmax
committed
Merge branch 'main' of github.com:flipped-aurora/gin-vue-admin
2 parents 6c67c8a + 8957a25 commit 8bf33f1

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

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 {

0 commit comments

Comments
 (0)