Commit aa84432f5f22fa8a039466e29b466f2fbcd81662

Authored by 熊润斐
2 parents 889380fd 3dd204eb

Merge branch 'cn/develop' into cn/publish/preview

src/models/Daily.lua
... ... @@ -33,6 +33,7 @@ Daily.schema = {
33 33 curPool = {"number", 0}, -- 属性卡池当前索引
34 34 drawHeroCnt = {"number", 0}, -- 每日抽卡次数
35 35  
  36 + treasureBase = {"number", 0}, -- 资源值
36 37 treasureList = {"table", {}}, --挂机图鉴
37 38 }
38 39  
... ... @@ -64,6 +65,8 @@ function Daily:refreshDailyData(notify)
64 65 if self:getProperty(field) > 0 then
65 66 dataMap[field] = 0
66 67 end
  68 + elseif field == "id" then
  69 + -- skip
67 70 elseif field == "treasureList" then
68 71 dataMap[field] = self:getTreasrueList()
69 72 elseif field ~= "key" then
... ... @@ -142,8 +145,6 @@ function Daily:checkTreasureExpired(treasureAttr, treasureList)
142 145 end
143 146 curInfo = clone(treasureAttr)
144 147 end
145   - else
146   - curInfo = clone(treasureAttr)
147 148 end
148 149 else
149 150 curInfo = clone(treasureAttr)
... ... @@ -303,7 +304,7 @@ end
303 304  
304 305 function Daily:buyTreasure(treasureList)
305 306 local boughtTreasurer = {}
306   - local treasureBase = globalCsv.idle_treasure_base
  307 + local treasureBase = self:getProperty("treasureBase")
307 308 for id, val in pairs(treasureList) do
308 309 treasureBase = treasureBase - val.treasure_value
309 310 if treasureBase < 0 then
... ... @@ -313,7 +314,7 @@ function Daily:buyTreasure(treasureList)
313 314 boughtTreasurer[id] = val
314 315 end
315 316 end
316   - --self:updateProperty({field = "treasureBase", value = treasureBase})
  317 + self:updateProperty({field = "treasureBase", value = treasureBase})
317 318 return boughtTreasurer
318 319 end
319 320  
... ... @@ -340,6 +341,7 @@ function Daily:getTreasrueList()
340 341  
341 342 self:checkTreasureWeight(treasureList, tmptreasure, treasureBase)
342 343 self:updateProperty({field = "treasureList", value = treasureList})
  344 + self:updateProperty({field = "treasureBase", value = treasureBase})
343 345 return treasureList
344 346 end
345 347  
... ...
src/services/pvpd.lua
1 1 skynet = require "skynet"
2 2 local json = require("shared.json")
3 3 redisproxy = require("shared.redisproxy")
  4 +mysqlproxy = require("shared.mysqlproxy")
4 5 local cluster = require "skynet.cluster"
5 6 local serverId = tonumber(skynet.getenv("servId"))
6 7 datacenter = require "skynet.datacenter"
... ...
src/shared/ModelBaseMysql.lua
... ... @@ -503,8 +503,8 @@ function ModelBaseMysql:updateFields(fields)
503 503 sql = string_format(sql, tbName, table.concat(tmp, ","), self.pri_key, self:getKey())
504 504 local res = mysqlproxy:query(sql)
505 505 if res["errno"] then
506   - skynet.error(sql)
507   - skynet.error(res["err"])
  506 + skynet.error("error sql:"..sql)
  507 + skynet.error("error str:"..res["err"])
508 508 return false
509 509 end
510 510 end
... ...
src/utils/MysqlUtil.lua
... ... @@ -57,7 +57,7 @@ function roleExists(roleId)
57 57 end
58 58  
59 59 function roleUidExists(uid)
60   - local res = mysqlproxy:query(string.format("SELECT `name` FROM `Role` WHERE `uid` = %s", uid))
  60 + local res = mysqlproxy:query(string.format("SELECT `name` FROM `Role` WHERE `uid` = '%s'", uid))
61 61 if res["errno"] or not next(res) then
62 62 return false
63 63 end
... ...