- 在 errcode/encounter.go 中新增 ErrEncounterNoData 错误码 - 在 EnocunterMsgInit 和 EncounterMsgUserInit 函数中添加相应的错误消息 - 修改 encounter_controller.go 中的 List 方法,使用新增的错误码处理没有查询到数据的情况
17 lines
472 B
Go
17 lines
472 B
Go
package errcode
|
|
|
|
const (
|
|
ErrEaLinkInstert = ErrEncounter + iota
|
|
ErrEncounterNoData
|
|
)
|
|
|
|
func EnocunterMsgInit(m msg) {
|
|
m[ErrEaLinkInstert] = "路遇添加成功,但关联毛茸茸失败"
|
|
m[ErrEncounterNoData] = "没有查询到数据"
|
|
}
|
|
|
|
func EncounterMsgUserInit(m msg) {
|
|
m[ErrEaLinkInstert] = "路遇上传成功啦。但是不小心让毛茸茸跑丢了。/(ㄒoㄒ)/~~"
|
|
m[ErrEncounterNoData] = "没有查询到你喜欢的猫猫路遇,为他们添加吧。"
|
|
}
|