gorm升级到v2版本

This commit is contained in:
linwenxiang
2020-08-27 11:17:15 +08:00
parent 93cfe443d6
commit 60c7496f7b
56 changed files with 630 additions and 477 deletions
+1 -1
View File
@@ -28,4 +28,4 @@ func InitApplication(cfg *viper.Viper) *Application {
}
}
var ApplicationConfig = new(Application)
var ApplicationConfig = new(Application)
-1
View File
@@ -81,4 +81,3 @@ func Setup(path string) {
}
GenConfig = InitGen(cfgGen)
}
+1 -1
View File
@@ -1,9 +1,9 @@
package tools
import (
"fmt"
"os"
"strings"
"fmt"
)
//获取当前路径,比如:E:/abc/data/test
+5 -5
View File
@@ -20,7 +20,7 @@ func GetUserId(c *gin.Context) int {
if data["identity"] != nil {
return int((data["identity"]).(float64))
}
fmt.Println(GetCurrentTimeStr()+" [WARING] " + c.Request.Method + " " + c.Request.URL.Path + " GetUserId 缺少identity")
fmt.Println(GetCurrentTimeStr() + " [WARING] " + c.Request.Method + " " + c.Request.URL.Path + " GetUserId 缺少identity")
return 0
}
@@ -29,7 +29,7 @@ func GetUserIdStr(c *gin.Context) string {
if data["identity"] != nil {
return Int64ToString(int64((data["identity"]).(float64)))
}
fmt.Println(GetCurrentTimeStr()+" [WARING] " + c.Request.Method + " " + c.Request.URL.Path + " GetUserIdStr 缺少identity")
fmt.Println(GetCurrentTimeStr() + " [WARING] " + c.Request.Method + " " + c.Request.URL.Path + " GetUserIdStr 缺少identity")
return ""
}
@@ -38,7 +38,7 @@ func GetUserName(c *gin.Context) string {
if data["nice"] != nil {
return (data["nice"]).(string)
}
fmt.Println(GetCurrentTimeStr()+" [WARING] "+ c.Request.Method +" " + c.Request.URL.Path + " GetUserName 缺少nice")
fmt.Println(GetCurrentTimeStr() + " [WARING] " + c.Request.Method + " " + c.Request.URL.Path + " GetUserName 缺少nice")
return ""
}
@@ -47,7 +47,7 @@ func GetRoleName(c *gin.Context) string {
if data["rolekey"] != nil {
return (data["rolekey"]).(string)
}
fmt.Println(GetCurrentTimeStr()+" [WARING] "+ c.Request.Method +" " + c.Request.URL.Path + " GetRoleName 缺少rolekey")
fmt.Println(GetCurrentTimeStr() + " [WARING] " + c.Request.Method + " " + c.Request.URL.Path + " GetRoleName 缺少rolekey")
return ""
}
@@ -57,6 +57,6 @@ func GetRoleId(c *gin.Context) int {
i := int((data["roleid"]).(float64))
return i
}
fmt.Println(GetCurrentTimeStr()+" [WARING] " + c.Request.Method + " " + c.Request.URL.Path + " GetRoleId 缺少roleid")
fmt.Println(GetCurrentTimeStr() + " [WARING] " + c.Request.Method + " " + c.Request.URL.Path + " GetRoleId 缺少roleid")
return 0
}