package model

// 实名认证模型
type RealName struct {
	Model
	Name        string  `gorm:"not null"`
	IdNum       string  `gorm:"type:varchar(18) not null"`
	TelNum      string  `gorm:"type:varchar(11) not null"`
	IdCardFront string  `gorm:"column:idcard_front;comment:身份证正面"`
	IdCardBack  string  `gorm:"column:idcard_back;comment:身份证反面"`
	Age         int     `gorm:"column:age"`
	Sex         SexType `gorm:"column:sex"`
	Birthday    string  `gorm:"column:birthday"`
	Address     string  `gorm:"column:address"`
}

func (r RealName) TableName() string {
	return "real_name"
}

type SexType string

func (s SexType) ConvertInt32() int32 {
	switch s {
	case "男":
		return 1
	case "女":
		return 2
	default: //其它
		return 3
	}

}
