Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
hujun
tl_estate
Commits
1888d8e2
Commit
1888d8e2
authored
Oct 24, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收款总计
parent
7589b6bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
35 deletions
+49
-35
Collection.php
application/index/controller/Collection.php
+20
-32
OPayLogModel.php
application/model/OPayLogModel.php
+29
-3
No files found.
application/index/controller/Collection.php
View file @
1888d8e2
...
@@ -32,78 +32,94 @@ class Collection extends Basic
...
@@ -32,78 +32,94 @@ class Collection extends Basic
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
10
:
$this
->
params
[
'pageSize'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
10
:
$this
->
params
[
'pageSize'
];
$where
=
[];
$where
=
[];
$is_show
=
0
;
if
(
!
empty
(
$this
->
params
[
'start_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
if
(
!
empty
(
$this
->
params
[
'start_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'start_time'
]
.
' 00:00:00'
];
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'start_time'
]
.
' 00:00:00'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
empty
(
$this
->
params
[
'start_time'
]))
{
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
empty
(
$this
->
params
[
'start_time'
]))
{
$where
[
'a.create_time'
]
=
[
'< time'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
];
$where
[
'a.create_time'
]
=
[
'< time'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
!
empty
(
$this
->
params
[
'start_time'
]))
{
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
!
empty
(
$this
->
params
[
'start_time'
]))
{
$where
[
'a.create_time'
]
=
[
'between time'
,
[
$where
[
'a.create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'start_time'
]
.
' 00:00:00'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
$this
->
params
[
'start_time'
]
.
' 00:00:00'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
]];
]];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'income_start_time'
])
&&
empty
(
$this
->
params
[
'income_end_time'
]))
{
if
(
!
empty
(
$this
->
params
[
'income_start_time'
])
&&
empty
(
$this
->
params
[
'income_end_time'
]))
{
$where
[
'a.income_time'
]
=
[
'> time'
,
$this
->
params
[
'income_start_time'
]
.
' 00:00:00'
];
$where
[
'a.income_time'
]
=
[
'> time'
,
$this
->
params
[
'income_start_time'
]
.
' 00:00:00'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'income_end_time'
])
&&
empty
(
$this
->
params
[
'income_start_time'
]))
{
if
(
!
empty
(
$this
->
params
[
'income_end_time'
])
&&
empty
(
$this
->
params
[
'income_start_time'
]))
{
$where
[
'a.income_time'
]
=
[
'< time'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
];
$where
[
'a.income_time'
]
=
[
'< time'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'income_end_time'
])
&&
!
empty
(
$this
->
params
[
'income_start_time'
]))
{
if
(
!
empty
(
$this
->
params
[
'income_end_time'
])
&&
!
empty
(
$this
->
params
[
'income_start_time'
]))
{
$where
[
'a.income_time'
]
=
[
'between time'
,
[
$where
[
'a.income_time'
]
=
[
'between time'
,
[
$this
->
params
[
'income_start_time'
]
.
' 00:00:00'
,
$this
->
params
[
'income_end_time'
]
.
' 23:59:59'
$this
->
params
[
'income_start_time'
]
.
' 00:00:00'
,
$this
->
params
[
'income_end_time'
]
.
' 23:59:59'
]];
]];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'internal_title'
]))
{
if
(
!
empty
(
$this
->
params
[
'internal_title'
]))
{
$where
[
'd.internal_title'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'internal_title'
]
.
'%'
];
$where
[
'd.internal_title'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'internal_title'
]
.
'%'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'internal_address'
]))
{
if
(
!
empty
(
$this
->
params
[
'internal_address'
]))
{
$where
[
'd.internal_address'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'internal_address'
]
.
'%'
];
$where
[
'd.internal_address'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'internal_address'
]
.
'%'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'user_name'
]))
{
if
(
!
empty
(
$this
->
params
[
'user_name'
]))
{
$where
[
'c.user_name'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'user_name'
]
.
'%'
];
$where
[
'c.user_name'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'user_name'
]
.
'%'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'user_phone'
]))
{
if
(
!
empty
(
$this
->
params
[
'user_phone'
]))
{
$where
[
'c.user_phone'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'user_phone'
]
.
'%'
];
$where
[
'c.user_phone'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'user_phone'
]
.
'%'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'id'
]))
{
if
(
!
empty
(
$this
->
params
[
'id'
]))
{
$where
[
'a.house_number'
]
=
$this
->
params
[
'id'
];
$where
[
'a.house_number'
]
=
$this
->
params
[
'id'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'store_id'
]))
{
if
(
!
empty
(
$this
->
params
[
'store_id'
]))
{
$where
[
'e.store_id'
]
=
$this
->
params
[
'store_id'
];
$where
[
'e.store_id'
]
=
$this
->
params
[
'store_id'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'district_id'
]))
{
if
(
!
empty
(
$this
->
params
[
'district_id'
]))
{
$where
[
'e.district_id'
]
=
$this
->
params
[
'district_id'
];
$where
[
'e.district_id'
]
=
$this
->
params
[
'district_id'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'report_phone'
]))
{
if
(
!
empty
(
$this
->
params
[
'report_phone'
]))
{
$where
[
'e.phone'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'report_phone'
]
.
'%'
];
$where
[
'e.phone'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'report_phone'
]
.
'%'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'pay_type'
]))
{
if
(
!
empty
(
$this
->
params
[
'pay_type'
]))
{
$where
[
'a.pay_type'
]
=
$this
->
params
[
'pay_type'
];
$where
[
'a.pay_type'
]
=
$this
->
params
[
'pay_type'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'type'
]))
{
if
(
!
empty
(
$this
->
params
[
'type'
]))
{
$where
[
'a.type'
]
=
$this
->
params
[
'type'
];
$where
[
'a.type'
]
=
$this
->
params
[
'type'
];
$is_show
=
1
;
}
}
if
(
!
empty
(
$this
->
params
[
'report_name'
]))
{
if
(
!
empty
(
$this
->
params
[
'report_name'
]))
{
$where
[
'e.name'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'report_name'
]
.
'%'
];
$where
[
'e.name'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'report_name'
]
.
'%'
];
$is_show
=
1
;
}
}
if
(
empty
(
$this
->
params
[
'excel'
]))
{
if
(
empty
(
$this
->
params
[
'excel'
]))
{
...
@@ -114,36 +130,8 @@ class Collection extends Basic
...
@@ -114,36 +130,8 @@ class Collection extends Basic
$data
[
'data'
][
'total'
]
=
$order
->
getAddPayLogOrderListLmitTotal
(
$where
);
$data
[
'data'
][
'total'
]
=
$order
->
getAddPayLogOrderListLmitTotal
(
$where
);
//加时间条件
//加时间条件
if
(
$where
[
'a.income_time'
]
||
$where
[
'a.create_time'
])
{
if
(
$is_show
)
{
if
(
!
empty
(
$this
->
params
[
'income_start_time'
])
&&
empty
(
$this
->
params
[
'income_end_time'
]))
{
$data
[
'data'
][
'money_total'
]
=
$order
->
getMoneyTotal
(
$where
,
'a.money'
);
//总额
$pay_where
[
'income_time'
]
=
[
'> time'
,
$this
->
params
[
'start_time'
]
.
' 00:00:00'
];
}
if
(
!
empty
(
$this
->
params
[
'income_end_time'
])
&&
empty
(
$this
->
params
[
'income_start_time'
]))
{
$pay_where
[
'income_time'
]
=
[
'< time'
,
$this
->
params
[
'income_end_time'
]
.
' 23:59:59'
];
}
if
(
!
empty
(
$this
->
params
[
'income_end_time'
])
&&
!
empty
(
$this
->
params
[
'income_start_time'
]))
{
$pay_where
[
'income_time'
]
=
[
'between time'
,
[
$this
->
params
[
'income_start_time'
]
.
' 00:00:00'
,
$this
->
params
[
'income_end_time'
]
.
' 23:59:59'
]];
}
if
(
!
empty
(
$this
->
params
[
'start_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
$pay_where
[
'create_time'
]
=
[
'> time'
,
$this
->
params
[
'start_time'
]
.
' 00:00:00'
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
empty
(
$this
->
params
[
'start_time'
]))
{
$pay_where
[
'create_time'
]
=
[
'< time'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
!
empty
(
$this
->
params
[
'start_time'
]))
{
$pay_where
[
'create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'start_time'
]
.
' 00:00:00'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
]];
}
$data
[
'data'
][
'money_total'
]
=
$order
->
getMoneyTotal
(
$pay_where
);
//总额
}
else
{
}
else
{
$data
[
'data'
][
'money_total'
]
=
''
;
$data
[
'data'
][
'money_total'
]
=
''
;
}
}
...
...
application/model/OPayLogModel.php
View file @
1888d8e2
...
@@ -402,12 +402,38 @@ class OPayLogModel extends Model
...
@@ -402,12 +402,38 @@ class OPayLogModel extends Model
* 订单总额
* 订单总额
*
*
* @param $where
* @param $where
* @param $field
* @return float|int
* @return float|int
*/
*/
public
function
getMoneyTotal
(
$where
)
public
function
getMoneyTotal
(
$where
,
$field
)
{
{
$where
[
"is_del"
]
=
0
;
$params
[
"a.is_del"
]
=
0
;
return
$this
->
where
(
$where
)
->
sum
(
'money'
);
if
(
isset
(
$params
[
'e.name'
])
||
isset
(
$params
[
'f.store_name'
])
||
isset
(
$params
[
'e.phone'
]))
{
$data
=
Db
::
table
(
$this
->
table
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"o_report c"
,
"b.f_id = c.id"
,
"left"
)
->
join
(
'g_houses d'
,
'b.house_id = d.id'
,
'left'
)
->
join
(
'a_agents e'
,
'c.report_agent_id=e.id'
,
'left'
)
->
join
(
'a_store f'
,
'e.store_id=f.id'
,
'left'
)
->
join
(
'a_district g'
,
'f.district_id=g.id'
,
'left'
)
->
where
(
$where
)
->
sum
(
$field
);
}
else
{
$data
=
Db
::
table
(
$this
->
table
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"o_report c"
,
"b.f_id = c.id"
,
"left"
)
->
join
(
'g_houses d'
,
'b.house_id = d.id'
,
'left'
)
->
join
(
'a_agents e'
,
'c.report_agent_id=e.id'
,
'left'
)
->
join
(
'a_store f'
,
'e.store_id=f.id'
,
'left'
)
->
join
(
'a_district g'
,
'f.district_id=g.id'
,
'left'
)
->
where
(
$where
)
->
sum
(
$field
);
}
return
$data
;
}
}
/**
/**
...
...
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