Commit f406ee33b45056c7b13cf944f638b5468ce054bb

Authored by 熊润斐
2 parents d86cc4d7 3a0c3140

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

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,20 +30,24 @@ end
29 30  
30 31 function addFriend(roleId, friendId)
31 32 local stmt_csp = mysqlproxy:prepare("call add_friends(?, ?, ?)")
  33 + --logdump(stmt_csp, '')
32 34 local r = mysqlproxy:execute(stmt_csp, roleId, friendId, skynet.timex())
33 35 if r[1][1]["t_error"] == 0 then
34 36 rpcRole(roleId, "addFriend", friendId)
35 37 rpcRole(friendId, "addFriend", roleId)
36 38 end
  39 + mysqlproxy:stmt_close(stmt_csp)
37 40 end
38 41  
39 42 function delFriend(roleId, friendId)
40 43 local stmt_csp = mysqlproxy:prepare("call del_friends(?, ?)")
  44 + --logdump(stmt_csp, '')
41 45 local r = mysqlproxy:execute(stmt_csp, roleId, friendId)
42 46 if r[1][1]["t_error"] == 0 then
43 47 rpcRole(roleId, "delFriend", friendId)
44 48 rpcRole(friendId, "delFriend", roleId)
45 49 end
  50 + mysqlproxy:stmt_close(stmt_csp)
46 51 end
47 52  
48 53 function roleExists(roleId)
... ...