diff --git a/pkg/service/bundle/reconciliation.go b/pkg/service/bundle/reconciliation.go index fea7a0e7..eec292b3 100644 --- a/pkg/service/bundle/reconciliation.go +++ b/pkg/service/bundle/reconciliation.go @@ -491,6 +491,26 @@ func AutoCreateUserAndOrder(c *gin.Context) { 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 := unfinishInfo.PayTime + 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{ UserId: int32(userResp.UserId),