This commit is contained in:
Mrx
2026-02-09 18:10:23 +08:00
parent a8ec1a5aa1
commit c416c44c0c
9 changed files with 133 additions and 9 deletions

View File

@@ -26,13 +26,13 @@ func NewImageService() *ImageService {
// ProcessImageWithQRCode 处理图片,在中间添加二维码
func (s *ImageService) ProcessImageWithQRCode(qrcodeType, qrcodeUrl string) ([]byte, string, error) {
// 1. 根据qrcodeType确定使用哪张背景图
// 1. 根据qrcodeType确定使用哪张背景图(与 uniapp_ycc/src/static/invitation 下海报一致,需复制到本目录 static/images
var backgroundImageName string
switch qrcodeType {
case "promote":
backgroundImageName = "tg_qrcode_1.png"
case "invitation":
backgroundImageName = "yq_qrcode_1.png"
backgroundImageName = "invitation_01.png" // 与 uniapp static/invitation/invitation_01.png 同一张图,部署时拷贝到 static/images
default:
backgroundImageName = "tg_qrcode_1.png" // 默认使用第一张图片
}
@@ -79,10 +79,10 @@ func (s *ImageService) ProcessImageWithQRCode(qrcodeType, qrcodeUrl string) ([]b
case "invitation":
// invitation类型精确设置二维码尺寸
qrSize = 360 // 固定尺寸320px
qrSize = 138 // 固定尺寸320px
// 中间偏上位置
qrX = (imgWidth - qrSize) / 2 // 水平居中
qrY = 555 // 垂直位置200px
qrY = 140 // 垂直位置200px
default:
// 默认promote样式
@@ -162,7 +162,7 @@ func (s *ImageService) CheckImageExists(qrcodeType string) bool {
case "promote":
backgroundImageName = "tg_qrcode_1.png"
case "invitation":
backgroundImageName = "yq_qrcode_1.png"
backgroundImageName = "invitation_01.png"
default:
backgroundImageName = "tg_qrcode_1.png"
}