forked from golang/hotime
优化代码
This commit is contained in:
parent
79453d4d2a
commit
4038598470
@ -1,7 +1,6 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"math"
|
||||
@ -258,11 +257,10 @@ func ObjToStr(obj interface{}) string {
|
||||
case float64:
|
||||
str = strconv.FormatFloat(obj.(float64), 'f', -1, 64)
|
||||
default:
|
||||
strbte, err := json.Marshal(obj)
|
||||
var configByte bytes.Buffer
|
||||
err = json.Indent(&configByte, strbte, "", "\t")
|
||||
strbte, err := json.MarshalIndent(obj, "", "\t")
|
||||
|
||||
if err == nil {
|
||||
str = configByte.String()
|
||||
str = string(strbte)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,8 +11,8 @@
|
||||
},
|
||||
"db": {
|
||||
"mysql": {
|
||||
"host": "cloud.hoteas.com",
|
||||
"name": "ljf",
|
||||
"host": "192.168.6.250",
|
||||
"name": "reg_gqt",
|
||||
"password": "root",
|
||||
"port": "3306",
|
||||
"prefix": "",
|
||||
|
@ -2,7 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"../../hotime"
|
||||
//"./admin"
|
||||
"./admin"
|
||||
"errors"
|
||||
"fmt"
|
||||
"golang.org/x/net/websocket"
|
||||
@ -58,7 +58,7 @@ func main() {
|
||||
//fmt.Println(common.ObjToStr(makeCode.Db2JSON("admin","test",appIns.Db)))
|
||||
|
||||
appIns.Run(hotime.Router{
|
||||
//"admin": admin.Project,
|
||||
"admin": admin.Project,
|
||||
"app": hotime.Proj{
|
||||
"index": hotime.Ctr{
|
||||
"test": func(this *hotime.Context) {
|
||||
|
Loading…
Reference in New Issue
Block a user