fix
This commit is contained in:
parent
ea2fd732a2
commit
d85c39327c
|
@ -40,11 +40,13 @@ func (m *MqConsumerRenderAssemble) Run(ctx context.Context, data []byte) error {
|
||||||
}
|
}
|
||||||
val := ctx.Value("svcctx")
|
val := ctx.Value("svcctx")
|
||||||
if val == nil {
|
if val == nil {
|
||||||
return errors.New("svcctx is nil")
|
logx.Error("svcctx is nil")
|
||||||
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
svcCtx, ok := val.(*svc.ServiceContext)
|
svcCtx, ok := val.(*svc.ServiceContext)
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("svcctx is nil!!")
|
logx.Error("svcctx is nil!!")
|
||||||
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
rabbitmq := initalize.RabbitMqHandle{}
|
rabbitmq := initalize.RabbitMqHandle{}
|
||||||
//获取模板(产品第一个sku的模板)
|
//获取模板(产品第一个sku的模板)
|
||||||
|
@ -52,10 +54,10 @@ func (m *MqConsumerRenderAssemble) Run(ctx context.Context, data []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
logx.Error("template info is not found")
|
logx.Error("template info is not found")
|
||||||
return nil
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
logx.Error("failed to get template info:", err)
|
logx.Error("failed to get template info:", err)
|
||||||
return err
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
combineImage := "" //刀版图
|
combineImage := "" //刀版图
|
||||||
combineHash := hash.JsonHashKey(parseInfo) //区别于云渲染的taskid,这个用获取刀版图缓存
|
combineHash := hash.JsonHashKey(parseInfo) //区别于云渲染的taskid,这个用获取刀版图缓存
|
||||||
|
@ -63,13 +65,13 @@ func (m *MqConsumerRenderAssemble) Run(ctx context.Context, data []byte) error {
|
||||||
resource, err := svcCtx.AllModels.FsResource.FindOneById(ctx, combineHash)
|
resource, err := svcCtx.AllModels.FsResource.FindOneById(ctx, combineHash)
|
||||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
logx.Error("failed to get resource :", err)
|
logx.Error("failed to get resource :", err)
|
||||||
return err
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
//如果不存在,则请求生成刀版图
|
//如果不存在,则请求生成刀版图
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
combineImage, err = getCombineImage(ctx, svcCtx, parseInfo, productTemplate, combineHash)
|
combineImage, err = getCombineImage(ctx, svcCtx, parseInfo, productTemplate, combineHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
combineImage = *resource.ResourceUrl
|
combineImage = *resource.ResourceUrl
|
||||||
|
@ -79,10 +81,10 @@ func (m *MqConsumerRenderAssemble) Run(ctx context.Context, data []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
logx.Error("element info is not found,model_id = ?", *productTemplate.ModelId)
|
logx.Error("element info is not found,model_id = ?", *productTemplate.ModelId)
|
||||||
return nil
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
logx.Error("failed to get element list,", err)
|
logx.Error("failed to get element list,", err)
|
||||||
return err
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
//组装数据
|
//组装数据
|
||||||
refletion := -1
|
refletion := -1
|
||||||
|
@ -94,7 +96,7 @@ func (m *MqConsumerRenderAssemble) Run(ctx context.Context, data []byte) error {
|
||||||
if element.Mode != nil && *element.Mode != "" {
|
if element.Mode != nil && *element.Mode != "" {
|
||||||
if err = json.Unmarshal([]byte(*element.Mode), &mode); err != nil {
|
if err = json.Unmarshal([]byte(*element.Mode), &mode); err != nil {
|
||||||
logx.Error("faile to parse element mode json:", err)
|
logx.Error("faile to parse element mode json:", err)
|
||||||
return err
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tempData := make([]map[string]interface{}, 0, 3)
|
tempData := make([]map[string]interface{}, 0, 3)
|
||||||
|
@ -154,7 +156,7 @@ func (m *MqConsumerRenderAssemble) Run(ctx context.Context, data []byte) error {
|
||||||
b, _ := json.Marshal(sendData)
|
b, _ := json.Marshal(sendData)
|
||||||
if err = rabbitmq.SendMsg(constants.RABBIT_MQ_TO_UNITY, b); err != nil {
|
if err = rabbitmq.SendMsg(constants.RABBIT_MQ_TO_UNITY, b); err != nil {
|
||||||
logx.Error("发送渲染组装数据到rabbitmq失败:", err)
|
logx.Error("发送渲染组装数据到rabbitmq失败:", err)
|
||||||
return err
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
logx.Info("发送渲染组装数据到unity成功")
|
logx.Info("发送渲染组装数据到unity成功")
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user