style: 移动登录信息结构体位置

This commit is contained in:
Mmx
2021-11-25 09:42:32 +08:00
parent ee86c3ad94
commit a4e91eb251
5 changed files with 32 additions and 26 deletions

View File

@@ -3,6 +3,7 @@ package global
import ( import (
"github.com/Mmx233/BitSrunLoginGo/models" "github.com/Mmx233/BitSrunLoginGo/models"
"github.com/Mmx233/BitSrunLoginGo/util" "github.com/Mmx233/BitSrunLoginGo/util"
"github.com/Mmx233/BitSrunLoginGo/v1/transfer"
"github.com/Mmx233/config" "github.com/Mmx233/config"
"log" "log"
"os" "os"
@@ -17,11 +18,11 @@ func init() {
if e := config.Load(config.Options{ if e := config.Load(config.Options{
Config: &Config, Config: &Config,
Default: &srunModels.Config{ Default: &srunModels.Config{
Form: srunModels.LoginForm{ Form: srunTransfer.LoginForm{
Domain: "www.msftconnecttest.com", Domain: "www.msftconnecttest.com",
UserType: "cmcc", UserType: "cmcc",
}, },
Meta: srunModels.LoginMeta{ Meta: srunTransfer.LoginMeta{
N: "200", N: "200",
Type: "1", Type: "1",
Acid: "5", Acid: "5",

View File

@@ -1,5 +1,7 @@
package srunModels package srunModels
import "github.com/Mmx233/BitSrunLoginGo/v1/transfer"
type Daemon struct { type Daemon struct {
Enable bool `json:"enable"` Enable bool `json:"enable"`
Path string `json:"path"` Path string `json:"path"`
@@ -18,7 +20,7 @@ type Settings struct {
} }
type Config struct { type Config struct {
Form LoginForm `json:"form"` Form srunTransfer.LoginForm `json:"form"`
Meta LoginMeta `json:"meta"` Meta srunTransfer.LoginMeta `json:"meta"`
Settings Settings `json:"settings"` Settings Settings `json:"settings"`
} }

View File

@@ -1,18 +1,6 @@
package srunModels package srunModels
type LoginForm struct { import "github.com/Mmx233/BitSrunLoginGo/v1/transfer"
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 { type LoginInfo struct {
UrlLoginPage string UrlLoginPage string
@@ -28,6 +16,6 @@ type LoginInfo struct {
EncryptedChkstr string EncryptedChkstr string
LoginResult string LoginResult string
Form *LoginForm Form *srunTransfer.LoginForm
Meta *LoginMeta Meta *srunTransfer.LoginMeta
} }

View File

@@ -1,15 +1,18 @@
package util 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{ return &srunModels.LoginInfo{
UrlLoginPage: "http://" + Form.Domain + "/srun_portal_success", UrlLoginPage: "http://" + Form.Domain + "/srun_portal_success",
UrlGetChallengeApi: "http://" + Form.Domain + "/cgi-bin/get_challenge", UrlGetChallengeApi: "http://" + Form.Domain + "/cgi-bin/get_challenge",
UrlLoginApi: "http://" + Form.Domain + "/cgi-bin/srun_portal", UrlLoginApi: "http://" + Form.Domain + "/cgi-bin/srun_portal",
UrlCheckApi: "http://" + Form.Domain + "/cgi-bin/rad_user_info", UrlCheckApi: "http://" + Form.Domain + "/cgi-bin/rad_user_info",
Meta: Meta, Meta: Meta,
Form: &srunModels.LoginForm{ Form: &srunTransfer.LoginForm{
UserName: Form.UserName + "@" + Form.UserType, UserName: Form.UserName + "@" + Form.UserType,
PassWord: Form.PassWord, PassWord: Form.PassWord,
}, },

View File

@@ -1,10 +1,22 @@
package srunTransfer 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 { type LoginInfo struct {
Form *srunModels.LoginForm Form *LoginForm
Meta *srunModels.LoginMeta Meta *LoginMeta
} }
type Login struct { type Login struct {