diff --git a/plugin/score/sign_in.go b/plugin/score/sign_in.go index c67b75e9..60b8e452 100644 --- a/plugin/score/sign_in.go +++ b/plugin/score/sign_in.go @@ -24,7 +24,7 @@ import ( ) const ( - backgroundURL = "https://iw233.cn/api.php?sort=pc&type=json" + backgroundURL = "https://mirlkoi.ifast3.vipnps.vip/api.php?sort=pc&type=json" referer = "https://iw233.cn/main.html" ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36" signinMax = 1 @@ -56,11 +56,10 @@ func init() { today := now.Format("20060102") si := sdb.GetSignInByUID(uid) siUpdateTimeStr := si.UpdatedAt.Format("20060102") - if siUpdateTimeStr != today { - _ = sdb.InsertOrUpdateSignInCountByUID(uid, 0) - } - drawedFile := cachePath + strconv.FormatInt(uid, 10) + today + "signin.png" + + picFile := cachePath + strconv.FormatInt(uid, 10) + today + ".png" + if si.Count >= signinMax && siUpdateTimeStr == today { ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("今天你已经签到过了!")) if file.IsExist(drawedFile) { @@ -68,21 +67,21 @@ func init() { } return } - - picFile := cachePath + strconv.FormatInt(uid, 10) + today + ".png" err := initPic(picFile) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } - - _ = sdb.InsertOrUpdateSignInCountByUID(uid, si.Count+1) - back, err := gg.LoadImage(picFile) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } + if siUpdateTimeStr != today { + _ = sdb.InsertOrUpdateSignInCountByUID(uid, 0) + } + + _ = sdb.InsertOrUpdateSignInCountByUID(uid, si.Count+1) // 避免图片过大,最大 1280*720 back = img.Limit(back, 1280, 720)