From 0d2111f2f97f7e3f8f4646a03bf46112cef6345e Mon Sep 17 00:00:00 2001 From: liuzujun <307836273@qq.com> Date: Fri, 4 Jun 2021 14:06:43 +0800 Subject: [PATCH] 好友添加排错日志 --- src/utils/CommonFunc.lua | 13 ++++++++++++- src/utils/MysqlUtil.lua | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/utils/CommonFunc.lua b/src/utils/CommonFunc.lua index d7944f4..8cea56b 100644 --- a/src/utils/CommonFunc.lua +++ b/src/utils/CommonFunc.lua @@ -349,4 +349,15 @@ function httpGetFormatData(params) end return table.concat(body, "&") -end \ No newline at end of file +end + +function logdump(obj, prefix) + for k,v in pairs(obj) do + local vt = type(v) + if vt == "table" then + logdump(v, prefix..':'..k) + elseif vt == 'string' or vt == 'number' then + skynet.error(prefix..':'..k..'='..v) + end + end +end diff --git a/src/utils/MysqlUtil.lua b/src/utils/MysqlUtil.lua index c20a1bd..c92036c 100644 --- a/src/utils/MysqlUtil.lua +++ b/src/utils/MysqlUtil.lua @@ -1,5 +1,6 @@ local skynet = require "skynet" local mysqlproxy = require "shared.mysqlproxy" +require "utils.CommonFunc" function getDbCfgVal(tbName, keyName, fieldName) @@ -29,6 +30,8 @@ end function addFriend(roleId, friendId) local stmt_csp = mysqlproxy:prepare("call add_friends(?, ?, ?)") + skynet.error(string.format("addFriend!!!!!!!!!,%s,%s,%s",roleId, friendId, skynet.timex())) + logdump(stmt_csp, '') local r = mysqlproxy:execute(stmt_csp, roleId, friendId, skynet.timex()) if r[1][1]["t_error"] == 0 then rpcRole(roleId, "addFriend", friendId) @@ -38,6 +41,8 @@ end function delFriend(roleId, friendId) local stmt_csp = mysqlproxy:prepare("call del_friends(?, ?)") + skynet.error(string.format("delFriend!!!!!!!!!,%s,%s",roleId, friendId)) + logdump(stmt_csp, '') local r = mysqlproxy:execute(stmt_csp, roleId, friendId) if r[1][1]["t_error"] == 0 then rpcRole(roleId, "delFriend", friendId) -- libgit2 0.21.2