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 "未知" }