go_dreamfactory/modules/gourmet/api_getlist.go

41 lines
1.0 KiB
Go

package gourmet
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"time"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.GourmetGetListReq) (code pb.ErrorCode) {
return
}
///获取美食城基本信息
func (this *apiComp) GetList(session comm.IUserSession, req *pb.GourmetGetListReq) (code pb.ErrorCode, data proto.Message) {
code = this.GetListCheck(session, req)
if code != pb.ErrorCode_Success {
return // 参数校验失败直接返回
}
_gourmet, err := this.module.modelGourmet.getGourmetList(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
if _gourmet.Ctime == 0 {
_gourmet.Ctime = time.Now().Unix()
}
// 计算订单信息
this.module.modelGourmet.CalculationGourmet(session.GetUserId(), _gourmet)
session.SendMsg(string(this.module.GetType()), GourmetGetListResp, &pb.GourmetGetListResp{Data: _gourmet})
// this.GetRandUser(session, &pb.GourmetGetRandUserReq{
// People: 10,
// })
return
}