mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-20 17:57:54 +00:00
Fix problems modifying personal information,Upgrade route configuration format
This commit is contained in:
@@ -4,6 +4,7 @@ var (
|
||||
CreatedSuccess = "创建成功!"
|
||||
UpdatedSuccess = "更新成功!"
|
||||
DeletedSuccess = "删除成功!"
|
||||
DeletedFail = "删除失败!"
|
||||
GetSuccess = "查询成功!"
|
||||
NotFound = "未找到相关内容或者数据为空!"
|
||||
)
|
||||
|
||||
@@ -14,9 +14,6 @@ var cfgApplication *viper.Viper
|
||||
var cfgJwt *viper.Viper
|
||||
var cfgLog *viper.Viper
|
||||
|
||||
//func init() {
|
||||
// InitConfig("settings.dev")
|
||||
//}
|
||||
|
||||
//载入配置文件
|
||||
func ConfigSetup(path string) {
|
||||
@@ -58,9 +55,6 @@ func ConfigSetup(path string) {
|
||||
LogConfig = InitLog(cfgLog)
|
||||
}
|
||||
|
||||
func SetApplicationIsInit() {
|
||||
SetConfig("./config", "settings.application.isInit", false)
|
||||
}
|
||||
|
||||
func SetConfig(configPath string, key string, value interface{}) {
|
||||
viper.AddConfigPath(configPath)
|
||||
|
||||
@@ -53,3 +53,16 @@ func JsonStrToMap(e string) (map[string]interface{}, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
func StructToMap(data interface{}) (map[string]interface{}, error) {
|
||||
dataBytes, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mapData := make(map[string]interface{})
|
||||
err = json.Unmarshal(dataBytes, &mapData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mapData, nil
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,6 @@ func StrToInt(err error, index string) int {
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
func CompareHashAndPassword(e string, p string) (bool, error) {
|
||||
err := bcrypt.CompareHashAndPassword([]byte(e), []byte(p))
|
||||
if err != nil {
|
||||
@@ -50,6 +49,7 @@ func HasError(err error, msg string, code ...int) {
|
||||
if msg == "" {
|
||||
msg = err.Error()
|
||||
}
|
||||
log.Println(err)
|
||||
panic("CustomError#" + strconv.Itoa(statusCode) + "#" + msg)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user