go_dreamfactory/modules/hunting/api_getlist.go
2023-11-21 16:07:51 +08:00

34 lines
804 B
Go

package hunting
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
//参数校验
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.HuntingGetListReq) (errdata *pb.ErrorData) {
return
}
func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListReq) (errdata *pb.ErrorData) {
var (
list *pb.DBHunting
err error
)
if errdata = this.GetListCheck(session, req); errdata != nil {
return // 参数校验失败直接返回
}
if list, err = this.module.modelHunting.getHuntingList(session.GetUserId()); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
}
return
}
session.SendMsg(string(this.module.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list})
return
}