This commit is contained in:
hoteas 2017-10-30 08:23:42 +00:00
parent 3507d2ed74
commit cf8ba558ca
2 changed files with 6 additions and 2 deletions

View File

@ -39,7 +39,7 @@ func (this *Application) Run(router Router) {
//this.Port = port //this.Port = port
this.Port = this.Config.GetString("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) this.Db.SetConnect(this.connectDbFunc)
} }

View File

@ -240,7 +240,11 @@ func ObjToStr(obj interface{}) string {
//字符串数组: a1,a2,a3转["a1","a2","a3"] //字符串数组: a1,a2,a3转["a1","a2","a3"]
func StrArrayToJsonStr(a string) string { func StrArrayToJsonStr(a string) string {
if len(a) != 0 { if len(a) != 0 {
if a[0] == ',' {
a = Substr(a, 1, len(a))
}
a = strings.Replace(a, ",", `","`, -1) a = strings.Replace(a, ",", `","`, -1)
a = `["` + a + `"]` a = `["` + a + `"]`
} else { } else {
@ -256,7 +260,7 @@ func JsonStrToStrArray(a string) string {
a = Substr(a, 1, len(a)-2) a = Substr(a, 1, len(a)-2)
} }
return a return "," + a
} }
//字符串转int //字符串转int