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
73e675f9
Commit
73e675f9
authored
Sep 28, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
30天带看
parent
2fee6c70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
Broker.php
application/api/controller/Broker.php
+16
-0
OReportModel.php
application/model/OReportModel.php
+18
-0
No files found.
application/api/controller/Broker.php
View file @
73e675f9
...
...
@@ -8,6 +8,7 @@ use app\model\AAgents;
use
app\model\Evaluate
;
use
app\model\EvaluateSign
;
use
app\model\OBargainModel
;
use
app\model\OReportModel
;
/**
* Description of Agents
...
...
@@ -49,6 +50,17 @@ class Broker extends Basic
$agent_client
=
$agents
->
getAgentClient
(
$fields
,
[
'c.id'
=>
$this
->
userId
,
'a.status'
=>
0
]);
}
//查找30天带看最多的人
$m_report
=
new
OReportModel
();
$report_fields
=
'COUNT( a.report_agent_id ) AS num,a.report_agent_id '
;
$report_where
[
'b.house_id'
]
=
$params
[
'house_id'
];
$report_where
[
'a.create_time'
]
=
[
'between'
,
[
date
(
'Y-m-d'
),
date
(
'Y-m-d'
,
strtotime
(
"-30 day"
))]];
$report_agent_id
=
$m_report
->
getMaxReportAgent
(
$report_fields
,
$report_where
);
if
(
!
empty
(
$report_agent_id
[
'report_agent_id'
]))
{
$report_agent
=
$agents
->
getUser
(
1
,
1
,
''
,
$fields
,
[
'c.id'
=>
$report_agent_id
[
'report_agent_id'
],
'a.status'
=>
0
]);
}
$where
[
'c.houses_id'
]
=
$params
[
'house_id'
];
$where
[
'c.is_del'
]
=
0
;
$where
[
'a.status'
]
=
0
;
...
...
@@ -58,6 +70,10 @@ class Broker extends Basic
array_unshift
(
$list
,
$agent_client
);
}
if
(
!
empty
(
$report_agent
[
0
][
'id'
]))
{
array_unshift
(
$list
,
$report_agent
[
0
]);
}
if
(
!
empty
(
$list
))
{
foreach
(
$list
as
$k
=>
$v
)
{
$v
[
'head_portrait'
]
=
AGENTHEADERIMGURL
.
$v
[
'img'
];
...
...
application/model/OReportModel.php
View file @
73e675f9
...
...
@@ -895,4 +895,21 @@ class OReportModel extends Model
//echo $this->getLastSql();
return
$data
;
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getMaxReportAgent
(
$field
,
$where
)
{
return
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'o_order b'
,
'a.id = b.f_id'
,
'left'
)
->
where
(
$where
)
->
group
(
'a.report_agent_id '
)
->
find
();
}
}
\ No newline at end of file
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