Skip to content

Commit

Permalink
closes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
axiaoxin committed Apr 28, 2020
1 parent 1692f87 commit b611d40
Show file tree
Hide file tree
Showing 3 changed files with 292 additions and 6 deletions.
11 changes: 6 additions & 5 deletions chaojiying.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"encoding/json"
"io"
"io/ioutil"
"log"
"math/rand"
"net/http"
"net/url"
"time"

"github.com/axiaoxin-com/logging"

"github.com/pkg/errors"
)

Expand Down Expand Up @@ -57,12 +58,12 @@ func New(accounts []Account) (*Client, error) {
for _, account := range accounts {
resp, err := c.GetScore(account.User, account.Pass)
if err != nil {
log.Println("[ERROR] chaojiying New GetScore error. user:", account.User, "pass:", account.Pass, "error:", err, "resp:", resp)
logging.Errorw(nil, "chaojiying New GetScore error", "user", account.User, "pass", account.Pass, "error", err, "resp", resp)
continue
}
account.Score = resp.Tifen
avaliableAccounts = append(avaliableAccounts, account)
log.Println("[DEBUG] chaojiying New add account:", account)
logging.Debugs(nil, "chaojiying New add account:", account)
}
if len(avaliableAccounts) == 0 {
return nil, errors.New("No avaliable accounts")
Expand Down Expand Up @@ -210,7 +211,7 @@ func (c *Client) Processing(user, pass string, pic io.Reader) (*ProcessingResp,
// 封装Proccessing接口,判断是否成功,成功返回破解出的验证码
func (c *Client) Cr4ck(pic io.Reader) (string, error) {
account, err := c.PickOneAccount()
log.Println("[INFO] chaojiying Cr4ck picked account:", account)
logging.Infos(nil, "chaojiying Cr4ck picked account:", account)
if err != nil {
return "", errors.Wrap(err, "chaojiying Cr4ck PickOneAccount error")
}
Expand All @@ -224,7 +225,7 @@ func (c *Client) Cr4ck(pic io.Reader) (string, error) {
if resp.PicStr == "" {
return "", errors.New("chaojiying can't Cr4ck this pic")
}
log.Println("[INFO] chaojiying Cr4ck result:", resp)
logging.Infos(nil, "chaojiying Cr4ck result:", resp)
return resp.PicStr, nil
}

Expand Down
6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ module github.com/axiaoxin-com/chaojiying

go 1.13

require github.com/pkg/errors v0.9.1
require (
github.com/axiaoxin-com/logging v0.0.0-20200427085200-a4c4130686e8
github.com/pkg/errors v0.9.1
golang.org/x/sys v0.0.0-20200427175716-29b57079015a // indirect
)
Loading

0 comments on commit b611d40

Please sign in to comment.