refactor: change log text

This commit is contained in:
Revincx
2022-10-14 19:10:28 +08:00
parent c788df35fd
commit fdcb530b05

View File

@@ -3,8 +3,9 @@ package BitSrun
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"github.com/Mmx233/BitSrunLoginGo/util" "github.com/Mmx233/BitSrunLoginGo/util"
"github.com/Mmx233/BitSrunLoginGo/v1/transfer" srunTransfer "github.com/Mmx233/BitSrunLoginGo/v1/transfer"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
@@ -24,18 +25,19 @@ func Login(c *srunTransfer.Login) error {
var ok bool var ok bool
{ {
log.Infoln("Step.0: 正在检查状态") log.Infoln("正在检查登录状态")
res, e := api.GetUserInfo() res, e := api.GetUserInfo()
if e != nil { if e != nil {
return e return e
} }
err := res["error"].(string) err := res["error"].(string)
if err == "ok" { if err == "ok" {
log.Infoln("--已登录--") log.Infoln("用户已登录~")
return nil return nil
} }
log.Infoln("用户似乎未登录,开始尝试登录")
log.Infoln("Step.1: 正在获取客户端ip") log.Infoln("正在获取客户端 IP")
var ip interface{} var ip interface{}
ip, ok = res["client_ip"] ip, ok = res["client_ip"]
if !ok { if !ok {
@@ -48,7 +50,7 @@ func Login(c *srunTransfer.Login) error {
log.Debugln("ip: ", G.Ip) log.Debugln("ip: ", G.Ip)
} }
log.Infoln("Step.2: 正在获取token") log.Infoln("正在获取 Token")
{ {
res, e := api.GetChallenge(G.Form.UserName, G.Ip) res, e := api.GetChallenge(G.Form.UserName, G.Ip)
if e != nil { if e != nil {
@@ -63,7 +65,7 @@ func Login(c *srunTransfer.Login) error {
log.Debugln("token: ", G.Token) log.Debugln("token: ", G.Token)
} }
log.Infoln("Step.3: 执行登录…") log.Infoln("发送登录请求")
{ {
info, e := json.Marshal(map[string]string{ info, e := json.Marshal(map[string]string{
"username": G.Form.UserName, "username": G.Form.UserName,