go_dreamfactory/modules/caravan/api_buyorsell.go
2023-04-28 21:20:04 +08:00

27 lines
752 B
Go

package caravan
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
//参数校验
func (this *apiComp) BuyOrSellCheck(session comm.IUserSession, req *pb.CaravanBuyOrSellReq) (code pb.ErrorCode) {
if len(req.Items) == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSellReq) (code pb.ErrorCode, data *pb.ErrorData) {
//update := make(map[string]interface{})
if code = this.BuyOrSellCheck(session, req); code != pb.ErrorCode_Success {
return // 参数校验失败直接返回
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype153, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
return
}