From 4b3dcac324ff45f341bfe89ae4c0c027e94f898c Mon Sep 17 00:00:00 2001 From: denghui <1016848185@qq.com> Date: Thu, 10 Jul 2025 10:17:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E5=A6=96=E7=94=A8=E6=88=B7=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E5=BE=AE=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/logic/user/user.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/logic/user/user.go b/internal/logic/user/user.go index c28e820..29905c0 100644 --- a/internal/logic/user/user.go +++ b/internal/logic/user/user.go @@ -141,11 +141,16 @@ func (s *sUser) Login(ctx context.Context, in *model.UserLoginIn) (out *model.Us return nil, ecode.Fail.Sub("参数错误:用户不存在") } - // User exists, bind in.OpenId and update last login store ID + // User exists, check WxOpenId if err := dao.Users.Ctx(ctx).Where(do.Users{XyUserId: xyUserId}).Scan(&user); err != nil { return nil, ecode.Fail.Sub("查找用户失败") } userId = user.Id + if user.WxOpenId != "" && user.WxOpenId != in.OpenId { + return nil, ecode.Fail.Sub("当前微信已绑定其他微信号") + } + + // Bind in.OpenId and update last login store ID if _, err := dao.Users.Ctx(ctx).Where(do.Users{Id: userId}).Update(do.Users{ WxOpenId: in.OpenId, LastLoginAt: gtime.Now(),