From 785c87c2a12ce0107c30f3fa3b2cfb9f02f979d1 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Tue, 3 Mar 2026 15:41:04 +0800 Subject: [PATCH] =?UTF-8?q?Updata=EF=BC=9A=E5=88=B7=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E4=B8=AD=E5=A2=9E=E5=8A=A0=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=8F=91=E7=A5=A8=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 d62c7893..0c73de8b 100644 --- a/pkg/service/bundle/reconciliation.go +++ b/pkg/service/bundle/reconciliation.go @@ -492,6 +492,26 @@ func AutoCreateUserAndOrder(c *gin.Context) { return } + //生成发票 + 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 + } + //如果是购买套餐 1:创建新的余量信息CreateBundleBalance 2 添加扩展记录BundleExtend _, err = service.BundleProvider.CreateBundleBalance(context.Background(), &bundle.CreateBundleBalanceReq{ UserId: int32(userResp.UserId),