From 030f79eabe86b972c6925ab88caddd3a898fc32d Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Wed, 11 Mar 2026 09:46:04 +0800 Subject: [PATCH] =?UTF-8?q?Updata=EF=BC=9A=E6=9B=B4=E6=96=B0=E5=8F=91?= =?UTF-8?q?=E7=A5=A8=E5=88=9B=E5=BB=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/service/bundle/reconciliation.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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),