refactor: 统一状态名称映射为公共函数,清理废弃换卡/商户类型常量和模型

This commit is contained in:
2026-04-14 11:51:58 +08:00
parent 5410181e77
commit 7cdb66cbe4
9 changed files with 11 additions and 240 deletions

View File

@@ -131,7 +131,7 @@ func (s *Service) Create(ctx context.Context, req *dto.CreateEnterpriseReq) (*dt
District: enterprise.District,
Address: enterprise.Address,
Status: enterprise.Status,
StatusName: getStatusName(enterprise.Status),
StatusName: constants.GetStatusName(enterprise.Status),
CreatedAt: enterprise.CreatedAt.Format("2006-01-02 15:04:05"),
},
AccountID: account.ID,
@@ -345,7 +345,7 @@ func (s *Service) List(ctx context.Context, req *dto.EnterpriseListReq) (*dto.En
District: e.District,
Address: e.Address,
Status: e.Status,
StatusName: getStatusName(e.Status),
StatusName: constants.GetStatusName(e.Status),
CreatedAt: e.CreatedAt.Format("2006-01-02 15:04:05"),
})
}
@@ -357,10 +357,3 @@ func (s *Service) List(ctx context.Context, req *dto.EnterpriseListReq) (*dto.En
Size: opts.PageSize,
}, nil
}
func getStatusName(status int) string {
if status == constants.StatusEnabled {
return "启用"
}
return "禁用"
}