Commit 0d2111f2f97f7e3f8f4646a03bf46112cef6345e

Authored by liuzujun
1 parent 2c3a1b31

好友添加排错日志

Showing 2 changed files with 17 additions and 1 deletions   Show diff stats
src/utils/CommonFunc.lua
... ... @@ -349,4 +349,15 @@ function httpGetFormatData(params)
349 349 end
350 350  
351 351 return table.concat(body, "&")
352   -end
353 352 \ No newline at end of file
  353 +end
  354 +
  355 +function logdump(obj, prefix)
  356 + for k,v in pairs(obj) do
  357 + local vt = type(v)
  358 + if vt == "table" then
  359 + logdump(v, prefix..':'..k)
  360 + elseif vt == 'string' or vt == 'number' then
  361 + skynet.error(prefix..':'..k..'='..v)
  362 + end
  363 + end
  364 +end
... ...
src/utils/MysqlUtil.lua
1 1 local skynet = require "skynet"
2 2 local mysqlproxy = require "shared.mysqlproxy"
  3 +require "utils.CommonFunc"
3 4  
4 5  
5 6 function getDbCfgVal(tbName, keyName, fieldName)
... ... @@ -29,6 +30,8 @@ end
29 30  
30 31 function addFriend(roleId, friendId)
31 32 local stmt_csp = mysqlproxy:prepare("call add_friends(?, ?, ?)")
  33 + skynet.error(string.format("addFriend!!!!!!!!!,%s,%s,%s",roleId, friendId, skynet.timex()))
  34 + logdump(stmt_csp, '')
32 35 local r = mysqlproxy:execute(stmt_csp, roleId, friendId, skynet.timex())
33 36 if r[1][1]["t_error"] == 0 then
34 37 rpcRole(roleId, "addFriend", friendId)
... ... @@ -38,6 +41,8 @@ end
38 41  
39 42 function delFriend(roleId, friendId)
40 43 local stmt_csp = mysqlproxy:prepare("call del_friends(?, ?)")
  44 + skynet.error(string.format("delFriend!!!!!!!!!,%s,%s",roleId, friendId))
  45 + logdump(stmt_csp, '')
41 46 local r = mysqlproxy:execute(stmt_csp, roleId, friendId)
42 47 if r[1][1]["t_error"] == 0 then
43 48 rpcRole(roleId, "delFriend", friendId)
... ...