Commit e5378b4cab4f6ca94f1a88ca77c13f0278e0055e

Authored by zhouhaihai
2 parents fdd61a46 b216676d

Merge branch 'develop' into qa

src/actions/GmAction.lua
@@ -121,7 +121,7 @@ function _M.herol(role, pms) @@ -121,7 +121,7 @@ function _M.herol(role, pms)
121 return "等级已满" 121 return "等级已满"
122 end 122 end
123 local nextLevel = math.min(addLevel + hero:getProperty("level"), MaxLv) 123 local nextLevel = math.min(addLevel + hero:getProperty("level"), MaxLv)
124 - for i = 0, 10 do 124 + for i = 0, #csvdb["unit_breakCsv"] do
125 local upLimit = csvdb["unit_breakCsv"][i].levelLimit 125 local upLimit = csvdb["unit_breakCsv"][i].levelLimit
126 local lowLimit = csvdb["unit_breakCsv"][i - 1] and csvdb["unit_breakCsv"][i - 1].levelLimit or 0 126 local lowLimit = csvdb["unit_breakCsv"][i - 1] and csvdb["unit_breakCsv"][i - 1].levelLimit or 0
127 if upLimit > nextLevel and lowLimit <= nextLevel then 127 if upLimit > nextLevel and lowLimit <= nextLevel then
src/actions/StoreAction.lua
@@ -59,7 +59,7 @@ function _M.dailyBuyRpc(agent , data) @@ -59,7 +59,7 @@ function _M.dailyBuyRpc(agent , data)
59 return 3 59 return 3
60 end 60 end
61 61
62 - if not role:costDiamond({count = cost * count}, {log = {desc = "dailyShop", int1 = id, int2 = count}}) then 62 + if not role:costDiamond({count = cost * count, log = {desc = "dailyShop", int1 = id, int2 = count}}) then
63 return 4 63 return 4
64 end 64 end
65 65
src/models/RoleLog.lua
@@ -71,6 +71,10 @@ local commonRoleField = { @@ -71,6 +71,10 @@ local commonRoleField = {
71 rmbC = "integer", 71 rmbC = "integer",
72 } 72 }
73 73
  74 +local function printError(info)
  75 + print(info)
  76 + print(debug.traceback())
  77 +end
74 78
75 local function checkType(logType, field, value, ctype) 79 local function checkType(logType, field, value, ctype)
76 local typecheckfunc = { 80 local typecheckfunc = {
@@ -78,10 +82,10 @@ local function checkType(logType, field, value, ctype) @@ -78,10 +82,10 @@ local function checkType(logType, field, value, ctype)
78 --长度不超过256 82 --长度不超过256
79 if type(value) ~= "string" then 83 if type(value) ~= "string" then
80 value = tostring(value) 84 value = tostring(value)
81 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [keyword], value : %s", logType, field, value)) 85 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [keyword], value : %s", logType, field, value))
82 else 86 else
83 if #value > 256 then 87 if #value > 256 then
84 - print(string.format("LOG ERROR: logType [%s] field [%s] [keyword] type to long. value : %s", logType, field, value)) 88 + printError(string.format("LOG ERROR: logType [%s] field [%s] [keyword] type to long. value : %s", logType, field, value))
85 end 89 end
86 end 90 end
87 return value 91 return value
@@ -89,26 +93,26 @@ local function checkType(logType, field, value, ctype) @@ -89,26 +93,26 @@ local function checkType(logType, field, value, ctype)
89 text = function() 93 text = function()
90 if type(value) ~= "string" then 94 if type(value) ~= "string" then
91 value = tostring(value) 95 value = tostring(value)
92 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [text], value : %s", logType, field, value)) 96 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [text], value : %s", logType, field, value))
93 end 97 end
94 return value 98 return value
95 end, 99 end,
96 integer = function() 100 integer = function()
97 if type(value) ~= "number" then 101 if type(value) ~= "number" then
98 value = tonumber(value) 102 value = tonumber(value)
99 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], value : %s", logType, field, value)) 103 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], value : %s", logType, field, value))
100 end 104 end
101 if value then 105 if value then
102 if math.type(value) ~= "integer" then 106 if math.type(value) ~= "integer" then
103 local oldValue = value 107 local oldValue = value
104 value = math.floor(value) 108 value = math.floor(value)
105 if value ~= oldValue then 109 if value ~= oldValue then
106 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], is float, value : %s", logType, field, value)) 110 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], is float, value : %s", logType, field, value))
107 end 111 end
108 end 112 end
109 if -2147483648 > value or value > 2147483647 then 113 if -2147483648 > value or value > 2147483647 then
  114 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], too big, value : %s", logType, field, value))
110 value = nil 115 value = nil
111 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], too big, value : %s", logType, field, value))  
112 end 116 end
113 end 117 end
114 return value 118 return value
@@ -116,20 +120,20 @@ local function checkType(logType, field, value, ctype) @@ -116,20 +120,20 @@ local function checkType(logType, field, value, ctype)
116 short = function() 120 short = function()
117 if type(value) ~= "number" then 121 if type(value) ~= "number" then
118 value = tonumber(value) 122 value = tonumber(value)
119 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], value : %s", logType, field, value)) 123 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], value : %s", logType, field, value))
120 end 124 end
121 if value then 125 if value then
122 if math.type(value) ~= "integer" then 126 if math.type(value) ~= "integer" then
123 local oldValue = value 127 local oldValue = value
124 value = math.floor(value) 128 value = math.floor(value)
125 if value ~= oldValue then 129 if value ~= oldValue then
126 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], is float, value : %s", logType, field, value)) 130 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], is float, value : %s", logType, field, value))
127 end 131 end
128 end 132 end
129 133
130 if -32768 > value or value > 32768 then 134 if -32768 > value or value > 32768 then
  135 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], too big, value : %s", logType, field, value))
131 value = nil 136 value = nil
132 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], too big, value : %s", logType, field, value))  
133 end 137 end
134 end 138 end
135 return value 139 return value
@@ -137,17 +141,17 @@ local function checkType(logType, field, value, ctype) @@ -137,17 +141,17 @@ local function checkType(logType, field, value, ctype)
137 long = function() 141 long = function()
138 if type(value) ~= "number" then 142 if type(value) ~= "number" then
139 value = tonumber(value) 143 value = tonumber(value)
140 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], value : %s", logType, field, value)) 144 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], value : %s", logType, field, value))
141 end 145 end
142 if value then 146 if value then
143 if math.type(value) ~= "integer" then 147 if math.type(value) ~= "integer" then
144 local oldValue = value 148 local oldValue = value
145 value = math.floor(value) 149 value = math.floor(value)
146 if type(value) ~= "integer" then 150 if type(value) ~= "integer" then
  151 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], too big, value : %s", logType, field, value))
147 value = nil 152 value = nil
148 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], too big, value : %s", logType, field, value))  
149 elseif value ~= oldValue then 153 elseif value ~= oldValue then
150 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], is float, value : %s", logType, field, value)) 154 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], is float, value : %s", logType, field, value))
151 end 155 end
152 end 156 end
153 end 157 end
@@ -156,7 +160,7 @@ local function checkType(logType, field, value, ctype) @@ -156,7 +160,7 @@ local function checkType(logType, field, value, ctype)
156 float = function() 160 float = function()
157 if type(value) ~= "number" then 161 if type(value) ~= "number" then
158 value = tonumber(value) 162 value = tonumber(value)
159 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [float], value : %s", logType, field, value)) 163 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [float], value : %s", logType, field, value))
160 end 164 end
161 return value 165 return value
162 end, 166 end,
@@ -165,7 +169,7 @@ local function checkType(logType, field, value, ctype) @@ -165,7 +169,7 @@ local function checkType(logType, field, value, ctype)
165 if typecheckfunc[ctype] then 169 if typecheckfunc[ctype] then
166 return typecheckfunc[ctype]() 170 return typecheckfunc[ctype]()
167 else 171 else
168 - print(string.format("LOG ERROR: logType [%s] field [%s] have a new type [%s] need add check.", logType, field, ctype)) 172 + printError(string.format("LOG ERROR: logType [%s] field [%s] have a new type [%s] need add check.", logType, field, ctype))
169 return nil 173 return nil
170 end 174 end
171 end 175 end
@@ -176,13 +180,13 @@ function RoleLog.bind(Role) @@ -176,13 +180,13 @@ function RoleLog.bind(Role)
176 contents = contents or {} 180 contents = contents or {}
177 local _logType = LogType[logType] 181 local _logType = LogType[logType]
178 if not _logType then 182 if not _logType then
179 - print(string.format("LOG ERROR: new logType [%s] need Add Maping.", logType)) 183 + printError(string.format("LOG ERROR: new logType [%s] need Add Maping.", logType))
180 return 184 return
181 end 185 end
182 local doc = {} 186 local doc = {}
183 for field, ctype in pairs(commonRoleField) do 187 for field, ctype in pairs(commonRoleField) do
184 if contents[field] then 188 if contents[field] then
185 - print(string.format("LOG ERROR: logType [%s] had field [%s] overwrite default.", logType, field)) 189 + printError(string.format("LOG ERROR: logType [%s] had field [%s] overwrite default.", logType, field))
186 end 190 end
187 doc[field] = checkType("commonRoleField", field, self:getProperty(field), ctype) 191 doc[field] = checkType("commonRoleField", field, self:getProperty(field), ctype)
188 end 192 end
@@ -197,7 +201,7 @@ function RoleLog.bind(Role) @@ -197,7 +201,7 @@ function RoleLog.bind(Role)
197 if ftype then 201 if ftype then
198 doc[field] = checkType(logType, field, value, ftype) 202 doc[field] = checkType(logType, field, value, ftype)
199 else 203 else
200 - print(string.format("LOG ERROR: logType [%s] have new field [%s] no type in mapping.", logType, field)) 204 + printError(string.format("LOG ERROR: logType [%s] have new field [%s] no type in mapping.", logType, field))
201 end 205 end
202 end 206 end
203 if not logd then return end 207 if not logd then return end