f
This commit is contained in:
@@ -3,6 +3,7 @@ package agent
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"bdqr-server/app/main/model"
|
||||
@@ -52,13 +53,20 @@ func (l *GetInvitePosterLogic) GetInvitePoster(req *types.GetInvitePosterReq) (r
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("邀请链接不能为空"), "")
|
||||
}
|
||||
|
||||
// 3. 调用 ImageService 生成邀请海报(背景图 + 二维码)
|
||||
imgData, _, err := l.svcCtx.ImageService.ProcessImageWithQRCode("invitation", inviteLink)
|
||||
// 3. 确定模板类型(1-4 对应 invitation_01 ~ invitation_04)
|
||||
templateIndex := req.TemplateIndex
|
||||
if templateIndex < 1 || templateIndex > 4 {
|
||||
templateIndex = 1
|
||||
}
|
||||
qrcodeType := fmt.Sprintf("invitation_%02d", templateIndex)
|
||||
|
||||
// 4. 调用 ImageService 生成邀请海报(背景图 + 二维码)
|
||||
imgData, _, err := l.svcCtx.ImageService.ProcessImageWithQRCode(qrcodeType, inviteLink)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "生成海报失败: %v", err)
|
||||
}
|
||||
|
||||
// 4. 返回 base64
|
||||
// 5. 返回 base64
|
||||
posterBase64 := base64.StdEncoding.EncodeToString(imgData)
|
||||
return &types.GetInvitePosterResp{
|
||||
PosterBase64: posterBase64,
|
||||
|
||||
@@ -221,13 +221,16 @@ func (l *BindMobileLogic) BindMobile(req *types.BindMobileReq) (resp *types.Bind
|
||||
return err
|
||||
}
|
||||
|
||||
// 3) 源用户软删除
|
||||
// 软删源用户(通常为临时用户),防止遗留无效账号;软删可保留历史痕迹,满足审计需求
|
||||
// 3) 源用户软删除(若存在)
|
||||
// 源用户可能不存在(孤儿 auth:user 已删或从未写入),此时跳过软删即可
|
||||
currentUser, err := l.svcCtx.UserModel.FindOne(ctx, currentUserID)
|
||||
if err != nil {
|
||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查找当前用户失败: %v", err)
|
||||
}
|
||||
if err := l.svcCtx.UserModel.Delete(ctx, session, currentUser.Id); err != nil {
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
l.Infof("[BindMobile] 源用户在 user 表中不存在,跳过软删 | sourceUserId: %s", currentUserID)
|
||||
} else {
|
||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查找当前用户失败: %v", err)
|
||||
}
|
||||
} else if err := l.svcCtx.UserModel.Delete(ctx, session, currentUser.Id); err != nil {
|
||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "删除当前用户失败: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user