This commit is contained in:
laodaming 2023-10-07 15:00:41 +08:00
parent a9bb36d394
commit 6a35779bd5

View File

@ -85,18 +85,26 @@ func (w *wsConnectItem) consumeRenderImageData() {
case <-w.closeChan: //已关闭
return
case data := <-w.extendRenderProperty.renderChan: //消费数据
logx.Info("准备执行任务。。。。。")
limitChan <- struct{}{}
logx.Info("执行任务中。。。。。")
go func(d websocket_data.RenderImageReqMsg) {
defer func() {
if err := recover(); err != nil {
logx.Error("func renderImage panic:", err)
}
}()
tChan := make(chan struct{}, 1)
defer close(tChan)
defer func() {
<-limitChan
}()
go func() {
select {
case <-w.extendRenderProperty.renderCtx.Done():
panic("=========渲染取消旧的上下文=======")
case <-tChan:
return
}
}()
w.renderImage(d)
}(data)
}
@ -159,25 +167,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
logx.Error("failed to get element ,", err)
return
}
//获取模板开关信息并且对于没有默认值的给赋值默认值(但凡DIY有一个是空的就要请求默认数据)
/*if renderImageData.RenderData.Website == "" || renderImageData.RenderData.Phone == "" || renderImageData.RenderData.Address == "" || renderImageData.RenderData.Qrcode == "" || renderImageData.RenderData.Slogan == "" {
templateSwitchInfo := template_switch_info.GetTemplateSwitchInfo(productTemplate.Id, productTemplate.TemplateInfo, *productTemplate.MaterialImg)
if renderImageData.RenderData.Website == "" && templateSwitchInfo.MaterialData.Website.IfShow {
renderImageData.RenderData.Website = templateSwitchInfo.MaterialData.Website.DefaultValue
}
if renderImageData.RenderData.Phone == "" && templateSwitchInfo.MaterialData.Phone.IfShow {
renderImageData.RenderData.Phone = templateSwitchInfo.MaterialData.Phone.DefaultValue
}
if renderImageData.RenderData.Address == "" && templateSwitchInfo.MaterialData.Address.IfShow {
renderImageData.RenderData.Address = templateSwitchInfo.MaterialData.Address.DefaultValue
}
if renderImageData.RenderData.Qrcode == "" && templateSwitchInfo.MaterialData.QRcode.IfShow {
renderImageData.RenderData.Qrcode = templateSwitchInfo.MaterialData.QRcode.DefaultValue
}
if renderImageData.RenderData.Slogan == "" && templateSwitchInfo.MaterialData.Slogan.IfShow {
renderImageData.RenderData.Slogan = templateSwitchInfo.MaterialData.Slogan.DefaultValue
}
}*/
//获取刀版图
combineReq := repositories.LogoCombineReq{
UserId: renderImageData.RenderData.UserId,