上传商店列表刷新问题
This commit is contained in:
parent
f1fad4f96e
commit
be53d80523
@ -150,40 +150,39 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq)
|
||||
if tdata > ltime { //达到刷新时间 可以刷新商品列表
|
||||
isrefresh = true
|
||||
}
|
||||
if isrefresh {
|
||||
var _items []*cfg.GameShopitemData
|
||||
for _, v := range shopconf.Shopitem {
|
||||
if _items, err = this.module.configure.GetShopItemsConfigureByGroups(v, udata); err != nil || len(_items) == 0 {
|
||||
this.module.Error("no founf shopgroup", log.Field{Key: "gid", Value: v})
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
items = append(items, randomGoods(_items))
|
||||
}
|
||||
sdata.Buy = make(map[int32]int32)
|
||||
sdata.LastRefreshTime = configure.Now().Unix()
|
||||
sdata.Items = make([]int32, len(items))
|
||||
sdata.Preview = make(map[int32]*pb.DB_Equipment)
|
||||
for i, v := range items {
|
||||
sdata.Items[i] = v.Key
|
||||
if v.Preview { //是否预览
|
||||
if code, sdata.Preview[v.Key] = this.module.equip.NewEquipment(session.GetUserId(), v.Iteminfo[0].T); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
goods = transGoods(items, sdata)
|
||||
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{"refreshnumgoldShop": shopData.RefreshnumgoldShop, "refreshtimegoldShop": shopData.RefreshtimegoldShop, filed: sdata})
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1)
|
||||
} else { //返回以前的商品列表
|
||||
if items, err = this.module.configure.GetShopItemsConfigureByIds(sdata.Items...); err != nil {
|
||||
}
|
||||
if isrefresh {
|
||||
var _items []*cfg.GameShopitemData
|
||||
for _, v := range shopconf.Shopitem {
|
||||
if _items, err = this.module.configure.GetShopItemsConfigureByGroups(v, udata); err != nil || len(_items) == 0 {
|
||||
this.module.Error("no founf shopgroup", log.Field{Key: "gid", Value: v})
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
goods = transGoods(items, sdata)
|
||||
items = append(items, randomGoods(_items))
|
||||
}
|
||||
sdata.Buy = make(map[int32]int32)
|
||||
sdata.LastRefreshTime = configure.Now().Unix()
|
||||
sdata.Items = make([]int32, len(items))
|
||||
sdata.Preview = make(map[int32]*pb.DB_Equipment)
|
||||
for i, v := range items {
|
||||
sdata.Items[i] = v.Key
|
||||
if v.Preview { //是否预览
|
||||
if code, sdata.Preview[v.Key] = this.module.equip.NewEquipment(session.GetUserId(), v.Iteminfo[0].T); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
goods = transGoods(items, sdata)
|
||||
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{"refreshnumgoldShop": shopData.RefreshnumgoldShop, "refreshtimegoldShop": shopData.RefreshtimegoldShop, filed: sdata})
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1)
|
||||
} else { //返回以前的商品列表
|
||||
if items, err = this.module.configure.GetShopItemsConfigureByIds(sdata.Items...); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
goods = transGoods(items, sdata)
|
||||
}
|
||||
|
||||
} else {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user