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