|
@@ -166,15 +166,15 @@ function query(human, shopType)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- Grid.makeItem(msgRet.refreshItem,shopTypeConfig.refreshItemID,shopTypeConfig.refreshItemCnt)
|
|
|
|
|
|
|
+ Grid.makeItem(msgRet.refreshItem, shopTypeConfig.refreshItemID, shopTypeConfig.refreshItemCnt)
|
|
|
|
|
|
|
|
local shopConfig = ShopExcel[shopType]
|
|
local shopConfig = ShopExcel[shopType]
|
|
|
if not shopConfig then return end
|
|
if not shopConfig then return end
|
|
|
|
|
|
|
|
local now = os.time()
|
|
local now = os.time()
|
|
|
|
|
|
|
|
- initHumanShopDB(human,shopType)
|
|
|
|
|
- checkFreeCnt(human,shopType)
|
|
|
|
|
|
|
+ initHumanShopDB(human, shopType)
|
|
|
|
|
+ checkFreeCnt(human, shopType)
|
|
|
|
|
|
|
|
msgRet.nextRefreshTime = 0
|
|
msgRet.nextRefreshTime = 0
|
|
|
|
|
|
|
@@ -192,48 +192,92 @@ function query(human, shopType)
|
|
|
msgRet.costCnt = getLeftCostCnt(human, shopType)
|
|
msgRet.costCnt = getLeftCostCnt(human, shopType)
|
|
|
msgRet.costMax = getCostCntMax(human, shopType)
|
|
msgRet.costMax = getCostCntMax(human, shopType)
|
|
|
|
|
|
|
|
|
|
+ -- 先把所有商品数据收集到临时表
|
|
|
|
|
+ local allGoods = {}
|
|
|
|
|
+
|
|
|
-- 不刷新的没有记录的 走配置
|
|
-- 不刷新的没有记录的 走配置
|
|
|
- local cnt = 0
|
|
|
|
|
if shopTypeConfig.refreshType == ShopDefine.SHOP_REFRESH_TYPE0 then
|
|
if shopTypeConfig.refreshType == ShopDefine.SHOP_REFRESH_TYPE0 then
|
|
|
- for index, v in pairs(shopConfig) do
|
|
|
|
|
- if not human.db.shop[shopType].goods[index] then
|
|
|
|
|
- local tempConfig = v
|
|
|
|
|
- cnt = cnt + 1
|
|
|
|
|
- Grid.makeItem(msgRet.list[cnt].itemData, tempConfig.itemID, tempConfig.cnt)
|
|
|
|
|
- msgRet.list[cnt].itemIndex = index
|
|
|
|
|
- Grid.makeItem(msgRet.list[cnt].needItem, tempConfig.needItemID, tempConfig.price)
|
|
|
|
|
- msgRet.list[cnt].maxCanBuy = tempConfig.limitBuyCnt
|
|
|
|
|
- msgRet.list[cnt].nowBuy = 0
|
|
|
|
|
- msgRet.list[cnt].zhekou = tempConfig.zhekou
|
|
|
|
|
- msgRet.list[cnt].order = tempConfig.order
|
|
|
|
|
- msgRet.list[cnt].needVipLv = tempConfig.needVipLv
|
|
|
|
|
- msgRet.list[cnt].rare = tempConfig.rare
|
|
|
|
|
- msgRet.list[cnt].limitType = tempConfig.limitType
|
|
|
|
|
- msgRet.list[cnt].bCanChose = tempConfig.isquickbuy and tempConfig.isquickbuy or 0
|
|
|
|
|
- msgRet.list[cnt].bChose = 0
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
|
|
+ for index, v in pairs(shopConfig) do
|
|
|
|
|
+ if not human.db.shop[shopType].goods[index] then
|
|
|
|
|
+ local tempConfig = v
|
|
|
|
|
+ allGoods[#allGoods + 1] = {
|
|
|
|
|
+ itemID = tempConfig.itemID,
|
|
|
|
|
+ itemCnt = tempConfig.cnt,
|
|
|
|
|
+ itemIndex = index,
|
|
|
|
|
+ needItemID = tempConfig.needItemID,
|
|
|
|
|
+ needItemCnt = tempConfig.price,
|
|
|
|
|
+ maxCanBuy = tempConfig.limitBuyCnt,
|
|
|
|
|
+ nowBuy = 0,
|
|
|
|
|
+ zhekou = tempConfig.zhekou,
|
|
|
|
|
+ order = tempConfig.order,
|
|
|
|
|
+ needVipLv = tempConfig.needVipLv,
|
|
|
|
|
+ rare = tempConfig.rare,
|
|
|
|
|
+ limitType = tempConfig.limitType,
|
|
|
|
|
+ bCanChose = tempConfig.isquickbuy and tempConfig.isquickbuy or 0,
|
|
|
|
|
+ bChose = 0,
|
|
|
|
|
+ }
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
for _, v in pairs(human.db.shop[shopType].goods) do
|
|
for _, v in pairs(human.db.shop[shopType].goods) do
|
|
|
local tempConfig = shopConfig[v.index]
|
|
local tempConfig = shopConfig[v.index]
|
|
|
- cnt = cnt + 1
|
|
|
|
|
- Grid.makeItem(msgRet.list[cnt].itemData, tempConfig.itemID, tempConfig.cnt)
|
|
|
|
|
- msgRet.list[cnt].itemIndex = v.index
|
|
|
|
|
- Grid.makeItem(msgRet.list[cnt].needItem, tempConfig.needItemID, tempConfig.price)
|
|
|
|
|
- msgRet.list[cnt].maxCanBuy = tempConfig.limitBuyCnt
|
|
|
|
|
- msgRet.list[cnt].nowBuy = v.nowBuy
|
|
|
|
|
- msgRet.list[cnt].zhekou = tempConfig.zhekou
|
|
|
|
|
- msgRet.list[cnt].order = tempConfig.order
|
|
|
|
|
- msgRet.list[cnt].needVipLv = tempConfig.needVipLv
|
|
|
|
|
- msgRet.list[cnt].rare = tempConfig.rare
|
|
|
|
|
- msgRet.list[cnt].limitType = tempConfig.limitType
|
|
|
|
|
- msgRet.list[cnt].bCanChose = tempConfig.isquickbuy and tempConfig.isquickbuy or 0
|
|
|
|
|
- msgRet.list[cnt].bChose = ShopLogic_GetChose(human, shopType, v.index)
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- msgRet.list[0] = cnt
|
|
|
|
|
- Msg.send(msgRet, human.fd)
|
|
|
|
|
|
|
+ allGoods[#allGoods + 1] = {
|
|
|
|
|
+ itemID = tempConfig.itemID,
|
|
|
|
|
+ itemCnt = tempConfig.cnt,
|
|
|
|
|
+ itemIndex = v.index,
|
|
|
|
|
+ needItemID = tempConfig.needItemID,
|
|
|
|
|
+ needItemCnt = tempConfig.price,
|
|
|
|
|
+ maxCanBuy = tempConfig.limitBuyCnt,
|
|
|
|
|
+ nowBuy = v.nowBuy,
|
|
|
|
|
+ zhekou = tempConfig.zhekou,
|
|
|
|
|
+ order = tempConfig.order,
|
|
|
|
|
+ needVipLv = tempConfig.needVipLv,
|
|
|
|
|
+ rare = tempConfig.rare,
|
|
|
|
|
+ limitType = tempConfig.limitType,
|
|
|
|
|
+ bCanChose = tempConfig.isquickbuy and tempConfig.isquickbuy or 0,
|
|
|
|
|
+ bChose = ShopLogic_GetChose(human, shopType, v.index),
|
|
|
|
|
+ }
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
|
|
+ -- 分批发送,每批最多 15 条
|
|
|
|
|
+ local BATCH_SIZE = 15
|
|
|
|
|
+ local total = #allGoods
|
|
|
|
|
+ local totalBatches = math.max(math.ceil(total / BATCH_SIZE), 1)
|
|
|
|
|
+
|
|
|
|
|
+ for batchIdx = 1, totalBatches do
|
|
|
|
|
+ local startIdx = (batchIdx - 1) * BATCH_SIZE + 1
|
|
|
|
|
+ local endIdx = math.min(batchIdx * BATCH_SIZE, total)
|
|
|
|
|
+
|
|
|
|
|
+ msgRet.isStart = (batchIdx == 1) and 1 or 0
|
|
|
|
|
+ msgRet.isEnd = (batchIdx == totalBatches) and 1 or 0
|
|
|
|
|
+
|
|
|
|
|
+ -- 非第一批不重复发送商店列表等头部信息
|
|
|
|
|
+ if batchIdx > 1 then
|
|
|
|
|
+ msgRet.shopList[0] = 0
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
|
|
+ local cnt = 0
|
|
|
|
|
+ for i = startIdx, endIdx do
|
|
|
|
|
+ cnt = cnt + 1
|
|
|
|
|
+ local item = allGoods[i]
|
|
|
|
|
+ Grid.makeItem(msgRet.list[cnt].itemData, item.itemID, item.itemCnt)
|
|
|
|
|
+ msgRet.list[cnt].itemIndex = item.itemIndex
|
|
|
|
|
+ Grid.makeItem(msgRet.list[cnt].needItem, item.needItemID, item.needItemCnt)
|
|
|
|
|
+ msgRet.list[cnt].maxCanBuy = item.maxCanBuy
|
|
|
|
|
+ msgRet.list[cnt].nowBuy = item.nowBuy
|
|
|
|
|
+ msgRet.list[cnt].zhekou = item.zhekou
|
|
|
|
|
+ msgRet.list[cnt].order = item.order
|
|
|
|
|
+ msgRet.list[cnt].needVipLv = item.needVipLv
|
|
|
|
|
+ msgRet.list[cnt].rare = item.rare
|
|
|
|
|
+ msgRet.list[cnt].limitType = item.limitType
|
|
|
|
|
+ msgRet.list[cnt].bCanChose = item.bCanChose
|
|
|
|
|
+ msgRet.list[cnt].bChose = item.bChose
|
|
|
|
|
+ end
|
|
|
|
|
+ msgRet.list[0] = cnt
|
|
|
|
|
+
|
|
|
|
|
+ Msg.send(msgRet, human.fd)
|
|
|
|
|
+ end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
-- 刷新物品
|
|
-- 刷新物品
|