工具支持读json配置
This commit is contained in:
parent
36c72fafb2
commit
7987fcbcbf
@ -1,7 +1,7 @@
|
||||
package main_test
|
||||
|
||||
import (
|
||||
cfg "go_dreamfactory/cmd/v2/configure/structs"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"go_dreamfactory/cmd/v2/lib/common"
|
||||
"html/template"
|
||||
"os"
|
||||
@ -9,12 +9,12 @@ import (
|
||||
)
|
||||
|
||||
type TaskCond struct {
|
||||
Data map[int32]*cfg.GameTaskCondData
|
||||
Data map[int32]*cfg.GameRdtaskCondiData
|
||||
}
|
||||
|
||||
func TestTask(t *testing.T) {
|
||||
if tb, err := cfg.NewTables(common.Loader); err == nil {
|
||||
data := tb.TaskCond.GetDataMap()
|
||||
data := tb.RdtaskCondi.GetDataMap()
|
||||
|
||||
tmpl := template.New("task")
|
||||
tplTxt := `reqDataMap := map[int32]TaskCondi{
|
||||
|
@ -162,7 +162,8 @@ func ConvertFileSize(size int64) string {
|
||||
}
|
||||
|
||||
func Loader(file string) ([]map[string]interface{}, error) {
|
||||
if bytes, err := ioutil.ReadFile("./json/" + file + ".json"); err != nil {
|
||||
path := filepath.Join("E:\\projects\\workspace\\go_dreamfactory\\bin\\json", file+".json")
|
||||
if bytes, err := ioutil.ReadFile(path); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
jsonData := make([]map[string]interface{}, 0)
|
||||
|
@ -1,7 +1,6 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
cfg "go_dreamfactory/cmd/v2/configure/structs"
|
||||
"go_dreamfactory/cmd/v2/lib"
|
||||
"go_dreamfactory/cmd/v2/lib/common"
|
||||
"go_dreamfactory/cmd/v2/lib/storage"
|
||||
@ -9,6 +8,7 @@ import (
|
||||
"go_dreamfactory/cmd/v2/service/observer"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -2,7 +2,6 @@ package ui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
cfg "go_dreamfactory/cmd/v2/configure/structs"
|
||||
"go_dreamfactory/cmd/v2/lib"
|
||||
"go_dreamfactory/cmd/v2/lib/common"
|
||||
"go_dreamfactory/cmd/v2/lib/storage"
|
||||
@ -10,6 +9,7 @@ import (
|
||||
"go_dreamfactory/cmd/v2/service/observer"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user