Commit 54bd82e3e1b33c0c505e866697b4f58ff1b3e6ac

Authored by zhangqijia
1 parent 850c54f5

fix: 修复 查询抽奖ssr记录的gm指令的bug

src/actions/GmAction.lua
... ... @@ -1101,7 +1101,8 @@ function _M.do_lua(role, pms)
1101 1101 return "成功"
1102 1102 end
1103 1103  
1104   -function _M.getDrawHeroPro(role, pms)
  1104 +table.insert(helpDes, {"抽英雄", "get_draw_hero_pro"})
  1105 +function _M.get_draw_hero_pro(role, pms)
1105 1106 -- 普池 10 up池 207 心愿单 20
1106 1107 local poolDict = {
1107 1108 [10] = "普通卡池",
... ... @@ -1109,18 +1110,18 @@ function _M.getDrawHeroPro(role, pms)
1109 1110 [20] = "心愿单",
1110 1111 }
1111 1112 local result = {}
1112   - for k,v in poolDict do
1113   - local unit = csvdb["build_unit"][k]
  1113 + for k,v in pairs(poolDict) do
  1114 + local unit = csvdb["build_unitCsv"][k]
1114 1115 if unit then
1115   - local w1 = unit["rare1"] or 0
1116   - local w2 = unit["rare2"] or 0
1117   - local w3 = unit["rare3"] or 0
  1116 + local w1 = unit["rare_1"] or 0
  1117 + local w2 = unit["rare_2"] or 0
  1118 + local w3 = unit["rare_3"] or 0
1118 1119 local up = unit["up_ssr_weight"] or 0
1119 1120 local total = w1 + w2 + w3
1120 1121 if total > 0 then
1121   - local p1 = w1 / total
1122   - local p2 = w2 / total
1123   - local p3 = w3 / total
  1122 + local p1 = string.format("%.2f", w1 / total)
  1123 + local p2 = string.format("%.2f",w2 / total)
  1124 + local p3 = string.format("%.2f",w3 / total)
1124 1125 local tmp = {}
1125 1126 tmp["p1"] = p1
1126 1127 tmp["p2"] = p2
... ... @@ -1130,10 +1131,12 @@ function _M.getDrawHeroPro(role, pms)
1130 1131 end
1131 1132 end
1132 1133 end
1133   -
1134   - local ret = redisproxy:lrange("drawHeroRecord", 0, -1)
1135   - result["history"] = ret
1136   - json.encode(result)
  1134 + result["history"] = {}
  1135 + local ret = redisproxy:lrange("drawHeroRecord", 0, 300)
  1136 + for _, v in ipairs(ret) do
  1137 + table.insert(result["history"], MsgPack.unpack(v))
  1138 + end
  1139 + return json.encode(result)
1137 1140 end
1138 1141  
1139 1142 return _M
1140 1143 \ No newline at end of file
... ...
src/actions/HeroAction.lua
... ... @@ -1055,7 +1055,8 @@ function _M.drawHeroRpc(agent, data)
1055 1055 record["hero"] = itemData.name
1056 1056 record["quality"] = itemData.quality
1057 1057  
1058   - redisproxy:lpush("drawHeroRecord", json.encode(record))
  1058 + redisproxy:lpush("drawHeroRecord", MsgPack.pack(record))
  1059 + redisproxy.ltrim("drawHeroRecord", 0, 10000)
1059 1060 end
1060 1061 end
1061 1062  
... ...
src/actions/HttpAction.lua
... ... @@ -258,4 +258,10 @@ function _M.account_init(query, body)
258 258 end
259 259 end
260 260  
  261 +function _M.hero_draw_pro(query)
  262 + local gmFuncs = require "actions.GmAction"
  263 + if not query.cmd or not gmFuncs[query.cmd] then return "指令不存在" end
  264 + return gmFuncs[query.cmd]()
  265 +end
  266 +
261 267 return _M
262 268 \ No newline at end of file
... ...