temp
This commit is contained in:
@@ -5,29 +5,19 @@ type CertificationStatus string
|
||||
|
||||
const (
|
||||
// 主流程状态
|
||||
StatusNotStarted CertificationStatus = "not_started" // 未开始认证
|
||||
StatusPending CertificationStatus = "pending" // 待开始
|
||||
StatusInfoSubmitted CertificationStatus = "info_submitted" // 企业信息已提交
|
||||
StatusFaceVerified CertificationStatus = "face_verified" // 人脸识别完成
|
||||
StatusContractApplied CertificationStatus = "contract_applied" // 已申请合同
|
||||
StatusContractPending CertificationStatus = "contract_pending" // 合同待审核
|
||||
StatusContractApproved CertificationStatus = "contract_approved" // 合同已审核(有链接)
|
||||
StatusContractSigned CertificationStatus = "contract_signed" // 合同已签署
|
||||
StatusPending CertificationStatus = "pending" // 待认证
|
||||
StatusInfoSubmitted CertificationStatus = "info_submitted" // 已提交企业信息
|
||||
StatusEnterpriseVerified CertificationStatus = "enterprise_verified" // 已企业认证
|
||||
StatusContractApplied CertificationStatus = "contract_applied" // 已申请签署合同
|
||||
StatusContractSigned CertificationStatus = "contract_signed" // 已签署合同
|
||||
StatusCompleted CertificationStatus = "completed" // 认证完成
|
||||
|
||||
// 失败和重试状态
|
||||
StatusFaceFailed CertificationStatus = "face_failed" // 人脸识别失败
|
||||
StatusSignFailed CertificationStatus = "sign_failed" // 签署失败
|
||||
StatusRejected CertificationStatus = "rejected" // 已拒绝
|
||||
)
|
||||
|
||||
// IsValidStatus 检查状态是否有效
|
||||
func IsValidStatus(status CertificationStatus) bool {
|
||||
validStatuses := []CertificationStatus{
|
||||
StatusNotStarted, StatusPending, StatusInfoSubmitted, StatusFaceVerified,
|
||||
StatusContractApplied, StatusContractPending, StatusContractApproved,
|
||||
StatusContractSigned, StatusCompleted, StatusFaceFailed,
|
||||
StatusSignFailed, StatusRejected,
|
||||
StatusPending, StatusInfoSubmitted, StatusEnterpriseVerified,
|
||||
StatusContractApplied, StatusContractSigned, StatusCompleted,
|
||||
}
|
||||
|
||||
for _, validStatus := range validStatuses {
|
||||
@@ -41,18 +31,12 @@ func IsValidStatus(status CertificationStatus) bool {
|
||||
// GetStatusName 获取状态的中文名称
|
||||
func GetStatusName(status CertificationStatus) string {
|
||||
statusNames := map[CertificationStatus]string{
|
||||
StatusNotStarted: "未开始认证",
|
||||
StatusPending: "待开始",
|
||||
StatusInfoSubmitted: "企业信息已提交",
|
||||
StatusFaceVerified: "人脸识别完成",
|
||||
StatusContractApplied: "已申请合同",
|
||||
StatusContractPending: "合同待审核",
|
||||
StatusContractApproved: "合同已审核",
|
||||
StatusContractSigned: "合同已签署",
|
||||
StatusCompleted: "认证完成",
|
||||
StatusFaceFailed: "人脸识别失败",
|
||||
StatusSignFailed: "签署失败",
|
||||
StatusRejected: "已拒绝",
|
||||
StatusPending: "待认证",
|
||||
StatusInfoSubmitted: "已提交企业信息",
|
||||
StatusEnterpriseVerified: "已企业认证",
|
||||
StatusContractApplied: "已申请合同",
|
||||
StatusContractSigned: "已签署合同",
|
||||
StatusCompleted: "认证完成",
|
||||
}
|
||||
|
||||
if name, exists := statusNames[status]; exists {
|
||||
@@ -63,28 +47,36 @@ func GetStatusName(status CertificationStatus) string {
|
||||
|
||||
// IsFinalStatus 判断是否为最终状态
|
||||
func IsFinalStatus(status CertificationStatus) bool {
|
||||
finalStatuses := []CertificationStatus{
|
||||
StatusCompleted, StatusRejected,
|
||||
}
|
||||
|
||||
for _, finalStatus := range finalStatuses {
|
||||
if status == finalStatus {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return status == StatusCompleted
|
||||
}
|
||||
|
||||
// IsFailedStatus 判断是否为失败状态
|
||||
func IsFailedStatus(status CertificationStatus) bool {
|
||||
failedStatuses := []CertificationStatus{
|
||||
StatusFaceFailed, StatusSignFailed, StatusRejected,
|
||||
// GetStatusCategory 获取状态分类
|
||||
func GetStatusCategory(status CertificationStatus) string {
|
||||
switch status {
|
||||
case StatusPending:
|
||||
return "initial"
|
||||
case StatusInfoSubmitted, StatusEnterpriseVerified, StatusContractApplied, StatusContractSigned:
|
||||
return "processing"
|
||||
case StatusCompleted:
|
||||
return "completed"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
// GetStatusPriority 获取状态优先级(用于排序)
|
||||
func GetStatusPriority(status CertificationStatus) int {
|
||||
priorities := map[CertificationStatus]int{
|
||||
StatusPending: 0,
|
||||
StatusInfoSubmitted: 1,
|
||||
StatusEnterpriseVerified: 2,
|
||||
StatusContractApplied: 3,
|
||||
StatusContractSigned: 4,
|
||||
StatusCompleted: 5,
|
||||
}
|
||||
|
||||
for _, failedStatus := range failedStatuses {
|
||||
if status == failedStatus {
|
||||
return true
|
||||
}
|
||||
if priority, exists := priorities[status]; exists {
|
||||
return priority
|
||||
}
|
||||
return false
|
||||
return 999
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user