79 lines
2.7 KiB
Go
79 lines
2.7 KiB
Go
|
package repository
|
||
|
|
||
|
import (
|
||
|
"code.30cm.net/digimon/app-cloudep-order-service/pkg/domain/entity"
|
||
|
"context"
|
||
|
|
||
|
"go.mongodb.org/mongo-driver/mongo"
|
||
|
)
|
||
|
|
||
|
type OrderRepository interface {
|
||
|
Insert(ctx context.Context, data *entity.Order) error
|
||
|
FindOne(ctx context.Context, id string) (*entity.Order, error)
|
||
|
Update(ctx context.Context, data *entity.Order) (*mongo.UpdateResult, error)
|
||
|
Delete(ctx context.Context, id string) (int64, error)
|
||
|
UpdateStatus(ctx context.Context, data UpdateStatusReq) (*mongo.UpdateResult, error)
|
||
|
UpdateTimeoutOrder(ctx context.Context, req UpdateTimeoutReq) ([]string, error)
|
||
|
DeleteByBusinessID(ctx context.Context, id string) (*mongo.UpdateResult, error)
|
||
|
FindOneBusinessID(ctx context.Context, id string) (*entity.Order, error)
|
||
|
ListOrder(ctx context.Context, req GetOrderListReq) ([]entity.Order, int64, error)
|
||
|
ModifyBookingInfoByBusinessID(ctx context.Context, orderID string, param *BookingInfo) error
|
||
|
}
|
||
|
|
||
|
type (
|
||
|
UpdateStatusReq struct {
|
||
|
BusinessID string
|
||
|
Status int64
|
||
|
}
|
||
|
|
||
|
UpdateTimeoutReq struct {
|
||
|
CreateTimeBefore int64
|
||
|
}
|
||
|
|
||
|
GetOrderListReq struct {
|
||
|
PageIndex int64 `json:"page_index" validate:"required"`
|
||
|
PageSize int64 `json:"page_size" validate:"required"`
|
||
|
|
||
|
ReferenceID string `json:"reference_id"`
|
||
|
ReferenceUID string `json:"reference_uid"`
|
||
|
BusinessID string `json:"business_id"`
|
||
|
UID string `json:"uid"`
|
||
|
OrderType int `json:"order_type"`
|
||
|
DirectionType []int64 `json:"direction_type"`
|
||
|
OrderStatus []int64 `json:"order_status"`
|
||
|
|
||
|
StartCreateTime int64 `json:"start_create_time"`
|
||
|
EndCreateTime int64 `json:"end_create_time"`
|
||
|
StartUpdateTime int64 `json:"start_update_time"`
|
||
|
EndUpdateTime int64 `json:"end_update_time"`
|
||
|
StartOrderArrivalTime int64 `json:"start_order_arrival_time"`
|
||
|
EndOrderArrivalTime int64 `json:"end_order_arrival_time"`
|
||
|
StartOrderPaymentTime int64 `json:"start_order_payment_time"`
|
||
|
EndOrderPaymentTime int64 `json:"end_order_payment_time"`
|
||
|
|
||
|
CryptoType string `json:"crypto_type"`
|
||
|
TxHash string `json:"tx_hash"`
|
||
|
}
|
||
|
|
||
|
BookingInfo struct {
|
||
|
SenderName string // 寄件者姓名
|
||
|
SenderPhone string // 寄件者手機
|
||
|
SenderEmail string // 寄件者信箱
|
||
|
SenderNational string // 寄件者國家
|
||
|
SenderAddress string // 寄件者地址
|
||
|
SenderCode string // 寄件者郵遞區號
|
||
|
ReceiverName string // 收件者姓名
|
||
|
ReceiverPhone string // 收件者手機
|
||
|
ReceiverEmail string // 收件者信箱
|
||
|
ReceiverAddress string // 收件者地址
|
||
|
ReceiverNational string // 收件者國家
|
||
|
ReceiverCode string // 收件者郵遞區號
|
||
|
Memo string // 備註
|
||
|
}
|
||
|
)
|
||
|
|
||
|
type OrderItem struct {
|
||
|
ItemID string
|
||
|
Count int64
|
||
|
}
|