Commit 956f2471 authored by 周尚's avatar 周尚

修复卡券批处理因时间格式导致的错误

暂时关闭门店日统计的批处理检查以规避mysql连接错误问题
parent df4029a7
......@@ -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"';
......
......@@ -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
......
......@@ -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
......
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 = '0100' -- time to run, here is 12:00 for each day
local interval_time = '0030' -- 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
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment