fix:合图,默认参数
This commit is contained in:
parent
85f7dcdffb
commit
e4fb6ca4a7
|
@ -2,15 +2,18 @@ package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"fusenapi/model/gmodel"
|
||||||
"fusenapi/service/repositories"
|
"fusenapi/service/repositories"
|
||||||
"fusenapi/utils/auth"
|
"fusenapi/utils/auth"
|
||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
|
"fusenapi/utils/template_switch_info"
|
||||||
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"fusenapi/server/resource/internal/svc"
|
"fusenapi/server/resource/internal/svc"
|
||||||
"fusenapi/server/resource/internal/types"
|
"fusenapi/server/resource/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logc"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -57,6 +60,35 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth
|
||||||
// 否则,使用用户ID和用户键名格式
|
// 否则,使用用户ID和用户键名格式
|
||||||
userId = userinfo.UserId
|
userId = userinfo.UserId
|
||||||
}
|
}
|
||||||
|
// 获取默认
|
||||||
|
if req.Address == "" || req.Phone == "" || req.Website == "" || req.Qrcode == "" {
|
||||||
|
// 没有查到,先根据模版id 查询模版数据 请求算法数据
|
||||||
|
productTemplateV2Model := gmodel.NewFsProductTemplateV2Model(l.svcCtx.MysqlConn)
|
||||||
|
productTemplateV2Info, err := productTemplateV2Model.FindOne(l.ctx, req.TemplateId)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
logc.Errorf(l.ctx, "productTemplateV2Model.FindOne:%v", err)
|
||||||
|
return resp.SetStatus(basic.CodeServiceErr, "模版不存在")
|
||||||
|
}
|
||||||
|
templateSwitchInfo, err := template_switch_info.GetTemplateSwitchInfo(req.TemplateId, productTemplateV2Info.TemplateInfo, *productTemplateV2Info.MaterialImg)
|
||||||
|
if err != nil {
|
||||||
|
logc.Errorf(l.ctx, "template_switch_info.GetTemplateSwitchInfo,err:%v", err)
|
||||||
|
return resp.SetStatus(basic.CodeServiceErr, "默认模版不存在")
|
||||||
|
}
|
||||||
|
if req.Address == "" && templateSwitchInfo.MaterialData.Address.IfShow {
|
||||||
|
req.Address = templateSwitchInfo.MaterialData.Address.DefaultValue
|
||||||
|
}
|
||||||
|
if req.Phone == "" && templateSwitchInfo.MaterialData.Phone.IfShow {
|
||||||
|
req.Phone = templateSwitchInfo.MaterialData.Phone.DefaultValue
|
||||||
|
}
|
||||||
|
if req.Website == "" && templateSwitchInfo.MaterialData.Website.IfShow {
|
||||||
|
req.Website = templateSwitchInfo.MaterialData.Website.DefaultValue
|
||||||
|
}
|
||||||
|
if req.Qrcode == "" && templateSwitchInfo.MaterialData.QRcode.IfShow {
|
||||||
|
req.Qrcode = templateSwitchInfo.MaterialData.QRcode.DefaultValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res, err := l.svcCtx.Repositories.ImageHandle.LogoCombine(l.ctx, &repositories.LogoCombineReq{
|
res, err := l.svcCtx.Repositories.ImageHandle.LogoCombine(l.ctx, &repositories.LogoCombineReq{
|
||||||
UserId: userId,
|
UserId: userId,
|
||||||
GuestId: guestId,
|
GuestId: guestId,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user