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
0d62adfd
Commit
0d62adfd
authored
Aug 03, 2018
by
周尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善门店日统计 - 支付方式
parent
96335ba7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
58 deletions
+68
-58
nginx/lua/luabiz/tk_sdt.lua
nginx/lua/luabiz/tk_sdt.lua
+68
-58
No files found.
nginx/lua/luabiz/tk_sdt.lua
View file @
0d62adfd
...
@@ -258,64 +258,74 @@ local function sdt_sql(tk_biz, tk_control)
...
@@ -258,64 +258,74 @@ local function sdt_sql(tk_biz, tk_control)
tostring
(
shop
[
'shop_map_id'
]))
tostring
(
shop
[
'shop_map_id'
]))
-- -- GET charge summary
-- GET charge summary
-- local sql_rchg = string.format(
sql
=
sql
..
string.format
(
-- [[SELECT IFNULL(COUNT(*), 0) t_charge_cnt, IFNULL(SUM(pay_amt), 0) t_charge_amt ]]..
[[SELECT IFNULL(COUNT(*), 0) t_charge_cnt, IFNULL(SUM(pay_amt), 0) t_charge_amt ]]
..
-- [[FROM node_rchg ]]..
[[FROM node_rchg ]]
..
-- [[WHERE DATE(create_time) = DATE('%s') ]]..
[[WHERE DATE(create_time) = DATE('%s') ]]
..
-- [[AND shop_map_id = %s]],
[[AND shop_map_id = %s]]
,
-- os.date("%Y%m%d", os.time()-24*60*60),
os.date
(
"%Y%m%d"
,
os.time
()
-
24
*
60
*
60
),
-- tostring(shop.shop_map_id))
tostring
(
shop
.
shop_map_id
))
-- -- GET cash summary
-- GET cash summary
-- local sql_cash = string.format(
sql
=
sql
..
string.format
(
-- [[SELECT IFNULL(COUNT(*), 0) t_charge_cnt, IFNULL(SUM(pay_amt), 0) t_charge_amt ]]..
[[SELECT IFNULL(COUNT(*), 0) pay_cash_cnt, IFNULL(SUM(pay_amt), 0) pay_cash_amt ]]
..
-- [[FROM node_payment ]]..
[[FROM node_payment ]]
..
-- [[WHERE DATE(create_time) = DATE('%s') ]]..
[[WHERE DATE(create_time) = DATE('%s') ]]
..
-- [[AND pay_type_id = 1 ]].. -- paytype
[[AND pay_type_id = 1 ]]
..
-- paytype
-- [[AND shop_map_id = %s;]],
[[AND shop_map_id = %s;]]
,
-- os.date("%Y%m%d", os.time()-24*60*60),
os.date
(
"%Y%m%d"
,
os.time
()
-
24
*
60
*
60
),
-- tostring(shop.shop_map_id))
tostring
(
shop
.
shop_map_id
))
-- -- GET bank summary
-- GET WeiXin summary
-- local sql_cash = string.format(
sql
=
sql
..
string.format
(
-- [[SELECT IFNULL(COUNT(*), 0) t_charge_cnt, IFNULL(SUM(pay_amt), 0) t_charge_amt ]]..
[[SELECT IFNULL(COUNT(*), 0) pay_wx_cnt, IFNULL(SUM(pay_amt), 0) pay_wx_amt ]]
..
-- [[FROM node_payment ]]..
[[FROM node_payment ]]
..
-- [[WHERE DATE(create_time) = DATE('%s') ]]..
[[WHERE DATE(create_time) = DATE('%s') ]]
..
-- [[AND pay_type_id = 2 ]].. -- paytype
[[AND pay_type_id = 2 ]]
..
-- paytype
-- [[AND shop_map_id = %s]],
[[AND shop_map_id = %s;]]
,
-- os.date("%Y%m%d", os.time()-24*60*60),
os.date
(
"%Y%m%d"
,
os.time
()
-
24
*
60
*
60
),
-- tostring(shop.shop_map_id))
tostring
(
shop
.
shop_map_id
))
-- -- GET cash summary
-- GET AliPay summary
-- local sql_cash = string.format(
sql
=
sql
..
string.format
(
-- [[SELECT IFNULL(COUNT(*), 0) t_charge_cnt, IFNULL(SUM(pay_amt), 0) t_charge_amt ]]..
[[SELECT IFNULL(COUNT(*), 0) pay_alipay_cnt, IFNULL(SUM(pay_amt), 0) pay_alipay_amt ]]
..
-- [[FROM node_payment ]]..
[[FROM node_payment ]]
..
-- [[WHERE DATE(create_time) = DATE('%s') ]]..
[[WHERE DATE(create_time) = DATE('%s') ]]
..
-- [[AND pay_type_id = 1 ]].. -- paytype
[[AND pay_type_id = 3 ]]
..
-- paytype
-- [[AND shop_map_id = %s]],
[[AND shop_map_id = %s;]]
,
-- os.date("%Y%m%d", os.time()-24*60*60),
os.date
(
"%Y%m%d"
,
os.time
()
-
24
*
60
*
60
),
-- tostring(shop.shop_map_id))
tostring
(
shop
.
shop_map_id
))
-- -- GET cash summary
-- GET bank summary
-- local sql_cash = string.format(
sql
=
sql
..
string.format
(
-- [[SELECT IFNULL(COUNT(*), 0) t_charge_cnt, IFNULL(SUM(pay_amt), 0) t_charge_amt ]]..
[[SELECT IFNULL(COUNT(*), 0) pay_bank_cnt, IFNULL(SUM(pay_amt), 0) pay_bank_amt ]]
..
-- [[FROM node_payment ]]..
[[FROM node_payment ]]
..
-- [[WHERE DATE(create_time) = DATE('%s') ]]..
[[WHERE DATE(create_time) = DATE('%s') ]]
..
-- [[AND pay_type_id = 1 ]].. -- paytype
[[AND pay_type_id = 4 ]]
..
-- paytype
-- [[AND shop_map_id = %s]],
[[AND shop_map_id = %s;]]
,
-- os.date("%Y%m%d", os.time()-24*60*60),
os.date
(
"%Y%m%d"
,
os.time
()
-
24
*
60
*
60
),
-- tostring(shop.shop_map_id))
tostring
(
shop
.
shop_map_id
))
-- -- GET cash summary
-- GET vipcard summary
-- local sql_cash = string.format(
sql
=
sql
..
string.format
(
-- [[SELECT IFNULL(COUNT(*), 0) t_charge_cnt, IFNULL(SUM(pay_amt), 0) t_charge_amt ]]..
[[SELECT IFNULL(COUNT(*), 0) pay_vipcard_cnt, IFNULL(SUM(pay_amt), 0) pay_vipcard_amt ]]
..
-- [[FROM node_payment ]]..
[[FROM node_payment ]]
..
-- [[WHERE DATE(create_time) = DATE('%s') ]]..
[[WHERE DATE(create_time) = DATE('%s') ]]
..
-- [[AND pay_type_id = 1 ]].. -- paytype
[[AND (pay_type_id = 5 OR pay_type_id = 6) ]]
..
-- paytype
-- [[AND shop_map_id = %s]],
[[AND shop_map_id = %s;]]
,
-- os.date("%Y%m%d", os.time()-24*60*60),
os.date
(
"%Y%m%d"
,
os.time
()
-
24
*
60
*
60
),
-- tostring(shop.shop_map_id))
tostring
(
shop
.
shop_map_id
))
-- GET othpay summary
sql
=
sql
..
string.format
(
[[SELECT IFNULL(COUNT(*), 0) pay_othpay_cnt, IFNULL(SUM(pay_amt), 0) pay_vipcard_amt ]]
..
[[FROM node_payment ]]
..
[[WHERE DATE(create_time) = DATE('%s') ]]
..
[[AND pay_type_id = 9 ]]
..
-- paytype
[[AND shop_map_id = %s;]]
,
os.date
(
"%Y%m%d"
,
os.time
()
-
24
*
60
*
60
),
tostring
(
shop
.
shop_map_id
))
res
,
err
,
errcode
,
sqlstate
=
db_biz
:
query
(
sql
)
res
,
err
,
errcode
,
sqlstate
=
db_biz
:
query
(
sql
)
...
...
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