improve: Login api 开放所有参数,改为接收结构体
This commit is contained in:
@@ -114,31 +114,36 @@ func (a *Api) DetectAcid() (string, error) {
|
|||||||
return "", ErrAcidCannotFound
|
return "", ErrAcidCannotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Api) Login(
|
type LoginRequest struct {
|
||||||
Username,
|
Username string
|
||||||
Password,
|
Password string
|
||||||
AcID,
|
AcID string
|
||||||
Ip,
|
IP string
|
||||||
Info,
|
Info string
|
||||||
ChkSum,
|
ChkSum string
|
||||||
N,
|
N string
|
||||||
Type string,
|
Type string
|
||||||
) (map[string]interface{}, error) {
|
OS string
|
||||||
|
Name string
|
||||||
|
DoubleStack string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Api) Login(req *LoginRequest) (map[string]interface{}, error) {
|
||||||
return a.request(
|
return a.request(
|
||||||
"cgi-bin/srun_portal",
|
"cgi-bin/srun_portal",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"action": "login",
|
"action": "login",
|
||||||
"username": Username,
|
"username": req.Username,
|
||||||
"password": Password,
|
"password": req.Password,
|
||||||
"ac_id": AcID,
|
"ac_id": req.AcID,
|
||||||
"ip": Ip,
|
"ip": req.IP,
|
||||||
"info": Info,
|
"info": req.Info,
|
||||||
"chksum": ChkSum,
|
"chksum": req.ChkSum,
|
||||||
"n": N,
|
"n": req.N,
|
||||||
"type": Type,
|
"type": req.Type,
|
||||||
"os": "Windows 10",
|
"os": req.OS,
|
||||||
"name": "windows",
|
"name": req.Name,
|
||||||
"double_stack": 0,
|
"double_stack": req.DoubleStack,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user