chore: 重新抽象 srun 通讯模块

This commit is contained in:
Mmx233
2022-10-21 13:20:31 +08:00
parent 43e377283c
commit 09acd88312
8 changed files with 56 additions and 38 deletions

40
v1/models.go Normal file
View File

@@ -0,0 +1,40 @@
package BitSrun
import (
"github.com/Mmx233/BitSrunLoginGo/v1/srun"
"net/http"
)
type LoginForm struct {
Domain string `json:"domain"`
UserName string `json:"username"`
//运营商类型
UserType string `json:"user_type"`
PassWord string `json:"password"`
}
type LoginMeta struct {
N string `json:"n"`
Type string `json:"type"`
Acid string `json:"acid"`
Enc string `json:"enc"`
}
type LoginInfo struct {
Form *LoginForm
Meta *LoginMeta
}
type LoginConf struct {
//调用 API 时直接访问 https URL
Https bool
//登录参数,不可缺省
LoginInfo LoginInfo
Client *http.Client
api srun.Api
}
func (a *LoginConf) initApi() {
a.api.Init(a.Https, a.LoginInfo.Form.Domain, a.Client)
}