chore(init): 初始化解忧商行项目并完成 Phase 0 基座
This commit is contained in:
@@ -0,0 +1,352 @@
|
||||
package order
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"hfb_sys/backend/internal/auditlog"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
type OrderDTO struct {
|
||||
ID uint64 `json:"id"`
|
||||
OrderNo string `json:"order_no"`
|
||||
ListingID uint64 `json:"listing_id"`
|
||||
ListingNo string `json:"listing_no"`
|
||||
AccountID uint64 `json:"account_id"`
|
||||
OwnerID uint64 `json:"owner_id"`
|
||||
RenterID uint64 `json:"renter_id"`
|
||||
OwnerPhone string `json:"owner_phone,omitempty"`
|
||||
RenterPhone string `json:"renter_phone,omitempty"`
|
||||
Title string `json:"title"`
|
||||
ServerRegion string `json:"server_region"`
|
||||
LoginPlatform string `json:"login_platform"`
|
||||
RentedAt *time.Time `json:"rented_at"`
|
||||
EstimatedDurationHours int `json:"estimated_duration_hours"`
|
||||
EstimatedEndAt *time.Time `json:"estimated_end_at,omitempty"`
|
||||
PriceRole string `json:"price_role,omitempty"`
|
||||
DisplayAmountCent int64 `json:"display_amount_cent"`
|
||||
RentAmountCent *int64 `json:"rent_amount_cent,omitempty"`
|
||||
OwnerRentAmountCent *int64 `json:"owner_rent_amount_cent,omitempty"`
|
||||
DepositAmountCent int64 `json:"deposit_amount_cent"`
|
||||
DepositOriginalAmountCent int64 `json:"deposit_original_amount_cent"`
|
||||
DepositWaivedAmountCent int64 `json:"deposit_waived_amount_cent"`
|
||||
DepositFreeLevelQuotaCent int64 `json:"deposit_free_level_quota_cent,omitempty"`
|
||||
DepositFreeManualQuotaCent int64 `json:"deposit_free_manual_quota_cent,omitempty"`
|
||||
DepositFreeUsedBeforeCent int64 `json:"deposit_free_used_before_cent,omitempty"`
|
||||
PlatformFeeCent *int64 `json:"platform_fee_cent,omitempty"`
|
||||
BasePriceCent int64 `json:"base_price_cent,omitempty"`
|
||||
ShelfMarkupCent int64 `json:"shelf_markup_cent,omitempty"`
|
||||
MarkupSiteID uint64 `json:"markup_site_id,omitempty"`
|
||||
ShelfRatio float64 `json:"shelf_ratio,omitempty"`
|
||||
ShelfRatioDelta float64 `json:"shelf_ratio_delta,omitempty"`
|
||||
RentOriginalAmountCent int64 `json:"rent_original_amount_cent,omitempty"`
|
||||
RentDiscountAmountCent int64 `json:"rent_discount_amount_cent,omitempty"`
|
||||
PureCoinOriginalAmountCent int64 `json:"pure_coin_original_amount_cent,omitempty"`
|
||||
ExtraItemOriginalAmountCent int64 `json:"extra_item_original_amount_cent,omitempty"`
|
||||
ActualCoinConsumedM float64 `json:"actual_coin_consumed_m,omitempty"`
|
||||
ActualPureCoinAmountCent int64 `json:"actual_pure_coin_amount_cent,omitempty"`
|
||||
ActualPureCoinDiscountCent int64 `json:"actual_pure_coin_discount_cent,omitempty"`
|
||||
ActualExtraItemAmountCent int64 `json:"actual_extra_item_amount_cent,omitempty"`
|
||||
RenterGrowthLevel string `json:"renter_growth_level,omitempty"`
|
||||
RenterGrowthLevelName string `json:"renter_growth_level_name,omitempty"`
|
||||
RenterDiscountBps int `json:"renter_discount_bps,omitempty"`
|
||||
GrowthPointsBasisCent int64 `json:"growth_points_basis_cent,omitempty"`
|
||||
GrowthPointsPerYuan int64 `json:"growth_points_per_yuan,omitempty"`
|
||||
GrowthPointsAwarded int64 `json:"growth_points_awarded,omitempty"`
|
||||
GrowthPointsAwardedAt *time.Time `json:"growth_points_awarded_at,omitempty"`
|
||||
AccountSnapshot datatypes.JSON `json:"account_snapshot"`
|
||||
AccountSource string `json:"account_source"`
|
||||
SourceChannel string `json:"source_channel,omitempty"`
|
||||
Status string `json:"status"`
|
||||
HandoffStatus string `json:"handoff_status"`
|
||||
HandoffMode string `json:"handoff_mode"`
|
||||
SettlementMode string `json:"settlement_mode"`
|
||||
ManagedAdminID *uint64 `json:"managed_admin_id,omitempty"`
|
||||
SettlementStatus string `json:"settlement_status"`
|
||||
OfflineSettlementStatus string `json:"offline_settlement_status,omitempty"`
|
||||
OfflineSettlementAmountCent int64 `json:"offline_settlement_amount_cent"`
|
||||
OfflineSettlementRemark string `json:"offline_settlement_remark,omitempty"`
|
||||
OfflineSettledBy *uint64 `json:"offline_settled_by,omitempty"`
|
||||
OfflineSettledAt *time.Time `json:"offline_settled_at,omitempty"`
|
||||
RefundStatus string `json:"refund_status,omitempty"`
|
||||
RefundAmountCent int64 `json:"refund_amount_cent"`
|
||||
DepositHoldStatus string `json:"deposit_hold_status,omitempty"`
|
||||
DepositHoldAmountCent int64 `json:"deposit_hold_amount_cent"`
|
||||
DepositHoldReason string `json:"deposit_hold_reason,omitempty"`
|
||||
DepositHeldAt *time.Time `json:"deposit_held_at,omitempty"`
|
||||
DepositHoldReleasedAt *time.Time `json:"deposit_hold_released_at,omitempty"`
|
||||
ActiveDispute *ActiveDisputeDTO `json:"active_dispute,omitempty"`
|
||||
Checkout *CheckoutDTO `json:"checkout,omitempty"`
|
||||
AdminActions *AdminActionsDTO `json:"admin_actions,omitempty"`
|
||||
PaymentDeadlineAt *time.Time `json:"payment_deadline_at,omitempty"`
|
||||
DistributionSiteID *uint64 `json:"distribution_site_id,omitempty"`
|
||||
SourceTrackCode string `json:"source_track_code,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// UserOrderListItemDTO 是“我的订单”列表的最小展示数据,详情数据仅由单订单接口返回。
|
||||
type UserOrderListItemDTO struct {
|
||||
ID uint64 `json:"id"`
|
||||
OrderNo string `json:"order_no"`
|
||||
ListingID uint64 `json:"listing_id"`
|
||||
ListingNo string `json:"listing_no"`
|
||||
Role string `json:"role"`
|
||||
Title string `json:"title"`
|
||||
ServerRegion string `json:"server_region"`
|
||||
LoginPlatform string `json:"login_platform"`
|
||||
RentalDays int `json:"rental_days,omitempty"`
|
||||
DailyLossM float64 `json:"daily_loss_m,omitempty"`
|
||||
DisplayAmountCent int64 `json:"display_amount_cent"`
|
||||
DepositAmountCent int64 `json:"deposit_amount_cent"`
|
||||
DepositWaivedAmountCent int64 `json:"deposit_waived_amount_cent"`
|
||||
Status string `json:"status"`
|
||||
HandoffStatus string `json:"handoff_status"`
|
||||
CanHide bool `json:"can_hide,omitempty"`
|
||||
PaymentDeadlineAt *time.Time `json:"payment_deadline_at,omitempty"`
|
||||
DistributionSiteID *uint64 `json:"distribution_site_id,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// AdminOrderListItemDTO 是后台订单表格的最小展示数据;手机号按客服需要返回完整值,其余敏感详情仅由详情接口按权限获取。
|
||||
type AdminOrderListItemDTO struct {
|
||||
ID uint64 `json:"id"`
|
||||
OrderNo string `json:"order_no"`
|
||||
ListingID uint64 `json:"listing_id"`
|
||||
ListingNo string `json:"listing_no"`
|
||||
OwnerPhone string `json:"owner_phone,omitempty"`
|
||||
RenterPhone string `json:"renter_phone,omitempty"`
|
||||
Title string `json:"title"`
|
||||
ServerRegion string `json:"server_region"`
|
||||
LoginPlatform string `json:"login_platform"`
|
||||
RentAmountCent int64 `json:"rent_amount_cent"`
|
||||
DepositAmountCent int64 `json:"deposit_amount_cent"`
|
||||
Status string `json:"status"`
|
||||
HandoffStatus string `json:"handoff_status"`
|
||||
HandoffMode string `json:"handoff_mode"`
|
||||
SettlementMode string `json:"settlement_mode"`
|
||||
SettlementStatus string `json:"settlement_status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// OwnerIncomeAmountCent 为号主实际到手金额(分),仅在已结账/已仲裁订单上返回;
|
||||
// 用指针区分「未结账(null)」与「到手 0 元」。数据来自结账表最新一行。
|
||||
OwnerIncomeAmountCent *int64 `json:"owner_income_amount_cent,omitempty"`
|
||||
}
|
||||
|
||||
type AdminActionsDTO struct {
|
||||
ResetHandoff *AdminActionDTO `json:"reset_handoff,omitempty"`
|
||||
PlatformHandoff *AdminActionDTO `json:"platform_handoff,omitempty"`
|
||||
ForceHandoff *AdminActionDTO `json:"force_handoff,omitempty"`
|
||||
PlatformCheckoutConfirm *AdminActionDTO `json:"platform_checkout_confirm,omitempty"`
|
||||
PlatformCheckoutCounter *AdminActionDTO `json:"platform_checkout_counter,omitempty"`
|
||||
PlatformCheckoutDispute *AdminActionDTO `json:"platform_checkout_dispute,omitempty"`
|
||||
PlatformOfflineSettlement *AdminActionDTO `json:"platform_offline_settlement,omitempty"`
|
||||
}
|
||||
|
||||
type AdminActionDTO struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Label string `json:"label"`
|
||||
}
|
||||
|
||||
type ActiveDisputeDTO struct {
|
||||
ID uint64 `json:"id"`
|
||||
InitiatorID uint64 `json:"initiator_id"`
|
||||
InitiatorType string `json:"initiator_type"`
|
||||
InitiatorAdminID *uint64 `json:"initiator_admin_id,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type CreateRequest struct {
|
||||
ListingID uint64 `json:"listing_id" binding:"required"`
|
||||
DistributionSiteCode string `json:"distribution_site_code" binding:"omitempty,max=64"`
|
||||
TrackCode string `json:"track_code,omitempty"`
|
||||
}
|
||||
|
||||
type SubmitHandoffRequest struct {
|
||||
Content string `json:"content" binding:"required"`
|
||||
}
|
||||
|
||||
type SubmitReturnRequest struct {
|
||||
Content string `json:"content" binding:"required"`
|
||||
}
|
||||
|
||||
type SubmitCheckoutRequest struct {
|
||||
Content string `json:"content" binding:"required"`
|
||||
ConsumableAmountCent int64 `json:"consumable_amount_cent"`
|
||||
CoinConsumedM float64 `json:"coin_consumed_m"`
|
||||
OtherAmountCent int64 `json:"other_amount_cent"`
|
||||
EvidenceURLS []string `json:"evidence_urls"`
|
||||
}
|
||||
|
||||
type CounterCheckoutRequest struct {
|
||||
ConsumableAmountCent int64 `json:"consumable_amount_cent"`
|
||||
CoinConsumedM float64 `json:"coin_consumed_m"`
|
||||
OtherAmountCent int64 `json:"other_amount_cent"`
|
||||
DepositDeductAmountCent int64 `json:"deposit_deduct_amount_cent"`
|
||||
Reason string `json:"reason" binding:"required"`
|
||||
EvidenceURLS []string `json:"evidence_urls"`
|
||||
}
|
||||
|
||||
type AdminActionRequest struct {
|
||||
Reason string `json:"reason" binding:"required"`
|
||||
ConfirmZeroOwnerIncome bool `json:"confirm_zero_owner_income"`
|
||||
}
|
||||
|
||||
type PlatformHandoffRequest struct {
|
||||
Content string `json:"content" binding:"required"`
|
||||
Reason string `json:"reason" binding:"required"`
|
||||
}
|
||||
|
||||
// ForceHandoffRequest 客服确认订单已完成交接。
|
||||
type ForceHandoffRequest struct {
|
||||
Content string `json:"content"`
|
||||
Reason string `json:"reason" binding:"required"`
|
||||
}
|
||||
|
||||
type OfflineSettlementRequest struct {
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
type AdminOrderQuery struct {
|
||||
Page int
|
||||
PageSize int
|
||||
Keyword string
|
||||
Status string
|
||||
HandoffStatus string
|
||||
HandoffMode string
|
||||
SettlementStatus string
|
||||
OfflineSettlementStatus string
|
||||
// UserID 精确匹配该用户作为号主或租客参与的订单(用户管理「明细」入口使用)。
|
||||
UserID uint64
|
||||
}
|
||||
|
||||
type AuditMeta = auditlog.Meta
|
||||
|
||||
type PaginatedResult struct {
|
||||
Items []OrderDTO `json:"items"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
}
|
||||
|
||||
// UserPaginatedResult 为用户订单列表提供受限分页,避免一次导出全部历史订单。
|
||||
type UserPaginatedResult struct {
|
||||
Items []UserOrderListItemDTO `json:"items"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
}
|
||||
|
||||
// SellerHandoffQuery 是号主待办列表的受限查询条件。
|
||||
type SellerHandoffQuery struct {
|
||||
Page int
|
||||
PageSize int
|
||||
Status string
|
||||
SiteCode string
|
||||
}
|
||||
|
||||
// SellerHandoffMetrics 为号主待办页提供跨分页的状态统计。
|
||||
type SellerHandoffMetrics struct {
|
||||
PendingHandoff int64 `json:"pending_handoff"`
|
||||
PendingCheckout int64 `json:"pending_checkout"`
|
||||
Abnormal int64 `json:"abnormal"`
|
||||
}
|
||||
|
||||
// SellerHandoffPaginatedResult 只包含当前用户作为号主时需要处理的订单。
|
||||
type SellerHandoffPaginatedResult struct {
|
||||
Items []UserOrderListItemDTO `json:"items"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
Metrics SellerHandoffMetrics `json:"metrics"`
|
||||
}
|
||||
|
||||
// AdminOrderListPaginatedResult 使用列表专用 DTO,避免后台首页携带订单敏感详情。
|
||||
type AdminOrderListPaginatedResult struct {
|
||||
Items []AdminOrderListItemDTO `json:"items"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
}
|
||||
|
||||
type RefundStatusDTO struct {
|
||||
OrderID uint64 `json:"order_id"`
|
||||
OrderNo string `json:"order_no"`
|
||||
RefundStatus string `json:"refund_status"`
|
||||
RefundAmountCent int64 `json:"refund_amount_cent"`
|
||||
RefundedAt *time.Time `json:"refunded_at,omitempty"`
|
||||
TotalAmountCent int64 `json:"total_amount_cent"`
|
||||
}
|
||||
|
||||
type HandoffRecordDTO struct {
|
||||
ID uint64 `json:"id"`
|
||||
OrderID uint64 `json:"order_id"`
|
||||
FromUserID uint64 `json:"from_user_id"`
|
||||
ToUserID uint64 `json:"to_user_id"`
|
||||
Type string `json:"type"`
|
||||
Content string `json:"content"`
|
||||
ConfirmedByRenterAt *time.Time `json:"confirmed_by_renter_at"`
|
||||
ConfirmedByOwnerAt *time.Time `json:"confirmed_by_owner_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// ProcessEventDTO 是后台交易时间线中的一条不可变过程记录。
|
||||
type ProcessEventDTO struct {
|
||||
ID uint64 `json:"id"`
|
||||
BusinessType string `json:"business_type"`
|
||||
BusinessID uint64 `json:"business_id"`
|
||||
Stage string `json:"stage"`
|
||||
Action string `json:"action"`
|
||||
ActorType string `json:"actor_type"`
|
||||
ActorID uint64 `json:"actor_id"`
|
||||
ActorName string `json:"actor_name"`
|
||||
TargetType string `json:"target_type"`
|
||||
TargetID *uint64 `json:"target_id,omitempty"`
|
||||
TargetName string `json:"target_name"`
|
||||
Content string `json:"content"`
|
||||
Reason string `json:"reason"`
|
||||
Payload datatypes.JSON `json:"payload"`
|
||||
AttachmentURLs []string `json:"attachment_urls"`
|
||||
StateBefore datatypes.JSON `json:"state_before"`
|
||||
StateAfter datatypes.JSON `json:"state_after"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type CheckoutDTO struct {
|
||||
ID uint64 `json:"id"`
|
||||
OrderID uint64 `json:"order_id"`
|
||||
InitiatedBy uint64 `json:"initiated_by"`
|
||||
Status string `json:"status"`
|
||||
RoundCount int `json:"round_count"`
|
||||
Turn string `json:"turn"`
|
||||
ProposedBy uint64 `json:"proposed_by"`
|
||||
MaxRounds int `json:"max_rounds"`
|
||||
CanCounter bool `json:"can_counter"`
|
||||
CanAccept bool `json:"can_accept"`
|
||||
PriceRole string `json:"price_role,omitempty"`
|
||||
DisplayAmountCent int64 `json:"display_amount_cent"`
|
||||
RentAmountCent *int64 `json:"rent_amount_cent,omitempty"`
|
||||
OwnerRentAmountCent *int64 `json:"owner_rent_amount_cent,omitempty"`
|
||||
PlatformFeeCent *int64 `json:"platform_fee_cent,omitempty"`
|
||||
DepositAmountCent int64 `json:"deposit_amount_cent"`
|
||||
PureCoinAmountCent int64 `json:"pure_coin_amount_cent"`
|
||||
PureCoinDiscountCent int64 `json:"pure_coin_discount_cent"`
|
||||
PureCoinPayableCent int64 `json:"pure_coin_payable_cent"`
|
||||
ConsumableAmountCent int64 `json:"consumable_amount_cent"`
|
||||
CoinConsumedM float64 `json:"coin_consumed_m"`
|
||||
OtherAmountCent int64 `json:"other_amount_cent"`
|
||||
DepositDeductAmountCent int64 `json:"deposit_deduct_amount_cent"`
|
||||
RenterRefundAmountCent *int64 `json:"renter_refund_amount_cent,omitempty"`
|
||||
OwnerIncomeAmountCent *int64 `json:"owner_income_amount_cent,omitempty"`
|
||||
ShortfallCent int64 `json:"shortfall_cent"`
|
||||
OvershootAmountCent int64 `json:"overshoot_amount_cent"`
|
||||
Content string `json:"content"`
|
||||
EvidenceURLS []string `json:"evidence_urls"`
|
||||
OwnerAdjustmentReason string `json:"owner_adjustment_reason"`
|
||||
OwnerAdjustedAt *time.Time `json:"owner_adjusted_at"`
|
||||
RenterConfirmedAt *time.Time `json:"renter_confirmed_at"`
|
||||
RenterRejectedAt *time.Time `json:"renter_rejected_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user