基础架构
This commit is contained in:
110
internal/domains/certification/.dto/certification_dto.go
Normal file
110
internal/domains/certification/.dto/certification_dto.go
Normal file
@@ -0,0 +1,110 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"tyapi-server/internal/domains/certification/enums"
|
||||
)
|
||||
|
||||
// CertificationCreateRequest 创建认证申请请求
|
||||
type CertificationCreateRequest struct {
|
||||
UserID string `json:"user_id" binding:"required"`
|
||||
}
|
||||
|
||||
// CertificationCreateResponse 创建认证申请响应
|
||||
type CertificationCreateResponse struct {
|
||||
ID string `json:"id"`
|
||||
UserID string `json:"user_id"`
|
||||
Status enums.CertificationStatus `json:"status"`
|
||||
}
|
||||
|
||||
// CertificationStatusResponse 认证状态响应
|
||||
type CertificationStatusResponse struct {
|
||||
ID string `json:"id"`
|
||||
UserID string `json:"user_id"`
|
||||
Status enums.CertificationStatus `json:"status"`
|
||||
StatusName string `json:"status_name"`
|
||||
Progress int `json:"progress"`
|
||||
IsUserActionRequired bool `json:"is_user_action_required"`
|
||||
IsAdminActionRequired bool `json:"is_admin_action_required"`
|
||||
|
||||
// 时间节点
|
||||
InfoSubmittedAt *time.Time `json:"info_submitted_at,omitempty"`
|
||||
FaceVerifiedAt *time.Time `json:"face_verified_at,omitempty"`
|
||||
ContractAppliedAt *time.Time `json:"contract_applied_at,omitempty"`
|
||||
ContractApprovedAt *time.Time `json:"contract_approved_at,omitempty"`
|
||||
ContractSignedAt *time.Time `json:"contract_signed_at,omitempty"`
|
||||
CompletedAt *time.Time `json:"completed_at,omitempty"`
|
||||
|
||||
// 关联信息
|
||||
Enterprise *EnterpriseInfoResponse `json:"enterprise,omitempty"`
|
||||
ContractURL string `json:"contract_url,omitempty"`
|
||||
SigningURL string `json:"signing_url,omitempty"`
|
||||
RejectReason string `json:"reject_reason,omitempty"`
|
||||
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// SubmitEnterpriseInfoRequest 提交企业信息请求
|
||||
type SubmitEnterpriseInfoRequest struct {
|
||||
CompanyName string `json:"company_name" binding:"required"`
|
||||
UnifiedSocialCode string `json:"unified_social_code" binding:"required"`
|
||||
LegalPersonName string `json:"legal_person_name" binding:"required"`
|
||||
LegalPersonID string `json:"legal_person_id" binding:"required"`
|
||||
LicenseUploadRecordID string `json:"license_upload_record_id" binding:"required"`
|
||||
}
|
||||
|
||||
// SubmitEnterpriseInfoResponse 提交企业信息响应
|
||||
type SubmitEnterpriseInfoResponse struct {
|
||||
ID string `json:"id"`
|
||||
Status enums.CertificationStatus `json:"status"`
|
||||
Enterprise *EnterpriseInfoResponse `json:"enterprise"`
|
||||
}
|
||||
|
||||
// FaceVerifyRequest 人脸识别请求
|
||||
type FaceVerifyRequest struct {
|
||||
RealName string `json:"real_name" binding:"required"`
|
||||
IDCardNumber string `json:"id_card_number" binding:"required"`
|
||||
ReturnURL string `json:"return_url" binding:"required"`
|
||||
}
|
||||
|
||||
// FaceVerifyResponse 人脸识别响应
|
||||
type FaceVerifyResponse struct {
|
||||
CertifyID string `json:"certify_id"`
|
||||
VerifyURL string `json:"verify_url"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
}
|
||||
|
||||
// ApplyContractRequest 申请合同请求(无需额外参数)
|
||||
type ApplyContractRequest struct{}
|
||||
|
||||
// ApplyContractResponse 申请合同响应
|
||||
type ApplyContractResponse struct {
|
||||
ID string `json:"id"`
|
||||
Status enums.CertificationStatus `json:"status"`
|
||||
ContractAppliedAt time.Time `json:"contract_applied_at"`
|
||||
}
|
||||
|
||||
// SignContractRequest 签署合同请求
|
||||
type SignContractRequest struct {
|
||||
SignatureData string `json:"signature_data,omitempty"`
|
||||
}
|
||||
|
||||
// SignContractResponse 签署合同响应
|
||||
type SignContractResponse struct {
|
||||
ID string `json:"id"`
|
||||
Status enums.CertificationStatus `json:"status"`
|
||||
ContractSignedAt time.Time `json:"contract_signed_at"`
|
||||
}
|
||||
|
||||
// CertificationDetailResponse 认证详情响应
|
||||
type CertificationDetailResponse struct {
|
||||
*CertificationStatusResponse
|
||||
|
||||
// 详细记录
|
||||
LicenseUploadRecord *LicenseUploadRecordResponse `json:"license_upload_record,omitempty"`
|
||||
FaceVerifyRecords []FaceVerifyRecordResponse `json:"face_verify_records,omitempty"`
|
||||
ContractRecords []ContractRecordResponse `json:"contract_records,omitempty"`
|
||||
NotificationRecords []NotificationRecordResponse `json:"notification_records,omitempty"`
|
||||
}
|
||||
108
internal/domains/certification/.dto/enterprise_dto.go
Normal file
108
internal/domains/certification/.dto/enterprise_dto.go
Normal file
@@ -0,0 +1,108 @@
|
||||
package dto
|
||||
|
||||
import "time"
|
||||
|
||||
// EnterpriseInfoResponse 企业信息响应
|
||||
type EnterpriseInfoResponse struct {
|
||||
ID string `json:"id"`
|
||||
CertificationID string `json:"certification_id"`
|
||||
CompanyName string `json:"company_name"`
|
||||
UnifiedSocialCode string `json:"unified_social_code"`
|
||||
LegalPersonName string `json:"legal_person_name"`
|
||||
LegalPersonID string `json:"legal_person_id"`
|
||||
LicenseUploadRecordID string `json:"license_upload_record_id"`
|
||||
OCRRawData string `json:"ocr_raw_data,omitempty"`
|
||||
OCRConfidence float64 `json:"ocr_confidence,omitempty"`
|
||||
IsOCRVerified bool `json:"is_ocr_verified"`
|
||||
IsFaceVerified bool `json:"is_face_verified"`
|
||||
VerificationData string `json:"verification_data,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// LicenseUploadRecordResponse 营业执照上传记录响应
|
||||
type LicenseUploadRecordResponse struct {
|
||||
ID string `json:"id"`
|
||||
CertificationID *string `json:"certification_id,omitempty"`
|
||||
UserID string `json:"user_id"`
|
||||
OriginalFileName string `json:"original_file_name"`
|
||||
FileSize int64 `json:"file_size"`
|
||||
FileType string `json:"file_type"`
|
||||
FileURL string `json:"file_url"`
|
||||
QiNiuKey string `json:"qiniu_key"`
|
||||
OCRProcessed bool `json:"ocr_processed"`
|
||||
OCRSuccess bool `json:"ocr_success"`
|
||||
OCRConfidence float64 `json:"ocr_confidence,omitempty"`
|
||||
OCRRawData string `json:"ocr_raw_data,omitempty"`
|
||||
OCRErrorMessage string `json:"ocr_error_message,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// FaceVerifyRecordResponse 人脸识别记录响应
|
||||
type FaceVerifyRecordResponse struct {
|
||||
ID string `json:"id"`
|
||||
CertificationID string `json:"certification_id"`
|
||||
UserID string `json:"user_id"`
|
||||
CertifyID string `json:"certify_id"`
|
||||
VerifyURL string `json:"verify_url,omitempty"`
|
||||
ReturnURL string `json:"return_url,omitempty"`
|
||||
RealName string `json:"real_name"`
|
||||
IDCardNumber string `json:"id_card_number"`
|
||||
Status string `json:"status"`
|
||||
StatusName string `json:"status_name"`
|
||||
ResultCode string `json:"result_code,omitempty"`
|
||||
ResultMessage string `json:"result_message,omitempty"`
|
||||
VerifyScore float64 `json:"verify_score,omitempty"`
|
||||
InitiatedAt time.Time `json:"initiated_at"`
|
||||
CompletedAt *time.Time `json:"completed_at,omitempty"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// ContractRecordResponse 合同记录响应
|
||||
type ContractRecordResponse struct {
|
||||
ID string `json:"id"`
|
||||
CertificationID string `json:"certification_id"`
|
||||
UserID string `json:"user_id"`
|
||||
AdminID *string `json:"admin_id,omitempty"`
|
||||
ContractType string `json:"contract_type"`
|
||||
ContractURL string `json:"contract_url,omitempty"`
|
||||
SigningURL string `json:"signing_url,omitempty"`
|
||||
SignatureData string `json:"signature_data,omitempty"`
|
||||
SignedAt *time.Time `json:"signed_at,omitempty"`
|
||||
ClientIP string `json:"client_ip,omitempty"`
|
||||
UserAgent string `json:"user_agent,omitempty"`
|
||||
Status string `json:"status"`
|
||||
StatusName string `json:"status_name"`
|
||||
ApprovalNotes string `json:"approval_notes,omitempty"`
|
||||
RejectReason string `json:"reject_reason,omitempty"`
|
||||
ExpiresAt *time.Time `json:"expires_at,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// NotificationRecordResponse 通知记录响应
|
||||
type NotificationRecordResponse struct {
|
||||
ID string `json:"id"`
|
||||
CertificationID *string `json:"certification_id,omitempty"`
|
||||
UserID *string `json:"user_id,omitempty"`
|
||||
NotificationType string `json:"notification_type"`
|
||||
NotificationTypeName string `json:"notification_type_name"`
|
||||
NotificationScene string `json:"notification_scene"`
|
||||
NotificationSceneName string `json:"notification_scene_name"`
|
||||
Recipient string `json:"recipient"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Content string `json:"content"`
|
||||
TemplateID string `json:"template_id,omitempty"`
|
||||
TemplateParams string `json:"template_params,omitempty"`
|
||||
Status string `json:"status"`
|
||||
StatusName string `json:"status_name"`
|
||||
ErrorMessage string `json:"error_message,omitempty"`
|
||||
SentAt *time.Time `json:"sent_at,omitempty"`
|
||||
RetryCount int `json:"retry_count"`
|
||||
MaxRetryCount int `json:"max_retry_count"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
77
internal/domains/certification/.dto/ocr_dto.go
Normal file
77
internal/domains/certification/.dto/ocr_dto.go
Normal file
@@ -0,0 +1,77 @@
|
||||
package dto
|
||||
|
||||
// BusinessLicenseResult 营业执照识别结果
|
||||
type BusinessLicenseResult struct {
|
||||
CompanyName string `json:"company_name"` // 公司名称
|
||||
LegalRepresentative string `json:"legal_representative"` // 法定代表人
|
||||
RegisteredCapital string `json:"registered_capital"` // 注册资本
|
||||
RegisteredAddress string `json:"registered_address"` // 注册地址
|
||||
RegistrationNumber string `json:"registration_number"` // 统一社会信用代码
|
||||
BusinessScope string `json:"business_scope"` // 经营范围
|
||||
RegistrationDate string `json:"registration_date"` // 成立日期
|
||||
ValidDate string `json:"valid_date"` // 营业期限
|
||||
Confidence float64 `json:"confidence"` // 识别置信度
|
||||
Words []string `json:"words"` // 识别的所有文字
|
||||
}
|
||||
|
||||
// IDCardResult 身份证识别结果
|
||||
type IDCardResult struct {
|
||||
Side string `json:"side"` // 身份证面(front/back)
|
||||
Name string `json:"name"` // 姓名(正面)
|
||||
Sex string `json:"sex"` // 性别(正面)
|
||||
Nation string `json:"nation"` // 民族(正面)
|
||||
BirthDate string `json:"birth_date"` // 出生日期(正面)
|
||||
Address string `json:"address"` // 住址(正面)
|
||||
IDNumber string `json:"id_number"` // 身份证号码(正面)
|
||||
IssuingAuthority string `json:"issuing_authority"` // 签发机关(背面)
|
||||
ValidDate string `json:"valid_date"` // 有效期限(背面)
|
||||
Confidence float64 `json:"confidence"` // 识别置信度
|
||||
Words []string `json:"words"` // 识别的所有文字
|
||||
}
|
||||
|
||||
// GeneralTextResult 通用文字识别结果
|
||||
type GeneralTextResult struct {
|
||||
Words []string `json:"words"` // 识别的文字列表
|
||||
Confidence float64 `json:"confidence"` // 识别置信度
|
||||
}
|
||||
|
||||
// OCREnterpriseInfo OCR识别的企业信息
|
||||
type OCREnterpriseInfo struct {
|
||||
CompanyName string `json:"company_name"` // 企业名称
|
||||
UnifiedSocialCode string `json:"unified_social_code"` // 统一社会信用代码
|
||||
LegalPersonName string `json:"legal_person_name"` // 法人姓名
|
||||
LegalPersonID string `json:"legal_person_id"` // 法人身份证号
|
||||
Confidence float64 `json:"confidence"` // 识别置信度
|
||||
}
|
||||
|
||||
// LicenseProcessResult 营业执照处理结果
|
||||
type LicenseProcessResult struct {
|
||||
LicenseURL string `json:"license_url"` // 营业执照文件URL
|
||||
EnterpriseInfo *OCREnterpriseInfo `json:"enterprise_info"` // OCR识别的企业信息
|
||||
OCRSuccess bool `json:"ocr_success"` // OCR是否成功
|
||||
OCRError string `json:"ocr_error,omitempty"` // OCR错误信息
|
||||
}
|
||||
|
||||
// UploadLicenseRequest 上传营业执照请求
|
||||
type UploadLicenseRequest struct {
|
||||
// 文件通过multipart/form-data上传,这里定义验证规则
|
||||
}
|
||||
|
||||
// UploadLicenseResponse 上传营业执照响应
|
||||
type UploadLicenseResponse struct {
|
||||
UploadRecordID string `json:"upload_record_id"` // 上传记录ID
|
||||
FileURL string `json:"file_url"` // 文件URL
|
||||
OCRProcessed bool `json:"ocr_processed"` // OCR是否已处理
|
||||
OCRSuccess bool `json:"ocr_success"` // OCR是否成功
|
||||
EnterpriseInfo *OCREnterpriseInfo `json:"enterprise_info"` // OCR识别的企业信息(如果成功)
|
||||
OCRErrorMessage string `json:"ocr_error_message,omitempty"` // OCR错误信息(如果失败)
|
||||
}
|
||||
|
||||
// UploadResult 上传结果
|
||||
type UploadResult struct {
|
||||
Key string `json:"key"` // 文件key
|
||||
URL string `json:"url"` // 文件访问URL
|
||||
MimeType string `json:"mime_type"` // MIME类型
|
||||
Size int64 `json:"size"` // 文件大小
|
||||
Hash string `json:"hash"` // 文件哈希值
|
||||
}
|
||||
Reference in New Issue
Block a user