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
956f2471
Commit
956f2471
authored
Sep 02, 2018
by
周尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复卡券批处理因时间格式导致的错误
暂时关闭门店日统计的批处理检查以规避mysql连接错误问题
parent
df4029a7
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
589 additions
and
517 deletions
+589
-517
nginx/conf/nginx.conf
nginx/conf/nginx.conf
+1
-0
nginx/lua/luabiz/node_card.lua
nginx/lua/luabiz/node_card.lua
+1
-1
nginx/lua/luabiz/node_ticket.lua
nginx/lua/luabiz/node_ticket.lua
+1
-1
nginx/lua/luabiz/settle.lua
nginx/lua/luabiz/settle.lua
+13
-6
nginx/lua/luabiz/tk_sdt.lua
nginx/lua/luabiz/tk_sdt.lua
+573
-509
No files found.
nginx/conf/nginx.conf
View file @
956f2471
...
...
@@ -18,6 +18,7 @@ http {
include
mime.types
;
default_type
application/octet-stream
;
log_format
main
#log_format main "'$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
...
...
nginx/lua/luabiz/node_card.lua
View file @
956f2471
...
...
@@ -39,7 +39,7 @@ local function card_sql(db_st, total_time)
-- DELETE invalid rows
-- local sql_delete = [[DELETE FROM node_card WHERE (card_status != 0 AND card_status !=1) or now() > card_exp]]
local
sql_update
=
[[UPDATE node_card SET card_status = 8 WHERE now() > card_exp]]
local
sql_update
=
string.format
(
[[UPDATE node_card SET card_status = 8 WHERE %d > card_exp]]
,
os.date
(
"%Y%m%d"
))
local
res
,
err
,
errcode
,
sqlstate
=
db
:
query
(
sql_update
)
ngx
.
log
(
ngx
.
NOTICE
,
sql_update
)
if
not
res
then
...
...
nginx/lua/luabiz/node_ticket.lua
View file @
956f2471
...
...
@@ -36,7 +36,7 @@ local function ticket_sql(db_st, total_time)
-- DELETE invalid rows
-- local sql_delete = [[DELETE FROM node_ticket WHERE (ticket_status != 0 AND ticket_status !=1) or now() > ticket_exp]]
local
sql_update
=
[[UPDATE node_ticket SET ticket_status = 8 WHERE now() > ticket_exp]]
local
sql_update
=
string.format
(
[[UPDATE node_ticket SET ticket_status = 8 WHERE %d > ticket_exp]]
,
os.date
(
"%Y%m%d"
))
ngx
.
log
(
ngx
.
NOTICE
,
sql_update
)
local
res
,
err
,
errcode
,
sqlstate
=
db
:
query
(
sql_update
)
if
not
res
then
...
...
nginx/lua/luabiz/settle.lua
View file @
956f2471
local
SETTLE
=
{}
-- Settle modules
local
zx_base
=
loadmod
(
'zx_base'
)
-- local node_asb = loadmod('node_asb')
...
...
@@ -26,7 +27,7 @@ local tk_sync = loadmod('tk_sync')
local
delay
=
5
-- delaytime
local
interval_time
=
'0
10
0'
-- time to run, here is 12:00 for each day
local
interval_time
=
'0
03
0'
-- time to run, here is 12:00 for each day
-- local settledate = "2018-08-16"
local
settledate
=
os.date
(
'%Y-%m-%d'
,
os.time
())
local
settletime
=
zx_base
:
date2time
(
settledate
)
...
...
@@ -58,10 +59,17 @@ handler = function(premature, interval_time, settletime)
-- node_smsvip: run()
-- node_vipacct: run()
tk_sync
:
run
()
node_card
:
run
(
settletime
)
node_ticket
:
run
(
settletime
)
tk_sdt
:
run
(
settletime
)
-- tk_sync: run()
-- node_card: run(settletime)
-- node_ticket: run(settletime)
-- tk_sdt: run(settletime)
local
handle
=
io.popen
(
"curl localhost:8080/settle"
)
if
handle
then
handle
:
close
()
end
-- reset interval_time
interval_time
=
tostring
(
tonumber
(
interval_time
)
-
1
)
...
...
@@ -85,7 +93,6 @@ if ngx.worker.id() == 1 then
end
end
local
SETTLE
=
{}
function
SETTLE
.
run
()
local
args
=
ngx
.
req
.
get_uri_args
()
local
t
...
...
nginx/lua/luabiz/tk_sdt.lua
View file @
956f2471
This diff is collapsed.
Click to expand it.
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