background/const/const.go

22 lines
274 B
Go
Raw Normal View History

2019-01-28 11:19:49 +08:00
package _const
2019-03-07 10:36:09 +08:00
var RespCode map[int]string
2019-01-28 11:19:49 +08:00
const (
RESP_ERR_COMON = 101
2019-03-07 10:36:09 +08:00
RESP_ERR_OK = 0
2019-01-28 11:19:49 +08:00
)
2019-03-07 10:36:09 +08:00
func init() {
2019-01-28 11:19:49 +08:00
RespCode[RESP_ERR_OK] = "OK"
RespCode[RESP_ERR_COMON] = "Err"
}
2019-03-07 10:36:09 +08:00
func M(key int) string {
v, ok := RespCode[key]
if ok {
2019-01-28 11:19:49 +08:00
return v
2019-03-07 10:36:09 +08:00
} else {
2019-01-28 11:19:49 +08:00
return ""
}
2019-03-07 10:36:09 +08:00
}