Update orderRecordsLogic.go

This commit is contained in:
JNG 2026-06-09 15:31:41 +08:00
parent 86eac0df6a
commit bae837417d

View File

@ -3,7 +3,6 @@ package logic
import ( import (
"errors" "errors"
"fmt" "fmt"
uuid "github.com/satori/go.uuid"
"micro-bundle/internal/dao" "micro-bundle/internal/dao"
"micro-bundle/internal/model" "micro-bundle/internal/model"
"micro-bundle/pb/bundle" "micro-bundle/pb/bundle"
@ -11,6 +10,8 @@ import (
"micro-bundle/pkg/utils" "micro-bundle/pkg/utils"
"strconv" "strconv"
uuid "github.com/satori/go.uuid"
"github.com/jinzhu/copier" "github.com/jinzhu/copier"
) )
@ -84,7 +85,7 @@ func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonRespons
} }
orderMode := req.OrderMode orderMode := req.OrderMode
if orderMode == 0 { if orderMode == 0 {
orderMode = model.OrderModeNormal return res, errors.New("订单模式错误")
} }
payLaterStatus := req.PayLaterStatus payLaterStatus := req.PayLaterStatus
if orderMode == model.OrderModePayLater && payLaterStatus == 0 && req.Status != model.BundleStatusPaid { if orderMode == model.OrderModePayLater && payLaterStatus == 0 && req.Status != model.BundleStatusPaid {
@ -93,7 +94,7 @@ func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonRespons
// OrderType 从请求中获取,不写死 // OrderType 从请求中获取,不写死
orderType := req.OrderType orderType := req.OrderType
if orderType == 0 { if orderType == 0 {
orderType = model.OrderTypeBundle // 默认套餐订单 return res, errors.New("订单类型错误")
} }
orderRecord := &model.BundleOrderRecords{ orderRecord := &model.BundleOrderRecords{
UUID: orderUUID, UUID: orderUUID,