Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Sakurasan committed Jun 9, 2023
1 parent 2d3dd0d commit bb9fb78
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

SMZDM_COOKIE获取: 手机抓包 https://user-api.smzdm.com/checkin

QmsgKey获取: https://qmsg.zendee.cn/index.html
QmsgKey获取: https://qmsg.zendee.cn/

---

Expand Down
65 changes: 63 additions & 2 deletions checkin.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ var (
Android_SIGN_KEY = "apr1$AwP!wRRT$gJ/q.X24poeBInlUJC"
IOS_SIGN_KEY = "zok5JtAq3$QixaA%mncn*jGWlEpSL3E1"
cookie = ""
default_data = map[string]string{
"weixin": "1",
"time": strconv.FormatInt(time.Now().Unix(), 10),
"basic_v": "0",
"f": "android",
"v": "10.4.26",
}
)

type Country string
Expand All @@ -51,6 +58,7 @@ func (c Country) TimeZoneID() string {
type SmzdmBot struct {
Cookies string
Sk string
Token string
sess string
}

Expand Down Expand Up @@ -124,7 +132,12 @@ func (bot *SmzdmBot) signData(data map[string]string) map[string]string {
signStr += k + "=" + v + "&"
}
}
signStr += "key=" + IOS_SIGN_KEY
if data["f"] == "iphone" {
signStr += "key=" + IOS_SIGN_KEY
} else {
signStr += "key=" + Android_SIGN_KEY
}

data["sign"] = strings.ToUpper(cryptor.Md5String(signStr))
return data
}
Expand All @@ -138,7 +151,8 @@ func (bot *SmzdmBot) Data(extraData map[string]string) map[string]string {
"v": bot.cookiesToDict()["device_smzdm_version"],
"touchstone_event": "",
"time": strconv.FormatInt(time.Now().Unix(), 10),
// "token": bot.cookiesToDict()["sess"],
"token": bot.Token,
"sk": bot.Sk,
}
if bot.Sk != "" {
data["sk"] = bot.Sk
Expand Down Expand Up @@ -203,6 +217,51 @@ func (bot *SmzdmBot) Checkin() {
}
log.Println(respstr)
}
func (bot *SmzdmBot) all_reward() {
log.Println("========== all_reward ==========")
resp, err := bot.Request(http.MethodPost, "https://user-api.smzdm.com/checkin/all_reward", nil, nil)
if err != nil {
log.Println(err)
return
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Println(err)
return
}
respstr := DecodeUnicode(body)
errcode := gjson.Get(respstr, "error_code").String()
errmsg := gjson.Get(respstr, "error_msg").String()
if errcode != "0" {
log.Println("没有奖励", errmsg, string(body))
return
}
log.Println(respstr)
}

func (bot *SmzdmBot) extra_reward() {
log.Println("========== extra_reward ==========")
resp, err := bot.Request(http.MethodPost, "https://user-api.smzdm.com/checkin/extra_reward", nil, nil)
if err != nil {
log.Println(err)
return
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Println(err)
return
}
respstr := DecodeUnicode(body)
errcode := gjson.Get(respstr, "error_code").String()
errmsg := gjson.Get(respstr, "error_msg").String()
if errcode != "0" {
log.Println(errmsg)
return
}
log.Println(respstr)
}

func initCheck() {
if os.Getenv("SMZDM_COOKIE") == "" {
Expand All @@ -223,6 +282,8 @@ func main() {
Cookies: cookie,
}
bot.Checkin()
bot.all_reward()
bot.extra_reward()

}

Expand Down

0 comments on commit bb9fb78

Please sign in to comment.