97 lines
2.8 KiB
Go
97 lines
2.8 KiB
Go
package dto
|
|
|
|
import (
|
|
"strings"
|
|
"time"
|
|
|
|
"quyun/v2/app/requests"
|
|
"quyun/v2/pkg/consts"
|
|
)
|
|
|
|
type OrderPageFilter struct {
|
|
requests.Pagination `json:",inline" query:",inline"`
|
|
requests.SortQueryFilter `json:",inline" query:",inline"`
|
|
|
|
ID *int64 `json:"id,omitempty" query:"id"`
|
|
TenantID *int64 `json:"tenant_id,omitempty" query:"tenant_id"`
|
|
UserID *int64 `json:"user_id,omitempty" query:"user_id"`
|
|
|
|
TenantCode *string `json:"tenant_code,omitempty" query:"tenant_code"`
|
|
TenantName *string `json:"tenant_name,omitempty" query:"tenant_name"`
|
|
Username *string `json:"username,omitempty" query:"username"`
|
|
|
|
ContentID *int64 `json:"content_id,omitempty" query:"content_id"`
|
|
ContentTitle *string `json:"content_title,omitempty" query:"content_title"`
|
|
|
|
Type *consts.OrderType `json:"type,omitempty" query:"type"`
|
|
Status *consts.OrderStatus `json:"status,omitempty" query:"status"`
|
|
|
|
CreatedAtFrom *time.Time `json:"created_at_from,omitempty" query:"created_at_from"`
|
|
CreatedAtTo *time.Time `json:"created_at_to,omitempty" query:"created_at_to"`
|
|
PaidAtFrom *time.Time `json:"paid_at_from,omitempty" query:"paid_at_from"`
|
|
PaidAtTo *time.Time `json:"paid_at_to,omitempty" query:"paid_at_to"`
|
|
|
|
AmountPaidMin *int64 `json:"amount_paid_min,omitempty" query:"amount_paid_min"`
|
|
AmountPaidMax *int64 `json:"amount_paid_max,omitempty" query:"amount_paid_max"`
|
|
}
|
|
|
|
func (f *OrderPageFilter) TenantCodeTrimmed() string {
|
|
if f == nil || f.TenantCode == nil {
|
|
return ""
|
|
}
|
|
return strings.ToLower(strings.TrimSpace(*f.TenantCode))
|
|
}
|
|
|
|
func (f *OrderPageFilter) TenantNameTrimmed() string {
|
|
if f == nil || f.TenantName == nil {
|
|
return ""
|
|
}
|
|
return strings.TrimSpace(*f.TenantName)
|
|
}
|
|
|
|
func (f *OrderPageFilter) UsernameTrimmed() string {
|
|
if f == nil || f.Username == nil {
|
|
return ""
|
|
}
|
|
return strings.TrimSpace(*f.Username)
|
|
}
|
|
|
|
func (f *OrderPageFilter) ContentTitleTrimmed() string {
|
|
if f == nil || f.ContentTitle == nil {
|
|
return ""
|
|
}
|
|
return strings.TrimSpace(*f.ContentTitle)
|
|
}
|
|
|
|
type OrderTenantLite struct {
|
|
ID int64 `json:"id"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type OrderBuyerLite struct {
|
|
ID int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
}
|
|
|
|
type SuperOrderItem struct {
|
|
ID int64 `json:"id"`
|
|
Tenant *OrderTenantLite `json:"tenant,omitempty"`
|
|
Buyer *OrderBuyerLite `json:"buyer,omitempty"`
|
|
|
|
Type consts.OrderType `json:"type"`
|
|
Status consts.OrderStatus `json:"status"`
|
|
|
|
StatusDescription string `json:"status_description,omitempty"`
|
|
Currency consts.Currency `json:"currency"`
|
|
|
|
AmountOriginal int64 `json:"amount_original"`
|
|
AmountDiscount int64 `json:"amount_discount"`
|
|
AmountPaid int64 `json:"amount_paid"`
|
|
|
|
PaidAt time.Time `json:"paid_at"`
|
|
RefundedAt time.Time `json:"refunded_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|