Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openresty
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tangku7
openresty
Commits
e05d23d6
Commit
e05d23d6
authored
Sep 27, 2018
by
周尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perfect the README doc
parent
0967cc16
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
26 deletions
+36
-26
README.org
README.org
+13
-10
nginx/lua/luabiz/README.org
nginx/lua/luabiz/README.org
+18
-9
nginx/lua/luabiz/tk_sdt.lua
nginx/lua/luabiz/tk_sdt.lua
+5
-7
No files found.
README.org
View file @
e05d23d6
* 项目说明
使用 /openresty(nginx+)/ 框架搭建服务器, 主要针对 *异步非阻* 场景, 使用 ~lua~ 开发功能支持模块
* 主要功能
详见 [[file:nginx/lua/luabiz/README.org::*%E6%A8%A1%E5%9D%97%E8%AF%B4%E6%98%8E][模块说明]]
使用 [[https://github.com/openresty/openresty][openresty]] 框架, 业务功能使用 ~ngx_lua~ 开发
* 项目地址
** 测试
192.168.254.7:/root/www/openresty
** 生产
121.196.219.142:/root/www/openresty
* 日志
- 使用 =syslog-ng= 模块
- 当前路径 ~/var/log/ngx~
- 配置文件 ~/etc/syslog-ng/syslog-ng.conf~
* 业务功能
** 业务清单
*** 唐库6.0
1. [X] 唐库 6.0 异步通知
*** 唐库7.0
1. [-] 业务批处理
1. [X] 库存信息类
1. [X] 门店库存
...
...
@@ -45,3 +46,5 @@
1. [X] 门店信息
2. [X] 款台信息
3. [X] 门店汇总
** 业务代码
详见 [[file:nginx/lua/luabiz/README.org::*%E6%A8%A1%E5%9D%97%E8%AF%B4%E6%98%8E][模块说明]]
nginx/lua/luabiz/README.org
View file @
e05d23d6
* 代码依赖
- [[https://github.com/cloudflare/lua-resty-logger-socket][lua-resty-logger-socket]]
- =syslog-ng=
* 模块说明
| 文件名 | 说明 |
|---------------+----------------------------|
| ~zx_base.lua~ | 基础支持 |
|---------------+----------------------------|
| ~async.lua~ | 唐库6.0 异步通知功能模块 |
|---------------+----------------------------|
| ~sync.lua~ | 唐库7.0 总控-节点 同步模块 |
| ~check.lua~ | 唐库7.0 通用字段校验 |
| ~settle.lua~ | 批处理业务 |
| 文件名 | 说明 |
|-------------------+----------------------------|
| ~init.lua~ | 初始化模块 |
| ~mods.lua~ | 模块加载 |
| ~db_conf.lua~ | 数据库配置 |
|-------------------+----------------------------|
| ~zx_base.lua~ | 基础支持 |
|-------------------+----------------------------|
| ~async.lua~ | 唐库6.0 异步通知功能模块 |
|-------------------+----------------------------|
| ~settle.lua~ | 批处理业务 |
| ~node_card.lua~ | 卡表批处理 |
| ~node_ticket.lua~ | 券表批处理 |
| ~tk_sdt.lua~ | 门店日统计 |
| ~tk_sync.lua~ | 唐库7.0 总控-节点 同步模块 |
nginx/lua/luabiz/tk_sdt.lua
View file @
e05d23d6
...
...
@@ -97,24 +97,22 @@ local function sdt_sql(tk_biz, tk_control, total_time)
for
i
=
1
,
#
shops
do
local
shop
=
shops
[
i
]
local
sql
=
{}
local
res
while
true
do
local
shop
local
sql
=
{}
local
res
shop
=
shops
[
i
]
-- CHECK if exists
local
sql_check
=
string.format
(
[[SELECT * FROM tk_sdt WHERE DATE(total_date) = DATE('%s') ]]
..
[[AND shop_map_id = %s ]]
,
os.date
(
'%Y%m%d'
,
total_time
),
os.date
(
'%Y%m%d'
,
total_time
),
tostring
(
shop
.
shop_map_id
))
res
,
err
,
errcode
,
sqlstate
=
db_biz
:
query
(
sql_check
)
log_lua
:
log
(
log_lua
:
__FILE__
()
..
":"
..
log_lua
:
__LINE__
(),
"NOTICE: "
..
sql_check
)
if
not
res
then
log_lua
:
log
(
log_lua
:
__FILE__
()
..
":"
..
log_lua
:
__LINE__
(),
"ERR: "
..
"failed to connect:"
,
json
.
encode
(
tk_biz
),
":"
,
err
,
":"
,
errcode
,
":"
,
sqlstate
,
"."
)
log_lua
:
log
(
log_lua
:
__FILE__
()
..
":"
..
log_lua
:
__LINE__
(),
"ERR: "
..
sql_check
)
return
end
if
#
res
~=
0
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment