This commit is contained in:
蒋海成 2025-03-29 00:36:26 +08:00
parent 20d5abe4b0
commit 559a06f697
2 changed files with 2 additions and 14 deletions

View File

@ -272,9 +272,9 @@ func OrderRecordsDetail(c *gin.Context) {
}
// 获取 用户信息
userInfo := login.GetUserInfoFromC(c)
//userInfo := login.GetUserInfoFromC(c)
req.CustomerID = strconv.FormatUint(userInfo.ID, 10)
//req.CustomerID = strconv.FormatUint(userInfo.ID, 10)
res, err := service.BundleProvider.OrderRecordsDetail(context.Background(), &req)
if err != nil {

View File

@ -30,8 +30,6 @@ func CreateStripeCheckoutSession(c *gin.Context) {
// 获取 用户信息
userInfo := login.GetUserInfoFromC(c)
fmt.Println("userInfo.ID:", userInfo.ID)
// 检查 订单信息
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
OrderNo: req.OutTradeNo,
@ -42,24 +40,18 @@ func CreateStripeCheckoutSession(c *gin.Context) {
return
}
fmt.Printf("detail: %+v\n", detail)
// 判断 是否是 本人操作
if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID {
service.Error(c, errors.New(common.NotMatchOrderInfo))
return
}
fmt.Println("1111111111111111111111")
//金额校验
if detail.OrderRecord.TotalAmount*100 != float32(req.ProductAllPrice) {
service.Error(c, errors.New(common.InvalidOrderAmount))
return
}
fmt.Println("22222222222222222222222")
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
// 查询支付结果
@ -95,8 +87,6 @@ func CreateStripeCheckoutSession(c *gin.Context) {
}
}
fmt.Println("333333333333333333333")
//调用微服务获取支付地址
result, err := service.OrderProvider.CreateStripeCheckoutSession(context.Background(), &req)
if err != nil {
@ -104,8 +94,6 @@ func CreateStripeCheckoutSession(c *gin.Context) {
return
}
fmt.Println("444444444444444444444")
//更新订单状态
_, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{
Uuid: detail.OrderRecord.Uuid,