33 lines
599 B
Go
33 lines
599 B
Go
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"mongo.games.com/goserver/core/logger"
|
|
"os"
|
|
)
|
|
|
|
type FishPath struct {
|
|
Id int32
|
|
Stay int32
|
|
Length int32
|
|
}
|
|
type fishPathFile struct {
|
|
Count int32
|
|
Pools []FishPath
|
|
}
|
|
|
|
var FishPathPath = "../data/fishpath/path.json"
|
|
|
|
func GetFishPath() []FishPath {
|
|
buf, err := os.ReadFile(FishPathPath)
|
|
if err != nil {
|
|
logger.Logger.Warn("GetFishPath os.ReadFile error ->", err)
|
|
}
|
|
var fileData = &fishPathFile{}
|
|
err = json.Unmarshal(buf, fileData)
|
|
if err != nil {
|
|
logger.Logger.Warn("GetFishPath json.Unmarshal error ->", err)
|
|
}
|
|
return fileData.Pools
|
|
}
|