go_dreamfactory/modules/gourmet/api_getlist.go
2023-03-27 15:47:17 +08:00

38 lines
1.1 KiB
Go

package gourmet
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"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
}
// 计算订单信息
this.module.modelGourmet.CalculationGourmet(session.GetUserId(), _gourmet)
session.SendMsg(string(this.module.GetType()), GourmetGetListResp, &pb.GourmetGetListResp{Data: _gourmet})
// 任务统计
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype136, _gourmet.TotalTime)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype136, _gourmet.TotalTime))
return
}