mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-13 20:12:27 +08:00
优化代码
This commit is contained in:
@@ -18,8 +18,11 @@ import (
|
||||
func main() {
|
||||
config.InitConfig("application.toml")
|
||||
logger.InitLogger("robot")
|
||||
defer func() {
|
||||
logger.CloseLogger()
|
||||
}()
|
||||
|
||||
config.CONF.Hk4e.ClientProtoProxyEnable = false
|
||||
config.GetConfig().Hk4e.ClientProtoProxyEnable = false
|
||||
|
||||
// // DPDK模式需开启
|
||||
// err := engine.InitEngine("00:0C:29:3E:3E:DF", "192.168.199.199", "255.255.255.0", "192.168.199.1")
|
||||
@@ -39,11 +42,8 @@ func main() {
|
||||
s := <-c
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
|
||||
// // DPDK模式需开启
|
||||
// engine.StopEngine()
|
||||
|
||||
time.Sleep(time.Second)
|
||||
return
|
||||
case syscall.SIGHUP:
|
||||
default:
|
||||
@@ -85,7 +85,7 @@ func runRobot(name string) {
|
||||
pingSeq++
|
||||
// 通过这个接口发消息给服务器
|
||||
session.SendMsg(cmd.PingReq, &proto.PingReq{
|
||||
ClientTime: uint32(time.Now().UnixMilli()),
|
||||
ClientTime: uint32(time.Now().Unix()),
|
||||
Seq: pingSeq,
|
||||
})
|
||||
case protoMsg := <-session.RecvChan:
|
||||
|
||||
@@ -26,7 +26,7 @@ type DispatchInfo struct {
|
||||
|
||||
func GetDispatchInfo(regionListUrl string, curRegionUrl string, regionListParam string, curRegionParam string, keyId string) (*DispatchInfo, error) {
|
||||
logger.Info("http get url: %v", regionListUrl+"/query_region_list"+regionListParam)
|
||||
regionListBase64, err := httpclient.GetRaw(regionListUrl+"/query_region_list"+regionListParam, "")
|
||||
regionListBase64, err := httpclient.GetRaw(regionListUrl + "/query_region_list" + regionListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -49,7 +49,7 @@ func GetDispatchInfo(regionListUrl string, curRegionUrl string, regionListParam
|
||||
curRegionUrl = selectRegion.DispatchUrl
|
||||
}
|
||||
logger.Info("http get url: %v", curRegionUrl+curRegionParam)
|
||||
regionCurrJson, err := httpclient.GetRaw(curRegionUrl+curRegionParam, "")
|
||||
regionCurrJson, err := httpclient.GetRaw(curRegionUrl + curRegionParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -122,7 +122,7 @@ func AccountLogin(url string, account string, password string) (*AccountInfo, er
|
||||
IsCrypto: true,
|
||||
}
|
||||
logger.Info("http post url: %v", url+"/hk4e_global/mdk/shield/api/login")
|
||||
loginResult, err := httpclient.PostJson[api.LoginResult](url+"/hk4e_global/mdk/shield/api/login", loginAccountRequestJson, "")
|
||||
loginResult, err := httpclient.PostJson[api.LoginResult](url+"/hk4e_global/mdk/shield/api/login", loginAccountRequestJson)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -148,7 +148,7 @@ func AccountLogin(url string, account string, password string) (*AccountInfo, er
|
||||
Data: string(loginTokenDataJson),
|
||||
}
|
||||
logger.Info("http post url: %v", url+"/hk4e_global/combo/granter/login/v2/login")
|
||||
comboTokenRsp, err := httpclient.PostJson[api.ComboTokenRsp](url+"/hk4e_global/combo/granter/login/v2/login", comboTokenReq, "")
|
||||
comboTokenRsp, err := httpclient.PostJson[api.ComboTokenRsp](url+"/hk4e_global/combo/granter/login/v2/login", comboTokenReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user