| | |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/pkg/logx" |
| | | "aps_crm/proto/product" |
| | | "aps_crm/utils" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/shopspring/decimal" |
| | | "github.com/spf13/cast" |
| | |
| | | ctx.Ok() |
| | | return |
| | | } |
| | | first, err := model.NewSalesDetailsSearch().SetNumber(number).SetPreload(true).First() |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "明细详情查找失败") |
| | | return |
| | | } |
| | | params := make([]*product.Info, 0) |
| | | for _, p := range first.Products { |
| | | var pa product.Info |
| | | pa.ProductId = p.Number |
| | | pa.StartTime = utils.TimeToString(first.UpdatedAt) |
| | | pa.EndTime = first.DeliveryDate |
| | | params = append(params, &pa) |
| | | } |
| | | client := product.NewProductServiceClient(grpc_init.CrmApsGrpcServiceConn) |
| | | info, err := client.GetProductOrder(ctx.GetCtx(), &product.GetProductOrderRequest{Params: params}) |
| | | info, err := client.GetProductOrder(ctx.GetCtx(), &product.GetProductOrderRequest{SalesDetailsNumber: number}) |
| | | if err != nil { |
| | | logx.Errorf("GetProductOrder err: %v", err.Error()) |
| | | ctx.FailWithMsg(ecode.UnknownErr, "内部错误") |