msg.go 189 B

123456789101112131415
  1. package e
  2. var MsgFlags = map[int]string{
  3. SUCCESS: "ok",
  4. ERROR: "fail",
  5. }
  6. func GetMsg(code int) string {
  7. msg, ok := MsgFlags[code]
  8. if ok {
  9. return msg
  10. }
  11. return MsgFlags[ERROR]
  12. }