完善机器人

This commit is contained in:
flswld
2023-05-13 20:40:40 +08:00
parent 9f10142c47
commit 0bc54baf12
9 changed files with 163 additions and 62 deletions
+6 -6
View File
@@ -24,7 +24,7 @@ type DispatchInfo struct {
DispatchKey []byte
}
func GetDispatchInfo(regionListUrl string, curRegionUrl string, regionListParam string, curRegionParam string, keyId string) (*DispatchInfo, error) {
func GetDispatchInfo(regionListUrl string, regionListParam string, curRegionUrl 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)
if err != nil {
@@ -115,14 +115,14 @@ type AccountInfo struct {
ComboToken string
}
func AccountLogin(url string, account string, password string) (*AccountInfo, error) {
func AccountLogin(loginSdkUrl string, account string, password string) (*AccountInfo, error) {
loginAccountRequestJson := &api.LoginAccountRequestJson{
Account: account,
Password: password,
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)
logger.Info("http post url: %v", loginSdkUrl+"/hk4e_global/mdk/shield/api/login")
loginResult, err := httpclient.PostJson[api.LoginResult](loginSdkUrl+"/hk4e_global/mdk/shield/api/login", loginAccountRequestJson)
if err != nil {
return nil, err
}
@@ -147,8 +147,8 @@ func AccountLogin(url string, account string, password string) (*AccountInfo, er
ChannelID: 1,
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)
logger.Info("http post url: %v", loginSdkUrl+"/hk4e_global/combo/granter/login/v2/login")
comboTokenRsp, err := httpclient.PostJson[api.ComboTokenRsp](loginSdkUrl+"/hk4e_global/combo/granter/login/v2/login", comboTokenReq)
if err != nil {
return nil, err
}