From 6962845799f2e64865c56307e93a8bea634f24b5 Mon Sep 17 00:00:00 2001 From: hawklin2017 <32898629+hawklin2017@users.noreply.github.com> Date: Thu, 30 Apr 2026 18:07:22 +0800 Subject: [PATCH] redpacket --- internal/api/captcha.go | 2 +- internal/rpc/captcha/captcha.go | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/internal/api/captcha.go b/internal/api/captcha.go index da311703b..9cedb3d3e 100644 --- a/internal/api/captcha.go +++ b/internal/api/captcha.go @@ -41,7 +41,7 @@ func (c *CaptchaApi) VerifyCaptcha(ctx *gin.Context) { } resp, err := c.Client.VerifyCaptcha(ctx, req) if err != nil { - log.ZError(ctx, "captcha verify rpc failed", err, "captchaID", req.GetCaptchaID(), "clickPoints", req.GetClickPoints()) + log.ZError(ctx, "captcha verify rpc failed", err, "captchaID", req.GetCaptchaID(), "x", req.GetX(), "y", req.GetY()) apiresp.GinError(ctx, err) return } diff --git a/internal/rpc/captcha/captcha.go b/internal/rpc/captcha/captcha.go index f438fd687..5e5e9d75f 100644 --- a/internal/rpc/captcha/captcha.go +++ b/internal/rpc/captcha/captcha.go @@ -120,12 +120,12 @@ func (s *server) GenerateCaptcha(ctx context.Context, _ *pbcaptcha.GenerateCaptc log.ZError(ctx, "captcha insert mongodb failed", err, "captchaID", id) return nil, err } - _ = tileImage return &pbcaptcha.GenerateCaptchaResp{ CaptchaID: id, MasterImage: masterImage, - ThumbImage: tileImage, + TileImage: tileImage, ExpireAt: expiredAt.Unix(), + TileY: int32(block.Y), }, nil } @@ -159,11 +159,7 @@ func (s *server) VerifyCaptcha(ctx context.Context, req *pbcaptcha.VerifyCaptcha log.ZWarn(ctx, "captcha expired", nil, "captchaID", req.CaptchaID, "expiredAt", doc.ExpiredAt.Unix()) return nil, servererrs.ErrFileUploadedExpired.WrapMsg("captcha expired", "captchaID", req.CaptchaID) } - var x, y int32 - if pts := req.GetClickPoints(); len(pts) > 0 && pts[0] != nil { - x = pts[0].GetX() - y = pts[0].GetY() - } + x, y := req.GetX(), req.GetY() success := slide.Validate(int(x), int(y), doc.X, doc.Y, s.conf.VerifyPadding) if !success { log.ZError(ctx, "captcha validate failed", nil, "captchaID", req.CaptchaID, "x", x, "y", y, "docX", doc.X, "docY", doc.Y)