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" />
</component>
<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="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</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="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" />
</component>
<component name="NamedScopeManager">
@ -31,6 +48,9 @@
</component>
<component name="PropertiesComponent"><![CDATA[{
"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 game2006go/.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true",
@ -38,18 +58,25 @@
"RunOnceActivity.go.migrated.go.modules.settings": "true",
"RunOnceActivity.go.modules.automatic.dependencies.download": "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.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.selected.package.eslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"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 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">
<module name="game2006go" />
<working_directory value="$PROJECT_DIR$" />
@ -68,6 +95,20 @@
<output_directory value="$PROJECT_DIR$/bin/adminserver/bin" />
<method v="2" />
</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 name="SharedIndexes">
<attachedChunks>
@ -84,4 +125,15 @@
<component name="VgoProject">
<settings-migrated>true</settings-migrated>
</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>

View File

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

View File

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

View File

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

View File

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

View File

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

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