This commit is contained in:
parent
3507d2ed74
commit
cf8ba558ca
@ -39,7 +39,7 @@ func (this *Application) Run(router Router) {
|
||||
//this.Port = port
|
||||
this.Port = this.Config.GetString("port")
|
||||
|
||||
if this.connectDbFunc != nil && this.Db.DB.Ping() != nil {
|
||||
if this.connectDbFunc != nil && (this.Db.DB==nil||this.Db.DB.Ping() != nil) {
|
||||
this.Db.SetConnect(this.connectDbFunc)
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,11 @@ func ObjToStr(obj interface{}) string {
|
||||
|
||||
//字符串数组: a1,a2,a3转["a1","a2","a3"]
|
||||
func StrArrayToJsonStr(a string) string {
|
||||
|
||||
if len(a) != 0 {
|
||||
if a[0] == ',' {
|
||||
a = Substr(a, 1, len(a))
|
||||
}
|
||||
a = strings.Replace(a, ",", `","`, -1)
|
||||
a = `["` + a + `"]`
|
||||
} else {
|
||||
@ -256,7 +260,7 @@ func JsonStrToStrArray(a string) string {
|
||||
a = Substr(a, 1, len(a)-2)
|
||||
}
|
||||
|
||||
return a
|
||||
return "," + a
|
||||
}
|
||||
|
||||
//字符串转int
|
||||
|
Loading…
Reference in New Issue
Block a user