集中订单状态常量
This commit is contained in:
@@ -26,16 +26,16 @@ func (r *Repository) AdminClose(adminID uint64, orderID uint64, req AdminActionR
|
||||
beforeListingStatus := listing.Status
|
||||
beforeAccountStatus := account.Status
|
||||
now := time.Now()
|
||||
order.Status = "closed"
|
||||
order.HandoffStatus = "admin_closed"
|
||||
order.SettlementStatus = "closed"
|
||||
order.Status = orderStatusClosed
|
||||
order.HandoffStatus = handoffStatusAdminClosed
|
||||
order.SettlementStatus = settlementStatusClosed
|
||||
order.SettledAt = &now
|
||||
listing.Status = "offline"
|
||||
listing.Status = listingStatusOffline
|
||||
listing.InTransaction = false
|
||||
account.Status = "offline"
|
||||
if beforeOrderStatus != "pending_payment" {
|
||||
account.Status = accountStatusOffline
|
||||
if beforeOrderStatus != orderStatusPendingPayment {
|
||||
totalCent := order.RentAmountCent + order.DepositAmountCent
|
||||
action, err := r.prepareRefund(order, totalCent, "admin_close_refund", "客服关闭订单原路退款")
|
||||
action, err := r.prepareRefund(order, totalCent, refundBizAdminClose, "客服关闭订单原路退款")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -108,11 +108,11 @@ func (r *Repository) AdminMarkAbnormal(adminID uint64, orderID uint64, req Admin
|
||||
beforeHandoffStatus := order.HandoffStatus
|
||||
beforeListingStatus := listing.Status
|
||||
beforeAccountStatus := account.Status
|
||||
order.Status = "abnormal"
|
||||
order.HandoffStatus = "admin_abnormal"
|
||||
listing.Status = "abnormal"
|
||||
order.Status = orderStatusAbnormal
|
||||
order.HandoffStatus = handoffStatusAdminAbnormal
|
||||
listing.Status = listingStatusAbnormal
|
||||
listing.InTransaction = false
|
||||
account.Status = "abnormal"
|
||||
account.Status = accountStatusAbnormal
|
||||
if err := notification.Append(tx,
|
||||
notification.Entry{
|
||||
UserID: order.RenterID,
|
||||
@@ -166,7 +166,7 @@ func (r *Repository) AdminRefund(orderID uint64) (*RefundStatusDTO, error) {
|
||||
if err := r.db.First(&order, orderID).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if order.RefundStatus == "refunded" {
|
||||
if order.RefundStatus == refundStatusRefunded {
|
||||
return r.buildRefundStatusDTO(&order), nil
|
||||
}
|
||||
if r.refundFunc == nil {
|
||||
@@ -176,7 +176,7 @@ func (r *Repository) AdminRefund(orderID uint64) (*RefundStatusDTO, error) {
|
||||
if totalCent <= 0 {
|
||||
return nil, ErrInvalidCheckoutAmount
|
||||
}
|
||||
status, err := r.refundFunc(orderID, totalCent, "admin_refund", "后台人工退款")
|
||||
status, err := r.refundFunc(orderID, totalCent, refundBizAdmin, "后台人工退款")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -228,5 +228,5 @@ func (r *Repository) findOrderAssetsForAdminUpdate(tx *gorm.DB, orderID uint64)
|
||||
}
|
||||
|
||||
func isTerminalStatus(status string) bool {
|
||||
return status == "completed" || status == "cancelled" || status == "closed"
|
||||
return status == orderStatusCompleted || status == orderStatusCancelled || status == orderStatusClosed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user