fix
This commit is contained in:
@@ -81,9 +81,9 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
|
||||
list := make([]types.GetProductTemplateTagsRsp, 0, len(productTemplateTags))
|
||||
for _, v := range productTemplateTags {
|
||||
list = append(list, types.GetProductTemplateTagsRsp{
|
||||
Id: v.Id,
|
||||
Tag: *v.Title,
|
||||
Cover: *v.Cover,
|
||||
Id: v.Id,
|
||||
TemplateTag: *v.Title,
|
||||
Cover: *v.Cover,
|
||||
})
|
||||
}
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "success", list)
|
||||
|
||||
@@ -10,9 +10,9 @@ type GetProductTemplateTagsReq struct {
|
||||
}
|
||||
|
||||
type GetProductTemplateTagsRsp struct {
|
||||
Id int64 `json:"id"`
|
||||
Tag string `json:"tag"`
|
||||
Cover string `json:"cover"`
|
||||
Id int64 `json:"id"`
|
||||
TemplateTag string `json:"template_tag"`
|
||||
Cover string `json:"cover"`
|
||||
}
|
||||
|
||||
type Request struct {
|
||||
|
||||
@@ -4,17 +4,14 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"fusenapi/constants"
|
||||
"fusenapi/initalize"
|
||||
"fusenapi/server/render/internal/svc"
|
||||
"fusenapi/service/repositories"
|
||||
"fusenapi/utils/hash"
|
||||
"fusenapi/utils/websocket_data"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/gorm"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 这里请求的py接口返回数据
|
||||
@@ -52,7 +49,7 @@ func (m *MqConsumerRenderAssemble) Run(ctx context.Context, data []byte) error {
|
||||
}
|
||||
rabbitmq := initalize.RabbitMqHandle{}
|
||||
//获取模板(模板标签下的对一个物料的的模板)
|
||||
productTemplate, err := svcCtx.AllModels.FsProductTemplateV2.FindOneByProductIdTagIdWithSizeTable(ctx, parseInfo.RenderData.ProductId, fmt.Sprintf("%d", parseInfo.RenderData.TemplateTagId))
|
||||
productTemplate, err := svcCtx.AllModels.FsProductTemplateV2.FindOneByProductIdTagIdWithSizeTable(ctx, parseInfo.RenderData.ProductId, parseInfo.RenderData.TemplateTag)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
logx.Error("template info is not found")
|
||||
@@ -61,33 +58,17 @@ func (m *MqConsumerRenderAssemble) Run(ctx context.Context, data []byte) error {
|
||||
logx.Error("failed to get template info:", err)
|
||||
return nil //不返回错误就删除消息
|
||||
}
|
||||
time.Now().UTC()
|
||||
resourceKey := hash.JsonHashKey(parseInfo)
|
||||
combineParam := map[string]interface{}{
|
||||
"logo_url": parseInfo.RenderData.Logo,
|
||||
"website": "",
|
||||
"slogan": "",
|
||||
"address": "",
|
||||
"phone": "",
|
||||
"colors": []string{},
|
||||
"template_tagid": "b1a",
|
||||
"is_crop": false,
|
||||
"shape": "rectangle",
|
||||
"ratio": 0,
|
||||
"line": "",
|
||||
"other": "",
|
||||
"other1": "",
|
||||
}
|
||||
combineParamBytes, _ := json.Marshal(combineParam)
|
||||
//获取刀版图
|
||||
res, err := svcCtx.Repositories.ImageHandle.LogoCombine(ctx, &repositories.LogoCombineReq{
|
||||
ResourceKey: resourceKey,
|
||||
TemplateId: productTemplate.Id,
|
||||
CombineParam: string(combineParamBytes),
|
||||
UserId: parseInfo.RenderData.UserId,
|
||||
GuestId: parseInfo.RenderData.GuestId,
|
||||
UserId: parseInfo.RenderData.UserId,
|
||||
GuestId: parseInfo.RenderData.GuestId,
|
||||
TemplateId: productTemplate.Id,
|
||||
TemplateTag: parseInfo.RenderData.TemplateTag,
|
||||
Website: parseInfo.RenderData.Website,
|
||||
Slogan: parseInfo.RenderData.Slogan,
|
||||
Address: parseInfo.RenderData.Address,
|
||||
Phone: parseInfo.RenderData.Phone,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
logx.Error("合成刀版图失败:", err)
|
||||
return nil
|
||||
|
||||
@@ -42,9 +42,9 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
||||
logx.Error("invalid format of websocket render image message:product_id")
|
||||
return
|
||||
}
|
||||
if renderImageData.RenderData.TemplateTagId <= 0 {
|
||||
w.outChan <- w.respondDataFormat(constants.WEBSOCKET_ERR_DATA_FORMAT, "invalid format of websocket render image message:template_tag_id ")
|
||||
logx.Error("invalid format of websocket render image message:template_tag_id")
|
||||
if renderImageData.RenderData.TemplateTag == "" {
|
||||
w.outChan <- w.respondDataFormat(constants.WEBSOCKET_ERR_DATA_FORMAT, "invalid format of websocket render image message:template_tag ")
|
||||
logx.Error("invalid format of websocket render image message:template_tag")
|
||||
return
|
||||
}
|
||||
//获取上传最近的logo
|
||||
|
||||
Reference in New Issue
Block a user