Skip to content

Commit

Permalink
合并主支
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaobangyu committed Oct 7, 2023
2 parents 8495124 + 41d1fea commit dc73da0
Show file tree
Hide file tree
Showing 153 changed files with 1,585 additions and 1,704 deletions.
26 changes: 11 additions & 15 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@ max_cyclomatic_complexity = 13
max_code_line_length = 160
max_comment_line_length = 160
exclude_files = {
"script/luabt/*.*",
"script/luaoop/*.*",
"script/luabt/luaoop/*.*",
"script/luabt/LICENSE",
"script/luaoop/LICENSE",
"script/luabt/luaoop/LICENSE",
"server/robot/accord/page/*",
"extend/lmake/share.lua"
"extend/lmake/share.lua",
"server/robot/accord/page/*"
}
include_files = {
"script/*",
"server/*",
"worker/*",
"bin/proto/*.lua",
"tools/encrypt/*",
"tools/excel2lua/*",
"script/*.lua",
"server/*.lua",
"script/*/*.lua",
"server/*/*.lua",
"script/*/*/*.lua",
"server/*/*/*.lua",
"script/*/*/*/*.lua",
"server/*/*/*/*.lua",
"extend/lmake/*.lua",
"extend/lmake/ltemplate/*.lua",
"tools/*/*.lua",
}
ignore = {"212", "213", "512"}

2 changes: 1 addition & 1 deletion bin/database.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set_env("QUANTA_MONGO_URLS", [[
]])
--redis
set_env("QUANTA_REDIS_URLS", [[
redis://root:123456@127.0.0.1:6379;
redis://root:123456@10.96.8.100:6379;
]])
--mysql
set_env("QUANTA_MYSQL_URLS", [[
Expand Down
9 changes: 6 additions & 3 deletions bin/share.conf
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,15 @@ set_env("QUANTA_DB_CACHE_MAX", "4096")
--每帧落地最大数量
set_env("QUANTA_DB_CACHE_FLUSH", "10")

--webhook日志等级
--webhook设置
-----------------------------------------------------
set_env("QUANTA_WEBHOOK_LVL", "6")
--log: 日志采集
--http:http发送
set_env("QUANTA_WEBHOOK_MODE", "log")
--webhook地址设置
--set_env("QUANTA_LARK_URL", "https://open.feishu.cn/open-apis/bot/v2/hook/9a6565bf-51b4-48ab-80f0-64caf4d58ab8")
--set_env("QUANTA_DING_URL", "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=a4c64781-adad-4ddc-a615-6bc232ce71ef")
--set_env("QUANTA_WECHAT_URL", "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=ee6d97c5-477d-436f-83db-dd5361a5e8bd")
set_env("QUANTA_WECHAT_URL", "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=d7cd918c-f608-4762-87af-bb8c7fc51074")

--graylog配置
-----------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions core/luabus/luabus.mak
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MYCFLAGS += -Wsign-compare
MYCFLAGS += -Wno-sign-compare
MYCFLAGS += -Wno-unused-variable
MYCFLAGS += -Wno-unused-parameter
MYCFLAGS += -Wno-unused-but-set-variable
MYCFLAGS += -Wno-unused-but-set-parameter
MYCFLAGS += -Wno-unknown-pragmas

Expand Down
2 changes: 1 addition & 1 deletion core/luabus/luabus.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\..\extend\lua\lua;..\..\extend\ltimer\ltimer;..\..\extend\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion core/quanta/quanta.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\..\extend\lua\lua;..\..\extend\fmt\include;..\..\extend\luakit\include;..\..\extend\lualog\lualog;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;FMT_HEADER_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/laoi/laoi.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lbson/lbson.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lcodec/lcodec.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lcrypt/lcrypt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LCRYPT_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lcurl/lcurl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;.\;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/ldetour/ldetour.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>src\detour;..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/ljson/ljson.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
61 changes: 43 additions & 18 deletions extend/lmake/ltemplate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,11 @@ local function render(content, env)
return nil, chunk
end

--导出文件模板
--根据配置导出文件模板
--tpl_f: 文件模板
--tpl_out_f: 输出文件
--tpl_env: 环境变量
--tpl_var_f: 环境变量文件
local function render_file(tpl_f, tpl_out_f, tpl_env, tpl_var_f)
local function render_file(tpl_f, tpl_out_f, tpl_env)
if not tpl_f or not tpl_out_f or not tpl_env then
error("render template file params error!")
return
Expand All @@ -182,19 +181,6 @@ local function render_file(tpl_f, tpl_out_f, tpl_env, tpl_var_f)
tpl_env.NAME = tpl_f
local content = template_file:read("*all")
template_file:close()
if tpl_var_f then
setmetatable(tpl_env, { __index = function(t, k) return _G[k] end })
local func, err = loadfile(tpl_var_f, "bt", tpl_env)
if not func then
error(sformat("open template variable file %s failed :%s", tpl_var_f, err))
return
end
local ok, res = pcall(func)
if not ok then
error(sformat("load template variable file %s failed :%s", tpl_var_f, res))
return
end
end
local out_file = iopen(tpl_out_f, "w")
if not out_file then
error(sformat("open template out file %s failed!", tpl_out_f))
Expand All @@ -214,13 +200,52 @@ local function render_file(tpl_f, tpl_out_f, tpl_env, tpl_var_f)
print(sformat("render template file %s to %s success!", tpl_f, tpl_out_f))
end

--输入参数
local arg_num = select("#", ...)

--工具用法
--tpl_f: 模板文件路径
--tpl_out_f:输出文件路径
--tpl_var_f:环境变量配置文件
if select("#", ...) == 3 then
if arg_num == 3 then
local tpl_env = {}
local tpl_f, tpl_out_f, tpl_var_f = select(1, ...)
render_file(tpl_f, tpl_out_f, {}, tpl_var_f)
if tpl_var_f then
setmetatable(tpl_env, { __index = function(t, k) return _G[k] end })
local func, err = loadfile(tpl_var_f, "bt", tpl_env)
if not func then
error(sformat("open template variable file %s failed :%s", tpl_var_f, err))
return
end
local ok, res = pcall(func)
if not ok then
error(sformat("load template variable file %s failed :%s", tpl_var_f, res))
return
end
end
render_file(tpl_f, tpl_out_f, tpl_env)
end

--工具用法
--tpl_f: 模板文件路径
--tpl_out_f:输出文件路径
--key:文件索引, filename:文件名, ...
if arg_num > 3 then
local tpl_env = {}
local args = { ... }
local filenum = (arg_num - 2) // 2
for i = 1, filenum do
local key = args[2 + i * 2 - 1]
local filename = args[2 + i * 2]
local args_file = iopen(filename, "r")
if not args_file then
error(sformat("open args file %s failed!", filename))
return
end
tpl_env[key] = args_file:read("*all")
args_file:close()
end
render_file(args[1], args[2], tpl_env)
end

return {
Expand Down
2 changes: 1 addition & 1 deletion extend/lmake/tmpl/vcxproj.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>{{%= FMT_INCLUDES %}};%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;{{%= FMT_DEFINES %}};%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lstdfs/lstdfs.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/ltimer/ltimer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lua/lua.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>.\lua;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;MAKE_LUA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lua/luac.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>.\lua;.\luac;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;MAKE_LUAC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lua/lualib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>.\lua;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lualog/lualog.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\fmt\include;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;FMT_HEADER_ONLY;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
12 changes: 6 additions & 6 deletions extend/lualog/lualog/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ namespace logger {

// class log_message
// --------------------------------------------------------------------------------
void log_message::option(log_level level, vstring msg, vstring tag, vstring feature, vstring source, int line) {
void log_message::option(log_level level, cstring& msg, cstring& tag, cstring& feature, cstring& source, int line) {
log_time_ = log_time::now();
feature_ = feature;
source_ = source;
feature_ = std::move(feature);
source_ = std::move(source);
msg_ = std::move(msg);
tag_ = std::move(tag);
level_ = level;
line_ = line;
msg_ = msg;
tag_ = tag;
}

// class log_message_pool
Expand Down Expand Up @@ -367,7 +367,7 @@ namespace logger {
}
}

void log_service::output(log_level level, vstring msg, vstring tag, vstring feature, vstring source, int line) {
void log_service::output(log_level level, cstring& msg, cstring& tag, cstring& feature, cstring& source, int line) {
if (!log_filter_.is_filter(level)) {
auto logmsg_ = message_pool_->allocate();
logmsg_->option(level, msg, tag, feature, source, line);
Expand Down
6 changes: 3 additions & 3 deletions extend/lualog/lualog/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace logger {
void set_grow(bool grow) { grow_ = grow; }
log_level level() const { return level_; }
const log_time& get_log_time()const { return log_time_; }
void option(log_level level, vstring msg, vstring tag, vstring feature, vstring source, int line);
void option(log_level level, cstring& msg, cstring& tag, cstring& feature, cstring& source, int line);

private:
int line_ = 0;
Expand Down Expand Up @@ -239,7 +239,7 @@ namespace logger {
virtual bool add_file_dest(vstring feature, vstring fname) = 0;
virtual void set_dest_clean_time(vstring feature, size_t clean_time) = 0;
virtual void option(vstring log_path, vstring service, vstring index) = 0;
virtual void output(log_level level, vstring msg, vstring tag, vstring feature = "", vstring source = "", int line = 0) = 0;
virtual void output(log_level level, cstring& msg, cstring& tag, cstring& feature = "", cstring& source = "", int line = 0) = 0;
};

class log_service : public logger {
Expand Down Expand Up @@ -268,7 +268,7 @@ namespace logger {
bool is_filter(log_level lv) { return log_filter_.is_filter(lv); }
void filter(log_level lv, bool on) { log_filter_.filter(lv, on); }

void output(log_level level, vstring msg, vstring tag, vstring feature, vstring source, int line);
void output(log_level level, cstring& msg, cstring& tag, cstring& feature, cstring& source, int line);

protected:
path build_path(vstring feature, vstring fpath);
Expand Down
Loading

0 comments on commit dc73da0

Please sign in to comment.