From a4e91eb251a15f5bbc98dd2cfc501ac7c07d6b3d Mon Sep 17 00:00:00 2001 From: Mmx <1624045573@qq.com> Date: Thu, 25 Nov 2021 09:42:32 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E7=A7=BB=E5=8A=A8=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=BB=93=E6=9E=84=E4=BD=93=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- global/config.go | 5 +++-- models/config.go | 8 +++++--- models/login.go | 18 +++--------------- util/config.go | 9 ++++++--- v1/transfer/login.go | 18 +++++++++++++++--- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/global/config.go b/global/config.go index 38b72d4..ed080d3 100644 --- a/global/config.go +++ b/global/config.go @@ -3,6 +3,7 @@ package global import ( "github.com/Mmx233/BitSrunLoginGo/models" "github.com/Mmx233/BitSrunLoginGo/util" + "github.com/Mmx233/BitSrunLoginGo/v1/transfer" "github.com/Mmx233/config" "log" "os" @@ -17,11 +18,11 @@ func init() { if e := config.Load(config.Options{ Config: &Config, Default: &srunModels.Config{ - Form: srunModels.LoginForm{ + Form: srunTransfer.LoginForm{ Domain: "www.msftconnecttest.com", UserType: "cmcc", }, - Meta: srunModels.LoginMeta{ + Meta: srunTransfer.LoginMeta{ N: "200", Type: "1", Acid: "5", diff --git a/models/config.go b/models/config.go index b39b8d4..02c33af 100644 --- a/models/config.go +++ b/models/config.go @@ -1,5 +1,7 @@ package srunModels +import "github.com/Mmx233/BitSrunLoginGo/v1/transfer" + type Daemon struct { Enable bool `json:"enable"` Path string `json:"path"` @@ -18,7 +20,7 @@ type Settings struct { } type Config struct { - Form LoginForm `json:"form"` - Meta LoginMeta `json:"meta"` - Settings Settings `json:"settings"` + Form srunTransfer.LoginForm `json:"form"` + Meta srunTransfer.LoginMeta `json:"meta"` + Settings Settings `json:"settings"` } diff --git a/models/login.go b/models/login.go index 063c04a..4e9ec3e 100644 --- a/models/login.go +++ b/models/login.go @@ -1,18 +1,6 @@ package srunModels -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"` -} +import "github.com/Mmx233/BitSrunLoginGo/v1/transfer" type LoginInfo struct { UrlLoginPage string @@ -28,6 +16,6 @@ type LoginInfo struct { EncryptedChkstr string LoginResult string - Form *LoginForm - Meta *LoginMeta + Form *srunTransfer.LoginForm + Meta *srunTransfer.LoginMeta } diff --git a/util/config.go b/util/config.go index 66c45f6..34f0702 100644 --- a/util/config.go +++ b/util/config.go @@ -1,15 +1,18 @@ package util -import "github.com/Mmx233/BitSrunLoginGo/models" +import ( + "github.com/Mmx233/BitSrunLoginGo/models" + "github.com/Mmx233/BitSrunLoginGo/v1/transfer" +) -func GenerateLoginInfo(Form *srunModels.LoginForm, Meta *srunModels.LoginMeta) *srunModels.LoginInfo { +func GenerateLoginInfo(Form *srunTransfer.LoginForm, Meta *srunTransfer.LoginMeta) *srunModels.LoginInfo { return &srunModels.LoginInfo{ UrlLoginPage: "http://" + Form.Domain + "/srun_portal_success", UrlGetChallengeApi: "http://" + Form.Domain + "/cgi-bin/get_challenge", UrlLoginApi: "http://" + Form.Domain + "/cgi-bin/srun_portal", UrlCheckApi: "http://" + Form.Domain + "/cgi-bin/rad_user_info", Meta: Meta, - Form: &srunModels.LoginForm{ + Form: &srunTransfer.LoginForm{ UserName: Form.UserName + "@" + Form.UserType, PassWord: Form.PassWord, }, diff --git a/v1/transfer/login.go b/v1/transfer/login.go index a9c11ca..3ea3bfc 100644 --- a/v1/transfer/login.go +++ b/v1/transfer/login.go @@ -1,10 +1,22 @@ package srunTransfer -import "github.com/Mmx233/BitSrunLoginGo/models" +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 *srunModels.LoginForm - Meta *srunModels.LoginMeta + Form *LoginForm + Meta *LoginMeta } type Login struct {