You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.6 KiB
Go
42 lines
1.6 KiB
Go
package order
|
|
|
|
import (
|
|
"cls/internal/domain/order"
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
ErrInvalidAmount = errors.New("价格不能小于0")
|
|
ErrOrderExists = errors.New("订单已存在")
|
|
ErrOrderNotFound = errors.New("订单不存在")
|
|
ErrOrderPaid = errors.New("订单已支付")
|
|
ErrOrderCanceled = errors.New("订单已取消")
|
|
)
|
|
|
|
// CreateOrderRequest 创建订单请求
|
|
type CreateOrderRequest struct {
|
|
UserID uint64 `json:"userId"` // 用户ID
|
|
TargetID uint64 `json:"targetId"` // 商品ID
|
|
Type order.OrderType `json:"type"` // 订单类型
|
|
Amount int64 `json:"amount"` // 订单金额
|
|
Duration int `json:"duration"` // 购买时长
|
|
Description string `json:"description"` // 商品描述
|
|
CouponId uint64 `json:"coupon"` //优惠券
|
|
}
|
|
|
|
// OrderResponse 订单响应
|
|
type OrderResponse struct {
|
|
ID uint64 `json:"id"` // 订单ID
|
|
OrderNo string `json:"orderNo"` // 订单编号
|
|
UserID uint64 `json:"userId"` // 用户ID
|
|
TargetID uint64 `json:"targetId"` // 商品ID
|
|
Type order.OrderType `json:"type"` // 订单类型
|
|
Amount int64 `json:"amount"` // 订单金额
|
|
Duration int `json:"duration"` // 购买时长
|
|
Status order.OrderStatus `json:"status"` // 订单状态
|
|
Description string `json:"description"` // 商品描述
|
|
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
|
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
|
}
|