36 lines
986 B
Go
36 lines
986 B
Go
package caravan
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/sys/mgo"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.CaravanGetListReq) (code pb.ErrorCode) {
|
|
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) GetList(session comm.IUserSession, req *pb.CaravanGetListReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
|
var (
|
|
resp *pb.CaravanGetListResp
|
|
)
|
|
resp = &pb.CaravanGetListResp{}
|
|
if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success {
|
|
return // 参数校验失败直接返回
|
|
}
|
|
list, err := this.module.modelCaravan.getCaravanList(session.GetUserId())
|
|
|
|
if mgo.MongodbNil == err { // 初始化门票和虚拟币
|
|
if code = this.module.InitCaravanTicket(session, 1); code != pb.ErrorCode_Success {
|
|
return
|
|
}
|
|
}
|
|
// 刷新城市货物信息
|
|
this.module.refreshCaravanCityInfo(session.GetUserId(), list)
|
|
resp.Data = list
|
|
session.SendMsg(string(this.module.GetType()), "getlist", resp)
|
|
return
|
|
}
|