go_dreamfactory/modules/troll/api_getlist.go
2022-10-28 11:55:16 +08:00

36 lines
844 B
Go

package troll
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"time"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.TrollGetListReq) (code pb.ErrorCode) {
return
}
///获取美食城基本信息
func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq) (code pb.ErrorCode, data proto.Message) {
code = this.GetListCheck(session, req)
if code != pb.ErrorCode_Success {
return // 参数校验失败直接返回
}
_gourmet, err := this.module.modelTroll.getTrollList(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
if _gourmet.Ctime == 0 {
_gourmet.Ctime = time.Now().Unix()
}
session.SendMsg(string(this.module.GetType()), TrollGetListResp, &pb.TrollGetListResp{Data: _gourmet})
return
}