diff --git a/pkg/service/bundle/reconciliation.go b/pkg/service/bundle/reconciliation.go index da949c4d..725437db 100644 --- a/pkg/service/bundle/reconciliation.go +++ b/pkg/service/bundle/reconciliation.go @@ -493,24 +493,24 @@ func AutoCreateUserAndOrder(c *gin.Context) { } //生成发票 - //orderRecord, err := service.BundleProvider.GetOrderInfoByOrderNo(context.Background(), &bundle.GetOrderInfoByOrderNoReq{ - // Uuid: unfinishInfo.OrderNo, //因为需求更新,实际传入的是订单的uuid - //}) - //if err != nil { - // service.Error(c, err) - // return - //} - //amountType := strconv.FormatInt(orderRecord.AmountType, 10) - //applyTime := common.GetBeijingTime() - //payTime, _ := time.Parse("2006-01-02 15:04:05", applyTime) - //payTimeString := payTime.Format("20060102") - //fmt.Println("发票payTimeString :", payTimeString, "发票applyTime :", applyTime, "发票payTime :", payTime) - //fmt.Println("发票时间数据获取完成") - //err = createInvoice(orderRecord.UserId, orderRecord.UserNum, orderRecord.UserName, orderRecord.Address, orderRecord.Phone, orderRecord.BundleName, orderRecord.OrderNo, "1", amountType, orderRecord.TotalAmount, payTimeString, payTimeString, applyTime) - //if err != nil { - // service.Error(c, errors.New("生成发票失败")) - // return - //} + orderRecord, err := service.BundleProvider.GetOrderInfoByOrderNo(context.Background(), &bundle.GetOrderInfoByOrderNoReq{ + OrderNo: unfinishInfo.OrderNo, //因为需求更新,实际传入的是订单的uuid + }) + if err != nil { + service.Error(c, err) + return + } + amountType := strconv.FormatInt(orderRecord.AmountType, 10) + applyTime := common.GetBeijingTime() + payTime, _ := time.Parse("2006-01-02 15:04:05", applyTime) + payTimeString := payTime.Format("20060102") + fmt.Println("发票payTimeString :", payTimeString, "发票applyTime :", applyTime, "发票payTime :", payTime) + fmt.Println("发票时间数据获取完成") + err = createInvoice(orderRecord.UserId, orderRecord.UserNum, orderRecord.UserName, orderRecord.Address, orderRecord.Phone, orderRecord.BundleName, orderRecord.OrderNo, "1", amountType, orderRecord.TotalAmount, payTimeString, payTimeString, applyTime) + if err != nil { + service.Error(c, errors.New("生成发票失败")) + return + } //如果是购买套餐 1:创建新的余量信息CreateBundleBalance 2 添加扩展记录BundleExtend _, err = service.BundleProvider.CreateBundleBalance(context.Background(), &bundle.CreateBundleBalanceReq{