package consts var HeadTypeMap = map[string]string{ "1": "企业", "2": "个人", } func GetHeadType(HeadType string) string { toast, contain := HeadTypeMap[HeadType] if contain { return toast } return "未知" } var InvoiceTypeMap = map[string]string{ "1": "增值税专用发票", "2": "增值税普通发票", } func GetInvoiceType(InvoiceType string) string { toast, contain := InvoiceTypeMap[InvoiceType] if contain { return toast } return "未知" }