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