go_dreamfactory/modules/caravan/api_refreshcity.go

32 lines
904 B
Go

package caravan
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
//参数校验
func (this *apiComp) RefreshCityCheck(session comm.IUserSession, req *pb.CaravanRefreshCityReq) (code pb.ErrorCode) {
return
}
// 刷新城市信息
func (this *apiComp) RefreshCity(session comm.IUserSession, req *pb.CaravanRefreshCityReq) (code pb.ErrorCode, data *pb.ErrorData) {
var (
resp *pb.CaravanRefreshCityResp
)
resp = &pb.CaravanRefreshCityResp{}
if code = this.RefreshCityCheck(session, req); code != pb.ErrorCode_Success {
return // 参数校验失败直接返回
}
list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId())
resp.Oldprice = list.Oldprice
// 刷新城市货物信息
this.module.refreshCaravanCityInfo(session.GetUserId(), list)
resp.Goods = list.Goods
resp.City = list.City
session.SendMsg(string(this.module.GetType()), "refreshcity", resp)
return
}