奇淼(piexlmax
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
4 deletions
-
server/core/viper.go
-
server/utils/fmt_plus.go
-
web/src/permission.js
|
@ -36,6 +36,7 @@ func Viper(path ...string) *viper.Viper { |
|
|
|
|
|
|
|
|
v := viper.New() |
|
|
v := viper.New() |
|
|
v.SetConfigFile(config) |
|
|
v.SetConfigFile(config) |
|
|
|
|
|
v.SetConfigType("yaml") |
|
|
err := v.ReadInConfig() |
|
|
err := v.ReadInConfig() |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
panic(fmt.Errorf("Fatal error config file: %s \n", err)) |
|
|
panic(fmt.Errorf("Fatal error config file: %s \n", err)) |
|
|
|
@ -18,7 +18,11 @@ func StructToMap(obj interface{}) map[string]interface{} { |
|
|
|
|
|
|
|
|
var data = make(map[string]interface{}) |
|
|
var data = make(map[string]interface{}) |
|
|
for i := 0; i < obj1.NumField(); i++ { |
|
|
for i := 0; i < obj1.NumField(); i++ { |
|
|
data[obj1.Field(i).Name] = obj2.Field(i).Interface() |
|
|
|
|
|
|
|
|
if obj1.Field(i).Tag.Get("mapstructure") != "" { |
|
|
|
|
|
data[obj1.Field(i).Tag.Get("mapstructure")] = obj2.Field(i).Interface() |
|
|
|
|
|
} else { |
|
|
|
|
|
data[obj1.Field(i).Name] = obj2.Field(i).Interface() |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
return data |
|
|
return data |
|
|
} |
|
|
} |
|
|
|
@ -24,9 +24,7 @@ router.beforeEach(async (to, from, next) => { |
|
|
asyncRouterFlag++ |
|
|
asyncRouterFlag++ |
|
|
await store.dispatch('router/SetAsyncRouter') |
|
|
await store.dispatch('router/SetAsyncRouter') |
|
|
const asyncRouters = store.getters['router/asyncRouters'] |
|
|
const asyncRouters = store.getters['router/asyncRouters'] |
|
|
asyncRouters.forEach(item => { |
|
|
|
|
|
router.addRoute(item) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
router.addRoutes(asyncRouters) |
|
|
next({ ...to, replace: true }) |
|
|
next({ ...to, replace: true }) |
|
|
} else { |
|
|
} else { |
|
|
if (to.matched.length) { |
|
|
if (to.matched.length) { |
|
|