github.com/godaddy-x/freego@v1.0.156/geetest/sdk/geetest_lib_result.go (about)

     1  package sdk
     2  
     3  import "fmt"
     4  
     5  /**
     6   * sdk lib包的返回结果信息。
     7   *
     8   * @author liuquan@geetest.com
     9   */
    10  type GeetestLibResult struct {
    11  	Status int
    12  	Data   string
    13  	Msg    string
    14  }
    15  
    16  type GeetestLibResultData struct {
    17  	Challenge  string `json:"challenge"`
    18  	Gt         string `json:"gt"`
    19  	NewCaptcha bool   `json:"new_captcha"`
    20  	Success    int    `json:"success"`
    21  	Status     int    `json:"status"` // 0.需要认证 1.跳过认证
    22  }
    23  
    24  func NewGeetestLibResult() *GeetestLibResult {
    25  	return &GeetestLibResult{0, "", ""}
    26  }
    27  
    28  func (g *GeetestLibResult) setAll(status int, data string, msg string) {
    29  	g.Status = status
    30  	g.Data = data
    31  	g.Msg = msg
    32  }
    33  
    34  func (g *GeetestLibResult) String() string {
    35  	return fmt.Sprintf("GeetestLibResult{Status=%s, Data=%s, Msg=%s}", g.Status, g.Data, g.Msg)
    36  }