From 6464826da935463353077a2a75e53b56b57f9060 Mon Sep 17 00:00:00 2001 From: miaowuawa <2484667023@qq.com> Date: Mon, 14 Jul 2025 21:43:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B0=83=E8=AF=95=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/servants/web/pub.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/servants/web/pub.go b/internal/servants/web/pub.go index fafbdd0e..6b0ba8f3 100644 --- a/internal/servants/web/pub.go +++ b/internal/servants/web/pub.go @@ -57,6 +57,7 @@ func (s *pubSrv) SendCaptcha(req *web.SendCaptchaReq) error { } if err := s.Ds.SendPhoneCaptcha(req.Phone); err != nil { + logrus.WithError(err).Errorf("SendPhoneCaptcha failed for phone: %s", req.Phone) return xerror.ServerError } // 写入计数缓存 @@ -68,7 +69,7 @@ func (s *pubSrv) SendCaptcha(req *web.SendCaptchaReq) error { func (s *pubSrv) GetCaptcha() (*web.GetCaptchaResp, error) { capt := captcha.New() if err := capt.AddFontFromBytes(assets.ComicBytes); err != nil { - logrus.Errorf("captcha.AddFontFromBytes err:%s", err) + logrus.WithError(err).Errorf("captcha.AddFontFromBytes failed") return nil, xerror.ServerError } capt.SetSize(160, 64) @@ -78,7 +79,7 @@ func (s *pubSrv) GetCaptcha() (*web.GetCaptchaResp, error) { img, password := capt.Create(6, captcha.NUM) emptyBuff := bytes.NewBuffer(nil) if err := png.Encode(emptyBuff, img); err != nil { - logrus.Errorf("png.Encode err:%s", err) + logrus.WithError(err).Errorf("png.Encode failed when generating captcha") return nil, xerror.ServerError } key := utils.EncodeMD5(uuid.Must(uuid.NewV4()).String())