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
7c68756b
Commit
7c68756b
authored
Jul 13, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计
parent
4b76e8cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
153 additions
and
2 deletions
+153
-2
ReportService.php
application/api_broker/service/ReportService.php
+2
-2
OReportModel.php
application/model/OReportModel.php
+151
-0
No files found.
application/api_broker/service/ReportService.php
View file @
7c68756b
...
...
@@ -133,7 +133,7 @@ class ReportService
$params
[
"house_ids"
]
=
$ids
;
$result
=
$this
->
oReportModel
->
selectReportList
(
$field
,
$params
,
$pageNo
,
$pageSize
);
$count
=
$this
->
oReportModel
->
selectReportCount
(
$field
,
$params
);
$ids_str
=
""
;
if
(
count
(
$result
)
>
0
)
{
foreach
(
$result
as
$k
=>
$v
)
{
...
...
@@ -154,7 +154,7 @@ class ReportService
}
}
$result
[
"total"
]
=
$count
;
return
$result
;
}
return
null
;
...
...
application/model/OReportModel.php
View file @
7c68756b
...
...
@@ -311,6 +311,157 @@ class OReportModel extends Model
}
}
/**
* @param string $filed
* @param $params
* @return mixed
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public
function
selectReportCount
(
$filed
=
"id"
,
$params
)
{
if
(
isset
(
$params
[
"report_agent_id"
]))
{
$report_agent_id
=
$params
[
"report_agent_id"
];
}
if
(
isset
(
$params
[
"house_ids"
]))
{
$house_ids
=
$params
[
"house_ids"
];
}
switch
(
$params
[
"type"
])
{
case
2
:
$sql
=
"SELECT count(1) FROM
(( SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_march_in` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN (
$report_agent_id
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
)UNION(
SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_march_in` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`b`.`house_id` IN (
$house_ids
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
) ) AS aaa "
;
$result
=
$this
->
db
->
query
(
$sql
);
return
$result
;
case
3
:
$sql
=
"SELECT count(1) FROM
(
(
SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_paylog` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN (
$report_agent_id
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
)
UNION
(
SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_paylog` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`b`.`house_id` IN (
$house_ids
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
)
) AS aaa"
;
$result
=
$this
->
db
->
query
(
$sql
);
return
$result
;
case
4
:
$sql
=
"SELECT count(1) FROM
((
SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_bargain` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN (
$report_agent_id
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
)
UNION
(
SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_bargain` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`b`.`house_id` IN (
$house_ids
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
)
) AS aaa "
;
$result
=
$this
->
db
->
query
(
$sql
);
return
$result
;
default
:
$sql
=
"SELECT count(1) FROM
((SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
WHERE
`a`.`report_agent_id` IN (
$report_agent_id
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0)
UNION
(SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
WHERE
`b`.`house_id` IN (
$house_ids
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
) ) as aaa"
;
$result
=
$this
->
db
->
query
(
$sql
);
//echo $this->getLastSql();
return
$result
;
}
}
...
...
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