修改
This commit is contained in:
parent
20d5abe4b0
commit
559a06f697
@ -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)
|
res, err := service.BundleProvider.OrderRecordsDetail(context.Background(), &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -30,8 +30,6 @@ func CreateStripeCheckoutSession(c *gin.Context) {
|
|||||||
// 获取 用户信息
|
// 获取 用户信息
|
||||||
userInfo := login.GetUserInfoFromC(c)
|
userInfo := login.GetUserInfoFromC(c)
|
||||||
|
|
||||||
fmt.Println("userInfo.ID:", userInfo.ID)
|
|
||||||
|
|
||||||
// 检查 订单信息
|
// 检查 订单信息
|
||||||
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
|
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
|
||||||
OrderNo: req.OutTradeNo,
|
OrderNo: req.OutTradeNo,
|
||||||
@ -42,24 +40,18 @@ func CreateStripeCheckoutSession(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("detail: %+v\n", detail)
|
|
||||||
|
|
||||||
// 判断 是否是 本人操作
|
// 判断 是否是 本人操作
|
||||||
if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID {
|
if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID {
|
||||||
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("1111111111111111111111")
|
|
||||||
|
|
||||||
//金额校验
|
//金额校验
|
||||||
if detail.OrderRecord.TotalAmount*100 != float32(req.ProductAllPrice) {
|
if detail.OrderRecord.TotalAmount*100 != float32(req.ProductAllPrice) {
|
||||||
service.Error(c, errors.New(common.InvalidOrderAmount))
|
service.Error(c, errors.New(common.InvalidOrderAmount))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("22222222222222222222222")
|
|
||||||
|
|
||||||
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
||||||
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
|
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)
|
result, err := service.OrderProvider.CreateStripeCheckoutSession(context.Background(), &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -104,8 +94,6 @@ func CreateStripeCheckoutSession(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("444444444444444444444")
|
|
||||||
|
|
||||||
//更新订单状态
|
//更新订单状态
|
||||||
_, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{
|
_, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{
|
||||||
Uuid: detail.OrderRecord.Uuid,
|
Uuid: detail.OrderRecord.Uuid,
|
||||||
|
Loading…
Reference in New Issue
Block a user