This commit is contained in:
Mrx
2026-03-02 16:34:47 +08:00
parent 7e2dda986f
commit be6d3e5f2c
8 changed files with 47 additions and 23 deletions

View File

@@ -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,