| | |
| | | return |
| | | } |
| | | |
| | | var productIds []string |
| | | for _, v := range params.Details { |
| | | productIds = append(productIds, v.ProductId) |
| | | } |
| | | products, err := models.NewMaterialSearch().SetIDs(productIds).FindNotTotal() |
| | | if err != nil { |
| | | logx.Errorf("MonthStats get products err:%v", err) |
| | | return |
| | | } |
| | | productMap := models.MaterialMap(products) |
| | | for i, v := range params.Details { |
| | | material := productMap[v.ProductId] |
| | | if material != nil { |
| | | params.Details[i].Note = material.Note |
| | | } |
| | | } |
| | | |
| | | if err := models.NewOperationSearch().Create(¶ms); err != nil { |
| | | logx.Errorf("Operation create err: %v", err) |
| | | util.ResponseFormat(c, code.SaveFail, "添加失败:"+err.Error()) |