background/const/const.go

22 lines
274 B
Go
Raw Permalink Normal View History

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