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
15d0a2a9
Commit
15d0a2a9
authored
Sep 11, 2018
by
周尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
async for suixingpay
parent
888d4566
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
23 deletions
+31
-23
nginx/lua/luabiz/async.lua
nginx/lua/luabiz/async.lua
+12
-4
nginx/lua/luabiz/settle.lua
nginx/lua/luabiz/settle.lua
+11
-11
nginx/lua/luabiz/tk_sdt.lua
nginx/lua/luabiz/tk_sdt.lua
+8
-8
No files found.
nginx/lua/luabiz/async.lua
View file @
15d0a2a9
...
...
@@ -65,12 +65,20 @@ local function async_db(ins_sql)
db
:
set_keepalive
(
10000
,
100
)
end
local
function
async
()
ngx
.
say
(
"SUCCESS"
)
local
function
eof
()
if
ngx
.
var
.
host
==
"icm-test.suixingpay.com"
then
ngx
.
say
(
"{\"
code
\
":\"
success
\
", \"
msg
\
":\"
成功\
"}"
)
else
ngx
.
say
(
"SUCCESS"
)
end
ngx
.
eof
()
end
local
function
async
()
eof
()
local
ins_sql
=
async_sql_ins
()
async_db
(
ins_sql
)
--
local ins_sql = async_sql_ins()
--
async_db(ins_sql)
end
async
()
...
...
nginx/lua/luabiz/settle.lua
View file @
15d0a2a9
...
...
@@ -63,16 +63,16 @@ handler = function(premature, now_time)
-- node_smsvip: run()
-- node_vipacct: run()
tk_sync
:
run
()
node_card
:
run
(
now_time
)
node_ticket
:
run
(
now_time
)
tk_sdt
:
run
(
now_time
)
--
tk_sync: run()
--
node_card: run(now_time)
--
node_ticket: run(now_time)
--
tk_sdt: run(now_time)
--
local handle = io.popen("curl localhost:8080/settle")
--
if handle then
--
handle:close()
--
end
local
handle
=
io.popen
(
"curl localhost:8080/settle"
)
if
handle
then
handle
:
close
()
end
-- -- reset now_time
-- now_time = tostring(tonumber(now_time) - 1)
...
...
@@ -82,9 +82,9 @@ handler = function(premature, now_time)
-- now_time = zx_base:date2time(settledate)
-- end
--
nxt_time = zx_base:date2time(os.date("%Y-%m-%d 00:30:00", os.time()+24*60*60))
--
now_time = os.time();
--
delay = nxt_time - now_time;
nxt_time
=
zx_base
:
date2time
(
os.date
(
"%Y-%m-%d 00:30:00"
,
os.time
()
+
24
*
60
*
60
))
now_time
=
os.time
();
delay
=
nxt_time
-
now_time
;
local
ok
,
err
=
ngx
.
timer
.
every
(
24
*
60
*
60
,
handler
,
now_time
)
if
not
ok
then
ngx
.
log
(
ngx
.
ERR
,
"failed to create the timer:"
,
err
)
...
...
nginx/lua/luabiz/tk_sdt.lua
View file @
15d0a2a9
...
...
@@ -539,14 +539,14 @@ local function sdt_sql(tk_biz, tk_control, total_time)
return
end
--
--
INSERT INTO tk_control database
--
res, err, errcode, sqlstate = db_control:query(str)
--
ngx.log(ngx.NOTICE, str)
--
if not res then
--
ngx.log(ngx.ERR, "failed to query:", json.encode(tk_control),
--
":", err, ":", errcode, ":", sqlstate, ".")
--
-- return
--
end
-- INSERT INTO tk_control database
res
,
err
,
errcode
,
sqlstate
=
db_control
:
query
(
str
)
ngx
.
log
(
ngx
.
NOTICE
,
str
)
if
not
res
then
ngx
.
log
(
ngx
.
ERR
,
"failed to query:"
,
json
.
encode
(
tk_control
),
":"
,
err
,
":"
,
errcode
,
":"
,
sqlstate
,
"."
)
-- return
end
-- table.insert(shops, shop)
...
...
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