Commit b216676d38ccec8e69c4059baa014fa6cbae0b29
1 parent
923162ce
log
Showing
2 changed files
with
22 additions
and
18 deletions
Show diff stats
src/actions/StoreAction.lua
... | ... | @@ -59,7 +59,7 @@ function _M.dailyBuyRpc(agent , data) |
59 | 59 | return 3 |
60 | 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 | 63 | return 4 |
64 | 64 | end |
65 | 65 | ... | ... |
src/models/RoleLog.lua
... | ... | @@ -71,6 +71,10 @@ local commonRoleField = { |
71 | 71 | rmbC = "integer", |
72 | 72 | } |
73 | 73 | |
74 | +local function printError(info) | |
75 | + print(info) | |
76 | + print(debug.traceback()) | |
77 | +end | |
74 | 78 | |
75 | 79 | local function checkType(logType, field, value, ctype) |
76 | 80 | local typecheckfunc = { |
... | ... | @@ -78,10 +82,10 @@ local function checkType(logType, field, value, ctype) |
78 | 82 | --长度不超过256 |
79 | 83 | if type(value) ~= "string" then |
80 | 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 | 86 | else |
83 | 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 | 89 | end |
86 | 90 | end |
87 | 91 | return value |
... | ... | @@ -89,26 +93,26 @@ local function checkType(logType, field, value, ctype) |
89 | 93 | text = function() |
90 | 94 | if type(value) ~= "string" then |
91 | 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 | 97 | end |
94 | 98 | return value |
95 | 99 | end, |
96 | 100 | integer = function() |
97 | 101 | if type(value) ~= "number" then |
98 | 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 | 104 | end |
101 | 105 | if value then |
102 | 106 | if math.type(value) ~= "integer" then |
103 | 107 | local oldValue = value |
104 | 108 | value = math.floor(value) |
105 | 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 | 111 | end |
108 | 112 | end |
109 | 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 | 115 | value = nil |
111 | - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], too big, value : %s", logType, field, value)) | |
112 | 116 | end |
113 | 117 | end |
114 | 118 | return value |
... | ... | @@ -116,20 +120,20 @@ local function checkType(logType, field, value, ctype) |
116 | 120 | short = function() |
117 | 121 | if type(value) ~= "number" then |
118 | 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 | 124 | end |
121 | 125 | if value then |
122 | 126 | if math.type(value) ~= "integer" then |
123 | 127 | local oldValue = value |
124 | 128 | value = math.floor(value) |
125 | 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 | 131 | end |
128 | 132 | end |
129 | 133 | |
130 | 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 | 136 | value = nil |
132 | - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], too big, value : %s", logType, field, value)) | |
133 | 137 | end |
134 | 138 | end |
135 | 139 | return value |
... | ... | @@ -137,17 +141,17 @@ local function checkType(logType, field, value, ctype) |
137 | 141 | long = function() |
138 | 142 | if type(value) ~= "number" then |
139 | 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 | 145 | end |
142 | 146 | if value then |
143 | 147 | if math.type(value) ~= "integer" then |
144 | 148 | local oldValue = value |
145 | 149 | value = math.floor(value) |
146 | 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 | 152 | value = nil |
148 | - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], too big, value : %s", logType, field, value)) | |
149 | 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 | 155 | end |
152 | 156 | end |
153 | 157 | end |
... | ... | @@ -156,7 +160,7 @@ local function checkType(logType, field, value, ctype) |
156 | 160 | float = function() |
157 | 161 | if type(value) ~= "number" then |
158 | 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 | 164 | end |
161 | 165 | return value |
162 | 166 | end, |
... | ... | @@ -165,7 +169,7 @@ local function checkType(logType, field, value, ctype) |
165 | 169 | if typecheckfunc[ctype] then |
166 | 170 | return typecheckfunc[ctype]() |
167 | 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 | 173 | return nil |
170 | 174 | end |
171 | 175 | end |
... | ... | @@ -176,13 +180,13 @@ function RoleLog.bind(Role) |
176 | 180 | contents = contents or {} |
177 | 181 | local _logType = LogType[logType] |
178 | 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 | 184 | return |
181 | 185 | end |
182 | 186 | local doc = {} |
183 | 187 | for field, ctype in pairs(commonRoleField) do |
184 | 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 | 190 | end |
187 | 191 | doc[field] = checkType("commonRoleField", field, self:getProperty(field), ctype) |
188 | 192 | end |
... | ... | @@ -197,7 +201,7 @@ function RoleLog.bind(Role) |
197 | 201 | if ftype then |
198 | 202 | doc[field] = checkType(logType, field, value, ftype) |
199 | 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 | 205 | end |
202 | 206 | end |
203 | 207 | if not logd then return end | ... | ... |