This commit is contained in:
azw 2024-08-03 16:22:56 +08:00
parent c91d72bb1a
commit d143a38f6e
8 changed files with 102 additions and 65 deletions

64
.idea/workspace.xml generated
View File

@ -4,15 +4,32 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="fca4d8d0-8602-4587-a207-260dbd5fab5a" name="Changes" comment="" /> <list default="true" id="fca4d8d0-8602-4587-a207-260dbd5fab5a" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/third_party/f5/sysutils_unix.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/third_party/f5/sysutils_windows.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/adminserver/mt/Permission.go" beforeDir="false" afterPath="$PROJECT_DIR$/server/adminserver/mt/Permission.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/backtask/mt/Contract.go" beforeDir="false" afterPath="$PROJECT_DIR$/server/backtask/mt/Contract.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/light_backtask/mt/Contract.go" beforeDir="false" afterPath="$PROJECT_DIR$/server/light_backtask/mt/Contract.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/marketserver/mt/Contract.go" beforeDir="false" afterPath="$PROJECT_DIR$/server/marketserver/mt/Contract.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/nftserver/mt/Contract.go" beforeDir="false" afterPath="$PROJECT_DIR$/server/nftserver/mt/Contract.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/third_party/f5/metatable.go" beforeDir="false" afterPath="$PROJECT_DIR$/third_party/f5/metatable.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" /> <option name="LAST_RESOLUTION" value="IGNORE" />
</component> </component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Go File" />
</list>
</option>
</component>
<component name="GOROOT" url="file://C:/Program Files/Go" /> <component name="GOROOT" url="file://C:/Program Files/Go" />
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/third_party/f5" />
<option name="ROOT_SYNC" value="DONT_SYNC" /> <option name="ROOT_SYNC" value="DONT_SYNC" />
</component> </component>
<component name="NamedScopeManager"> <component name="NamedScopeManager">
@ -31,6 +48,9 @@
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent"><![CDATA[{
"keyToString": { "keyToString": {
"DefaultGoTemplateProperty": "Go File",
"Go Build.adminserver.executor": "Debug",
"Go Build.backtask.executor": "Debug",
"Go Build.go build adminserver.executor": "Run", "Go Build.go build adminserver.executor": "Run",
"Go Build.go build game2006go/.executor": "Run", "Go Build.go build game2006go/.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true", "RunOnceActivity.ShowReadmeOnStart": "true",
@ -38,18 +58,25 @@
"RunOnceActivity.go.migrated.go.modules.settings": "true", "RunOnceActivity.go.migrated.go.modules.settings": "true",
"RunOnceActivity.go.modules.automatic.dependencies.download": "true", "RunOnceActivity.go.modules.automatic.dependencies.download": "true",
"RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true", "RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
"git-widget-placeholder": "goland", "git-widget-placeholder": "master",
"go.import.settings.migrated": "true", "go.import.settings.migrated": "true",
"go.sdk.automatically.set": "true", "go.sdk.automatically.set": "true",
"last_opened_file_path": "D:/opensource/game2006go/bin/adminserver/bin", "last_opened_file_path": "D:/opensource/game2006go/third_party/f5",
"node.js.detected.package.eslint": "true", "node.js.detected.package.eslint": "true",
"node.js.selected.package.eslint": "(autodetect)", "node.js.selected.package.eslint": "(autodetect)",
"nodejs_package_manager_path": "npm", "nodejs_package_manager_path": "npm",
"run.code.analysis.last.selected.profile": "aDefault", "run.code.analysis.last.selected.profile": "aDefault",
"settings.editor.selected.configurable": "preferences.lookFeel" "settings.editor.selected.configurable": "preferences.lookFeel",
"ts.external.directory.path": "C:\\Users\\azw\\Desktop\\goland\\plugins\\javascript-plugin\\jsLanguageServicesImpl\\external"
} }
}]]></component> }]]></component>
<component name="RunManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\opensource\game2006go\third_party\f5" />
<recent name="D:\opensource\game2006go\third_party\q5" />
</key>
</component>
<component name="RunManager" selected="Go Build.backtask">
<configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application"> <configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="game2006go" /> <module name="game2006go" />
<working_directory value="$PROJECT_DIR$" /> <working_directory value="$PROJECT_DIR$" />
@ -68,6 +95,20 @@
<output_directory value="$PROJECT_DIR$/bin/adminserver/bin" /> <output_directory value="$PROJECT_DIR$/bin/adminserver/bin" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="backtask" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="game2006go" />
<working_directory value="$PROJECT_DIR$/bin/backtask/bin" />
<parameters value="-n1 -i1" />
<kind value="FILE" />
<directory value="$PROJECT_DIR$/server/adminserver" />
<filePath value="$PROJECT_DIR$/server/backtask/main.go" />
<output_directory value="$PROJECT_DIR$/bin/backtask/bin" />
<method v="2" />
</configuration>
<list>
<item itemvalue="Go Build.adminserver" />
<item itemvalue="Go Build.backtask" />
</list>
</component> </component>
<component name="SharedIndexes"> <component name="SharedIndexes">
<attachedChunks> <attachedChunks>
@ -84,4 +125,15 @@
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>
</component> </component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/server/adminserver/main.go</url>
<line>7</line>
<option name="timeStamp" value="1" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project> </project>

View File

@ -1,11 +1,10 @@
package mt package mt
import ( import (
"bufio"
"encoding/json" "encoding/json"
"f5"
"fmt" "fmt"
"main/constant" "main/constant"
"os"
"q5" "q5"
"strings" "strings"
) )
@ -26,9 +25,7 @@ func (this *PermissionTable) IsNoLoad() bool {
func (this *PermissionTable) Load() { func (this *PermissionTable) Load() {
this.accountPermission = new(q5.ConcurrentMap[string, *Permission]) this.accountPermission = new(q5.ConcurrentMap[string, *Permission])
{ {
if f, err := os.Open("../config/permission.json"); err == nil { if jsonStr, err := f5.ReadJsonFile("../config/permission.json"); err == nil {
jsonStr, _ := bufio.NewReader(f).ReadString(0)
type cfgPermission struct { type cfgPermission struct {
API []string `json:"api"` API []string `json:"api"`
UI []string `json:"ui"` UI []string `json:"ui"`

View File

@ -1,12 +1,11 @@
package mt package mt
import ( import (
"q5"
"fmt"
"os"
"strings"
"encoding/json" "encoding/json"
"bufio" "f5"
"fmt"
"q5"
"strings"
) )
type Contract struct { type Contract struct {
@ -41,8 +40,7 @@ func (this *ContractTable) Load() {
this.netIdAddressHash = new(q5.ConcurrentMap[string, *Contract]) this.netIdAddressHash = new(q5.ConcurrentMap[string, *Contract])
nets := []interface{}{} nets := []interface{}{}
{ {
if f, err := os.Open("../config/nets.json"); err == nil { if jsonStr, err := f5.ReadJsonFile("../config/nets.json"); err == nil {
jsonStr, _ := bufio.NewReader(f).ReadString(0)
if err := json.Unmarshal([]byte(jsonStr), &nets); err != nil { if err := json.Unmarshal([]byte(jsonStr), &nets); err != nil {
panic(fmt.Sprintf("load metafile json decode error %s %s", "nets.json", err)) panic(fmt.Sprintf("load metafile json decode error %s %s", "nets.json", err))
} }
@ -54,8 +52,7 @@ func (this *ContractTable) Load() {
for _, val := range nets { for _, val := range nets {
netId := q5.SafeToInt32(val) netId := q5.SafeToInt32(val)
fileName := fmt.Sprintf("../config/nets/%d/contract.json", netId) fileName := fmt.Sprintf("../config/nets/%d/contract.json", netId)
if f, err := os.Open(fileName); err == nil { if jsonStr, err := f5.ReadJsonFile(fileName); err == nil {
jsonStr, _ := bufio.NewReader(f).ReadString(0)
contracts := []struct { contracts := []struct {
Name string `json:"name"` Name string `json:"name"`
Address string `json:"address"` Address string `json:"address"`

View File

@ -1,12 +1,11 @@
package mt package mt
import ( import (
"q5"
"fmt"
"os"
"strings"
"encoding/json" "encoding/json"
"bufio" "f5"
"fmt"
"q5"
"strings"
) )
type Contract struct { type Contract struct {
@ -41,8 +40,7 @@ func (this *ContractTable) Load() {
this.netIdAddressHash = new(q5.ConcurrentMap[string, *Contract]) this.netIdAddressHash = new(q5.ConcurrentMap[string, *Contract])
nets := []interface{}{} nets := []interface{}{}
{ {
if f, err := os.Open("../config/nets.json"); err == nil { if jsonStr, err := f5.ReadJsonFile("../config/nets.json"); err == nil {
jsonStr, _ := bufio.NewReader(f).ReadString(0)
if err := json.Unmarshal([]byte(jsonStr), &nets); err != nil { if err := json.Unmarshal([]byte(jsonStr), &nets); err != nil {
panic(fmt.Sprintf("load metafile json decode error %s %s", "nets.json", err)) panic(fmt.Sprintf("load metafile json decode error %s %s", "nets.json", err))
} }
@ -54,8 +52,7 @@ func (this *ContractTable) Load() {
for _, val := range nets { for _, val := range nets {
netId := q5.SafeToInt32(val) netId := q5.SafeToInt32(val)
fileName := fmt.Sprintf("../config/nets/%d/contract.json", netId) fileName := fmt.Sprintf("../config/nets/%d/contract.json", netId)
if f, err := os.Open(fileName); err == nil { if jsonStr, err := f5.ReadJsonFile(fileName); err == nil {
jsonStr, _ := bufio.NewReader(f).ReadString(0)
contracts := []struct { contracts := []struct {
Name string `json:"name"` Name string `json:"name"`
Address string `json:"address"` Address string `json:"address"`

View File

@ -1,12 +1,11 @@
package mt package mt
import ( import (
"q5"
"fmt"
"os"
"strings"
"encoding/json" "encoding/json"
"bufio" "f5"
"fmt"
"q5"
"strings"
) )
type Contract struct { type Contract struct {
@ -36,8 +35,7 @@ func (this *ContractTable) Load() {
this.netIdAddressHash = new(q5.ConcurrentMap[string, *Contract]) this.netIdAddressHash = new(q5.ConcurrentMap[string, *Contract])
nets := []interface{}{} nets := []interface{}{}
{ {
if f, err := os.Open("../config/nets.json"); err == nil { if jsonStr, err := f5.ReadJsonFile("../config/nets.json"); err == nil {
jsonStr, _ := bufio.NewReader(f).ReadString(0)
if err := json.Unmarshal([]byte(jsonStr), &nets); err != nil { if err := json.Unmarshal([]byte(jsonStr), &nets); err != nil {
panic(fmt.Sprintf("load metafile json decode error %s %s", "nets.json", err)) panic(fmt.Sprintf("load metafile json decode error %s %s", "nets.json", err))
} }
@ -49,8 +47,7 @@ func (this *ContractTable) Load() {
for _, val := range nets { for _, val := range nets {
netId := q5.SafeToInt32(val) netId := q5.SafeToInt32(val)
fileName := fmt.Sprintf("../config/nets/%d/contract.json", netId) fileName := fmt.Sprintf("../config/nets/%d/contract.json", netId)
if f, err := os.Open(fileName); err == nil { if jsonStr, err := f5.ReadJsonFile(fileName); err == nil {
jsonStr, _ := bufio.NewReader(f).ReadString(0)
contracts := []struct { contracts := []struct {
Name string `json:"name"` Name string `json:"name"`
Address string `json:"address"` Address string `json:"address"`

View File

@ -1,12 +1,11 @@
package mt package mt
import ( import (
"q5"
"fmt"
"os"
"strings"
"encoding/json" "encoding/json"
"bufio" "f5"
"fmt"
"q5"
"strings"
) )
type Contract struct { type Contract struct {
@ -34,8 +33,7 @@ func (this *ContractTable) Load() {
this.netIdNameHash = new(q5.ConcurrentMap[string, *Contract]) this.netIdNameHash = new(q5.ConcurrentMap[string, *Contract])
nets := []interface{}{} nets := []interface{}{}
{ {
if f, err := os.Open("../config/nets.json"); err == nil { if jsonStr, err := f5.ReadJsonFile("../config/nets.json"); err == nil {
jsonStr, _ := bufio.NewReader(f).ReadString(0)
if err := json.Unmarshal([]byte(jsonStr), &nets); err != nil { if err := json.Unmarshal([]byte(jsonStr), &nets); err != nil {
panic(fmt.Sprintf("load metafile json decode error %s %s", "nets.json", err)) panic(fmt.Sprintf("load metafile json decode error %s %s", "nets.json", err))
} }
@ -47,8 +45,7 @@ func (this *ContractTable) Load() {
for _, val := range nets { for _, val := range nets {
netId := q5.SafeToInt32(val) netId := q5.SafeToInt32(val)
fileName := fmt.Sprintf("../config/nets/%d/contract.json", netId) fileName := fmt.Sprintf("../config/nets/%d/contract.json", netId)
if f, err := os.Open(fileName); err == nil { if jsonStr, err := f5.ReadJsonFile(fileName); err == nil {
jsonStr, _ := bufio.NewReader(f).ReadString(0)
contracts := []struct { contracts := []struct {
Name string `json:"name"` Name string `json:"name"`
Address string `json:"address"` Address string `json:"address"`

2
third_party/f5 vendored

@ -1 +1 @@
Subproject commit 461f66af6a994d308e6db1b5ac660e1ed3fd2e5f Subproject commit 8d8e92d31e2dfb27c7c87a2b5f92fe71dae9724d

2
third_party/q5 vendored

@ -1 +1 @@
Subproject commit d40b258a47c4fd8f74a2afe6b856827a3cd3253b Subproject commit ba4b733a804045ae931cbef0c2aebb8b1a636ed7