refactor: 统一状态名称映射为公共函数,清理废弃换卡/商户类型常量和模型
This commit is contained in:
@@ -328,7 +328,7 @@ func (s *Service) buildWithdrawalRequestItem(r *model.CommissionWithdrawalReques
|
||||
Fee: r.Fee,
|
||||
ActualAmount: r.ActualAmount,
|
||||
Status: r.Status,
|
||||
StatusName: getWithdrawalStatusName(r.Status),
|
||||
StatusName: constants.GetWithdrawalStatusName(r.Status),
|
||||
ShopID: r.ShopID,
|
||||
ShopName: shopName,
|
||||
ShopHierarchy: shopHierarchy,
|
||||
@@ -443,7 +443,7 @@ func (s *Service) ListShopCommissionRecords(ctx context.Context, shopID uint, re
|
||||
BalanceAfter: r.BalanceAfter,
|
||||
CommissionSource: r.CommissionSource,
|
||||
Status: r.Status,
|
||||
StatusName: getCommissionStatusName(r.Status),
|
||||
StatusName: constants.GetCommissionRecordStatusName(r.Status),
|
||||
OrderID: r.OrderID,
|
||||
OrderNo: r.OrderNo,
|
||||
VirtualNo: r.VirtualNo,
|
||||
@@ -672,7 +672,7 @@ func (s *Service) CreateWithdrawalRequest(ctx context.Context, shopID uint, req
|
||||
Fee: withdrawalRequest.Fee,
|
||||
ActualAmount: withdrawalRequest.ActualAmount,
|
||||
Status: withdrawalRequest.Status,
|
||||
StatusName: getWithdrawalStatusName(withdrawalRequest.Status),
|
||||
StatusName: constants.GetWithdrawalStatusName(withdrawalRequest.Status),
|
||||
CreatedAt: withdrawalRequest.CreatedAt.Format("2006-01-02 15:04:05"),
|
||||
}, nil
|
||||
}
|
||||
@@ -823,38 +823,6 @@ func (s *Service) ResolveCommissionRecord(ctx context.Context, recordID uint, re
|
||||
})
|
||||
}
|
||||
|
||||
// getWithdrawalStatusName 获取提现状态名称
|
||||
func getWithdrawalStatusName(status int) string {
|
||||
switch status {
|
||||
case constants.WithdrawalStatusPending:
|
||||
return "待审核"
|
||||
case constants.WithdrawalStatusApproved:
|
||||
return "已通过"
|
||||
case constants.WithdrawalStatusRejected:
|
||||
return "已拒绝"
|
||||
case constants.WithdrawalStatusPaid:
|
||||
return "已到账"
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
|
||||
// getCommissionStatusName 获取佣金状态名称
|
||||
func getCommissionStatusName(status int) string {
|
||||
switch status {
|
||||
case constants.CommissionStatusFrozen:
|
||||
return "已冻结"
|
||||
case constants.CommissionStatusUnfreezing:
|
||||
return "解冻中"
|
||||
case constants.CommissionStatusReleased:
|
||||
return "已发放"
|
||||
case constants.CommissionStatusInvalid:
|
||||
return "已失效"
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
|
||||
// generateWithdrawalNo 生成提现单号
|
||||
func generateWithdrawalNo() string {
|
||||
now := time.Now()
|
||||
|
||||
Reference in New Issue
Block a user